Documentation ¶
Index ¶
- Constants
- type KeyTable
- type ParamSet
- type ParamSetPair
- type ParamSetPairs
- type ReadOnlySubspace
- func (ros ReadOnlySubspace) Get(ctx sdk.Context, key []byte, ptr interface{})
- func (ros ReadOnlySubspace) GetRaw(ctx sdk.Context, key []byte) []byte
- func (ros ReadOnlySubspace) Has(ctx sdk.Context, key []byte) bool
- func (ros ReadOnlySubspace) Modified(ctx sdk.Context, key []byte) bool
- func (ros ReadOnlySubspace) Name() string
- type Subspace
- func (s Subspace) Get(ctx sdk.Context, key []byte, ptr interface{})
- func (s Subspace) GetIfExists(ctx sdk.Context, key []byte, ptr interface{})
- func (s Subspace) GetParamSet(ctx sdk.Context, ps ParamSet)
- func (s Subspace) GetRaw(ctx sdk.Context, key []byte) []byte
- func (s Subspace) Has(ctx sdk.Context, key []byte) bool
- func (s Subspace) HasKeyTable() bool
- func (s Subspace) Modified(ctx sdk.Context, key []byte) bool
- func (s Subspace) Name() string
- func (s Subspace) Set(ctx sdk.Context, key []byte, value interface{})
- func (s Subspace) SetParamSet(ctx sdk.Context, ps ParamSet)
- func (s Subspace) Update(ctx sdk.Context, key, value []byte) error
- func (s Subspace) Validate(ctx sdk.Context, key []byte, value interface{}) error
- func (s Subspace) WithKeyTable(table KeyTable) Subspace
- type ValueValidatorFn
Constants ¶
const ( // StoreKey is the string store key for the param store StoreKey = "params" // TStoreKey is the string store key for the param transient store TStoreKey = "transient_params" )
const (
TestParamStore = "ParamsTest"
)
Keys for parameter access
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type KeyTable ¶
type KeyTable struct {
// contains filtered or unexported fields
}
KeyTable subspaces appropriate type for each parameter key
func NewKeyTable ¶
func NewKeyTable(pairs ...ParamSetPair) KeyTable
func (KeyTable) RegisterParamSet ¶
RegisterParamSet registers multiple ParamSetPairs from a ParamSet in a KeyTable.
func (KeyTable) RegisterType ¶
func (t KeyTable) RegisterType(psp ParamSetPair) KeyTable
RegisterType registers a single ParamSetPair (key-type pair) in a KeyTable.
type ParamSet ¶
type ParamSet interface {
ParamSetPairs() ParamSetPairs
}
ParamSet defines an interface for structs containing parameters for a module
type ParamSetPair ¶
type ParamSetPair struct { Key []byte Value interface{} ValidatorFn ValueValidatorFn }
Used for associating paramsubspace key and field of param structs
func NewParamSetPair ¶ added in v1.0.12
func NewParamSetPair(key []byte, value interface{}, vfn ValueValidatorFn) ParamSetPair
type ReadOnlySubspace ¶
type ReadOnlySubspace struct {
// contains filtered or unexported fields
}
Wrapper of Subspace, provides immutable functions only
func (ReadOnlySubspace) Get ¶
func (ros ReadOnlySubspace) Get(ctx sdk.Context, key []byte, ptr interface{})
Get delegates a read-only Get call to the Subspace.
func (ReadOnlySubspace) GetRaw ¶
func (ros ReadOnlySubspace) GetRaw(ctx sdk.Context, key []byte) []byte
GetRaw delegates a read-only GetRaw call to the Subspace.
func (ReadOnlySubspace) Has ¶
func (ros ReadOnlySubspace) Has(ctx sdk.Context, key []byte) bool
Has delegates a read-only Has call to the Subspace.
func (ReadOnlySubspace) Modified ¶
func (ros ReadOnlySubspace) Modified(ctx sdk.Context, key []byte) bool
Modified delegates a read-only Modified call to the Subspace.
func (ReadOnlySubspace) Name ¶
func (ros ReadOnlySubspace) Name() string
Name delegates a read-only Name call to the Subspace.
type Subspace ¶
type Subspace struct {
// contains filtered or unexported fields
}
Individual parameter store for each keeper Transient store persists for a block, so we use it for recording whether the parameter has been changed or not
func DefaultTestComponents ¶
Returns components for testing
func NewSubspace ¶
NewSubspace constructs a store with namestore
func (Subspace) Get ¶
Get queries for a parameter by key from the Subspace's KVStore and sets the value to the provided pointer. If the value does not exist, it will panic.
func (Subspace) GetIfExists ¶
GetIfExists queries for a parameter by key from the Subspace's KVStore and sets the value to the provided pointer. If the value does not exist, it will perform a no-op.
func (Subspace) GetParamSet ¶
GetParamSet iterates through each ParamSetPair where for each pair, it will retrieve the value and set it to the corresponding value pointer provided in the ParamSetPair by calling Subspace#Get.
func (Subspace) HasKeyTable ¶ added in v1.0.12
HasKeyTable returns if the Subspace has a KeyTable registered.
func (Subspace) Modified ¶
Modified returns true if the parameter key is set in the Subspace's transient KVStore.
func (Subspace) Set ¶
Set stores a value for given a parameter key assuming the parameter type has been registered. It will panic if the parameter type has not been registered or if the value cannot be encoded. A change record is also set in the Subspace's transient KVStore to mark the parameter as modified.
func (Subspace) SetParamSet ¶
SetParamSet iterates through each ParamSetPair and sets the value with the corresponding parameter key in the Subspace's KVStore.
func (Subspace) Update ¶
Update stores an updated raw value for a given parameter key assuming the parameter type has been registered. It will panic if the parameter type has not been registered or if the value cannot be encoded. An error is returned if the raw value is not compatible with the registered type for the parameter key or if the new value is invalid as determined by the registered type's validation function.
func (Subspace) Validate ¶ added in v1.0.12
Validate attempts to validate a parameter value by its key. If the key is not registered or if the validation of the value fails, an error is returned.
func (Subspace) WithKeyTable ¶
WithKeyTable initializes KeyTable and returns modified Subspace
type ValueValidatorFn ¶ added in v1.0.12
type ValueValidatorFn func(value interface{}) error