github.com/Finschia/finschia-sdk@v0.48.1/x/params/spec/02_subspace.md (about) 1 <!-- 2 order: 2 3 --> 4 5 # Subspace 6 7 `Subspace` is a prefixed subspace of the parameter store. Each module which uses the 8 parameter store will take a `Subspace` to isolate permission to access. 9 10 ## Key 11 12 Parameter keys are human readable alphanumeric strings. A parameter for the key 13 `"ExampleParameter"` is stored under `[]byte("SubspaceName" + "/" + "ExampleParameter")`, 14 where `"SubspaceName"` is the name of the subspace. 15 16 Subkeys are secondary parameter keys those are used along with a primary parameter key. 17 Subkeys can be used for grouping or dynamic parameter key generation during runtime. 18 19 ## KeyTable 20 21 All of the parameter keys that will be used should be registered at the compile 22 time. `KeyTable` is essentially a `map[string]attribute`, where the `string` is a parameter key. 23 24 Currently, `attribute` consists of a `reflect.Type`, which indicates the parameter 25 type to check that provided key and value are compatible and registered, as well as a function `ValueValidatorFn` to validate values. 26 27 Only primary keys have to be registered on the `KeyTable`. Subkeys inherit the 28 attribute of the primary key. 29 30 ## ParamSet 31 32 Modules often define parameters as a proto message. The generated struct can implement 33 `ParamSet` interface to be used with the following methods: 34 35 * `KeyTable.RegisterParamSet()`: registers all parameters in the struct 36 * `Subspace.{Get, Set}ParamSet()`: Get to & Set from the struct 37 38 The implementor should be a pointer in order to use `GetParamSet()`.