@@ -19,15 +19,15 @@ information about how these interfaces are implemented.
19
19
## Storage Items
20
20
21
21
The ` storage ` module in
22
- [ FRAME Support] ( https://substrate.dev/rustdocs/master /frame_support/storage/index.html ) gives
22
+ [ FRAME Support] ( https://crates.parity.io /frame_support/storage/index.html ) gives
23
23
runtime developers access to Substrate's flexible storage APIs. Any value that can be encoded by the
24
24
[ Parity SCALE codec] ( ../advanced/codec ) is supported by these storage APIs:
25
25
26
- - [ Storage Value] ( https://substrate.dev/rustdocs/master /frame_support/storage/trait.StorageValue.html ) -
26
+ - [ Storage Value] ( https://crates.parity.io /frame_support/storage/trait.StorageValue.html ) -
27
27
A single value
28
- - [ Storage Map] ( https://substrate.dev/rustdocs/master /frame_support/storage/trait.StorageMap.html ) -
28
+ - [ Storage Map] ( https://crates.parity.io /frame_support/storage/trait.StorageMap.html ) -
29
29
A key-value hash map
30
- - [ Storage Double Map] ( https://substrate.dev/rustdocs/master /frame_support/storage/trait.StorageDoubleMap.html ) -
30
+ - [ Storage Double Map] ( https://crates.parity.io /frame_support/storage/trait.StorageDoubleMap.html ) -
31
31
An implementation of a map with two keys that provides the important ability to efficiently remove
32
32
all entries that have a common first key
33
33
@@ -49,16 +49,16 @@ will stop producing blocks, which means that it will stop functioning.
49
49
#### Methods
50
50
51
51
Refer to the Storage Value documentation for
52
- [ a comprehensive list of the methods that Storage Values expose] ( https://substrate.dev/rustdocs/master /frame_support/storage/trait.StorageValue.html#required-methods ) .
52
+ [ a comprehensive list of the methods that Storage Values expose] ( https://crates.parity.io /frame_support/storage/trait.StorageValue.html#required-methods ) .
53
53
Some of the most important methods are summarized here:
54
54
55
- - [ ` get() ` ] ( https://substrate.dev/rustdocs/master /frame_support/storage/trait.StorageValue.html#tymethod.get ) -
55
+ - [ ` get() ` ] ( https://crates.parity.io /frame_support/storage/trait.StorageValue.html#tymethod.get ) -
56
56
Load the value from storage.
57
- - [ ` put(val) ` ] ( https://substrate.dev/rustdocs/master /frame_support/storage/trait.StorageValue.html#tymethod.put ) -
57
+ - [ ` put(val) ` ] ( https://crates.parity.io /frame_support/storage/trait.StorageValue.html#tymethod.put ) -
58
58
Store the provided value.
59
- - [ ` mutate(fn) ` ] ( https://substrate.dev/rustdocs/master /frame_support/storage/trait.StorageValue.html#tymethod.mutate ) -
59
+ - [ ` mutate(fn) ` ] ( https://crates.parity.io /frame_support/storage/trait.StorageValue.html#tymethod.mutate ) -
60
60
Mutate the value with the provided function.
61
- - [ ` take() ` ] ( https://substrate.dev/rustdocs/master /frame_support/storage/trait.StorageValue.html#tymethod.take ) -
61
+ - [ ` take() ` ] ( https://crates.parity.io /frame_support/storage/trait.StorageValue.html#tymethod.take ) -
62
62
Load the value and remove it from storage.
63
63
64
64
### Storage Maps
@@ -73,21 +73,21 @@ Storage Maps are implemented.
73
73
74
74
#### Methods
75
75
76
- [ Storage Maps expose an API] ( https://substrate.dev/rustdocs/master /frame_support/storage/trait.StorageMap.html#required-methods )
76
+ [ Storage Maps expose an API] ( https://crates.parity.io /frame_support/storage/trait.StorageMap.html#required-methods )
77
77
that is similar to that of Storage Values.
78
78
79
79
- ` get ` - Load the value associated with the provided key from storage. Docs:
80
- [ ` StorageMap#get(key) ` ] ( https://substrate.dev/rustdocs/master /frame_support/storage/trait.StorageMap.html#tymethod.get ) ,
81
- [ ` StorageDoubleMap#get(key1, key2) ` ] ( https://substrate.dev/rustdocs/master /frame_support/storage/trait.StorageDoubleMap.html#tymethod.get )
80
+ [ ` StorageMap#get(key) ` ] ( https://crates.parity.io /frame_support/storage/trait.StorageMap.html#tymethod.get ) ,
81
+ [ ` StorageDoubleMap#get(key1, key2) ` ] ( https://crates.parity.io /frame_support/storage/trait.StorageDoubleMap.html#tymethod.get )
82
82
- ` insert ` - Store the provided value by associating it with the given key. Docs:
83
- [ ` StorageMap#insert(key, val) ` ] ( https://substrate.dev/rustdocs/master /frame_support/storage/trait.StorageMap.html#tymethod.insert ) ,
84
- [ ` StorageDoubleMap#insert(key1, key2, val) ` ] ( https://substrate.dev/rustdocs/master /frame_support/storage/trait.StorageDoubleMap.html#tymethod.insert )
83
+ [ ` StorageMap#insert(key, val) ` ] ( https://crates.parity.io /frame_support/storage/trait.StorageMap.html#tymethod.insert ) ,
84
+ [ ` StorageDoubleMap#insert(key1, key2, val) ` ] ( https://crates.parity.io /frame_support/storage/trait.StorageDoubleMap.html#tymethod.insert )
85
85
- ` mutate ` - Use the provided function to mutate the value associated with the given key. Docs:
86
- [ ` StorageMap#mutate(key, fn) ` ] ( https://substrate.dev/rustdocs/master /frame_support/storage/trait.StorageMap.html#tymethod.mutate ) ,
87
- [ ` StorageDoubleMap#mutate(key1, key2, fn) ` ] ( https://substrate.dev/rustdocs/master /frame_support/storage/trait.StorageDoubleMap.html#tymethod.mutate )
86
+ [ ` StorageMap#mutate(key, fn) ` ] ( https://crates.parity.io /frame_support/storage/trait.StorageMap.html#tymethod.mutate ) ,
87
+ [ ` StorageDoubleMap#mutate(key1, key2, fn) ` ] ( https://crates.parity.io /frame_support/storage/trait.StorageDoubleMap.html#tymethod.mutate )
88
88
- ` take ` - Load the value associated with the given key and remove it from storage. Docs:
89
- [ ` StorageMap#take(key) ` ] ( https://substrate.dev/rustdocs/master /frame_support/storage/trait.StorageMap.html#tymethod.take ) ,
90
- [ ` StorageDoubleMap#take(key1, key2) ` ] ( https://substrate.dev/rustdocs/master /frame_support/storage/trait.StorageDoubleMap.html#tymethod.take )
89
+ [ ` StorageMap#take(key) ` ] ( https://crates.parity.io /frame_support/storage/trait.StorageMap.html#tymethod.take ) ,
90
+ [ ` StorageDoubleMap#take(key1, key2) ` ] ( https://crates.parity.io /frame_support/storage/trait.StorageDoubleMap.html#tymethod.take )
91
91
92
92
#### Iterable Storage Maps
93
93
@@ -111,16 +111,16 @@ Storage Double Maps, the `iter` and `drain` methods require a parameter, i.e. th
111
111
112
112
- ` iter ` - Enumerate all elements in the map in no particular order. If you alter the map while
113
113
doing this, you'll get undefined results. Docs:
114
- [ ` IterableStorageMap#iter() ` ] ( https://substrate.dev/rustdocs/master /frame_support/storage/trait.IterableStorageMap.html#tymethod.iter ) ,
115
- [ ` IterableStorageDoubleMap#iter(key1) ` ] ( https://substrate.dev/rustdocs/master /frame_support/storage/trait.IterableStorageDoubleMap.html#tymethod.iter )
114
+ [ ` IterableStorageMap#iter() ` ] ( https://crates.parity.io /frame_support/storage/trait.IterableStorageMap.html#tymethod.iter ) ,
115
+ [ ` IterableStorageDoubleMap#iter(key1) ` ] ( https://crates.parity.io /frame_support/storage/trait.IterableStorageDoubleMap.html#tymethod.iter )
116
116
- ` drain ` - Remove all elements from the map and iterate through them in no particular order. If you
117
117
add elements to the map while doing this, you'll get undefined results. Docs:
118
- [ ` IterableStorageMap#drain() ` ] ( https://substrate.dev/rustdocs/master /frame_support/storage/trait.IterableStorageMap.html#tymethod.drain ) ,
119
- [ ` IterableStorageDoubleMap#drain(key1) ` ] ( https://substrate.dev/rustdocs/master /frame_support/storage/trait.IterableStorageDoubleMap.html#tymethod.drain )
118
+ [ ` IterableStorageMap#drain() ` ] ( https://crates.parity.io /frame_support/storage/trait.IterableStorageMap.html#tymethod.drain ) ,
119
+ [ ` IterableStorageDoubleMap#drain(key1) ` ] ( https://crates.parity.io /frame_support/storage/trait.IterableStorageDoubleMap.html#tymethod.drain )
120
120
- ` translate ` - Use the provided function to translate all elements of the map, in no particular
121
121
order. To remove an element from the map, return ` None ` from the translation function. Docs:
122
- [ ` IterableStorageMap#translate(fn) ` ] ( https://substrate.dev/rustdocs/master /frame_support/storage/trait.IterableStorageMap.html#tymethod.translate ) ,
123
- [ ` IterableStorageDoubleMap#translate(fn) ` ] ( https://substrate.dev/rustdocs/master /frame_support/storage/trait.IterableStorageDoubleMap.html#tymethod.translate )
122
+ [ ` IterableStorageMap#translate(fn) ` ] ( https://crates.parity.io /frame_support/storage/trait.IterableStorageMap.html#tymethod.translate ) ,
123
+ [ ` IterableStorageDoubleMap#translate(fn) ` ] ( https://crates.parity.io /frame_support/storage/trait.IterableStorageDoubleMap.html#tymethod.translate )
124
124
125
125
#### Hashing Algorithms
126
126
@@ -163,11 +163,11 @@ those that are transparent:
163
163
164
164
| Hasher | Cryptographic | Transparent |
165
165
| ----------------------------------------------------------------------------------------------------- | ------------- | ----------- |
166
- | [ Blake2 128] ( https://substrate.dev/rustdocs/master /frame_support/struct.Blake2_128.html ) | X | |
167
- | [ TwoX 128] ( https://substrate.dev/rustdocs/master /frame_support/struct.Twox128.html ) | | |
168
- | [ Blake2 128 Concat] ( https://substrate.dev/rustdocs/master /frame_support/struct.Blake2_128Concat.html ) | X | X |
169
- | [ TwoX 64 Concat] ( https://substrate.dev/rustdocs/master /frame_support/struct.Twox64Concat.html ) | | X |
170
- | [ Identity] ( https://substrate.dev/rustdocs/master /frame_support/struct.Identity.html ) | | |
166
+ | [ Blake2 128] ( https://crates.parity.io /frame_support/struct.Blake2_128.html ) | X | |
167
+ | [ TwoX 128] ( https://crates.parity.io /frame_support/struct.Twox128.html ) | | |
168
+ | [ Blake2 128 Concat] ( https://crates.parity.io /frame_support/struct.Blake2_128Concat.html ) | X | X |
169
+ | [ TwoX 64 Concat] ( https://crates.parity.io /frame_support/struct.Twox64Concat.html ) | | X |
170
+ | [ Identity] ( https://crates.parity.io /frame_support/struct.Identity.html ) | | |
171
171
172
172
The Identity hasher encapsulates a hashing algorithm that has an output equal to its input (the
173
173
identity function). This type of hasher should only be used when the starting key is already a
@@ -176,7 +176,7 @@ cryptographic hash.
176
176
## Declaring Storage Items
177
177
178
178
You can use
179
- [ the ` decl_storage ` macro] ( https://substrate.dev/rustdocs/master /frame_support/macro.decl_storage.html )
179
+ [ the ` decl_storage ` macro] ( https://crates.parity.io /frame_support/macro.decl_storage.html )
180
180
to easily create new runtime storage items. Here is an example of what it looks like to declare each
181
181
type of storage item:
182
182
@@ -247,7 +247,7 @@ decl_storage! {
247
247
### Genesis Config
248
248
249
249
You can define
250
- [ an optional ` GenesisConfig ` ] ( https://substrate.dev/rustdocs/master /frame_support/macro.decl_storage.html#genesisconfig )
250
+ [ an optional ` GenesisConfig ` ] ( https://crates.parity.io /frame_support/macro.decl_storage.html#genesisconfig )
251
251
struct in order to initialize storage items in the genesis block of your blockchain.
252
252
253
253
// TODO
@@ -358,7 +358,7 @@ Check out
358
358
### References
359
359
360
360
- Visit the reference docs for the
361
- [ ` decl_storage! ` macro] ( https://substrate.dev/rustdocs/master /frame_support/macro.decl_storage.html )
361
+ [ ` decl_storage! ` macro] ( https://crates.parity.io /frame_support/macro.decl_storage.html )
362
362
for more details about the available storage declarations.
363
363
364
364
- Visit the reference docs for
0 commit comments