cosmos-sdk: github.com/cosmos/cosmos-sdk/x/params/subspace Index | Files

package subspace

import "github.com/cosmos/cosmos-sdk/x/params/subspace"

Index

Package Files

doc.go paramset.go subspace.go table.go test_common.go

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

type KeyTable Uses

type KeyTable struct {
    // contains filtered or unexported fields
}

KeyTable subspaces appropriate type for each parameter key

func NewKeyTable Uses

func NewKeyTable(keytypes ...interface{}) (res KeyTable)

Constructs new table

func (KeyTable) RegisterParamSet Uses

func (t KeyTable) RegisterParamSet(ps ParamSet) KeyTable

Register multiple pairs from ParamSet

func (KeyTable) RegisterType Uses

func (t KeyTable) RegisterType(key []byte, ty interface{}) KeyTable

Register single key-type pair

type ParamSet Uses

type ParamSet interface {
    ParamSetPairs() ParamSetPairs
}

ParamSet defines an interface for structs containing parameters for a module

type ParamSetPair Uses

type ParamSetPair struct {
    Key   []byte
    Value interface{}
}

ParamSetPair is used for associating paramsubspace key and field of param structs

func NewParamSetPair Uses

func NewParamSetPair(key []byte, value interface{}) ParamSetPair

NewParamSetPair creates a new ParamSetPair instance

type ParamSetPairs Uses

type ParamSetPairs []ParamSetPair

ParamSetPairs Slice of KeyFieldPair

type ReadOnlySubspace Uses

type ReadOnlySubspace struct {
    // contains filtered or unexported fields
}

Wrapper of Subspace, provides immutable functions only

func (ReadOnlySubspace) Get Uses

func (ros ReadOnlySubspace) Get(ctx sdk.Context, key []byte, ptr interface{})

Exposes Get

func (ReadOnlySubspace) GetRaw Uses

func (ros ReadOnlySubspace) GetRaw(ctx sdk.Context, key []byte) []byte

Exposes GetRaw

func (ReadOnlySubspace) Has Uses

func (ros ReadOnlySubspace) Has(ctx sdk.Context, key []byte) bool

Exposes Has

func (ReadOnlySubspace) Modified Uses

func (ros ReadOnlySubspace) Modified(ctx sdk.Context, key []byte) bool

Exposes Modified

func (ReadOnlySubspace) Name Uses

func (ros ReadOnlySubspace) Name() string

Exposes Space

type Subspace Uses

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 Uses

func DefaultTestComponents(t *testing.T) (sdk.Context, Subspace, func() sdk.CommitID)

Returns components for testing

func NewSubspace Uses

func NewSubspace(cdc *codec.Codec, key sdk.StoreKey, tkey sdk.StoreKey, name string) (res Subspace)

NewSubspace constructs a store with namestore

func (Subspace) Get Uses

func (s Subspace) Get(ctx sdk.Context, key []byte, ptr interface{})

Get parameter from store

func (Subspace) GetIfExists Uses

func (s Subspace) GetIfExists(ctx sdk.Context, key []byte, ptr interface{})

GetIfExists do not modify ptr if the stored parameter is nil

func (Subspace) GetParamSet Uses

func (s Subspace) GetParamSet(ctx sdk.Context, ps ParamSet)

Get to ParamSet

func (Subspace) GetRaw Uses

func (s Subspace) GetRaw(ctx sdk.Context, key []byte) []byte

Get raw bytes of parameter from store

func (Subspace) GetWithSubkey Uses

func (s Subspace) GetWithSubkey(ctx sdk.Context, key, subkey []byte, ptr interface{})

GetWithSubkey returns a parameter with a given key and a subkey.

func (Subspace) GetWithSubkeyIfExists Uses

func (s Subspace) GetWithSubkeyIfExists(ctx sdk.Context, key, subkey []byte, ptr interface{})

GetWithSubkeyIfExists returns a parameter with a given key and a subkey but does not modify ptr if the stored parameter is nil.

func (Subspace) Has Uses

func (s Subspace) Has(ctx sdk.Context, key []byte) bool

Check if the parameter is set in the store

func (Subspace) Modified Uses

func (s Subspace) Modified(ctx sdk.Context, key []byte) bool

Returns true if the parameter is set in the block

func (Subspace) Name Uses

func (s Subspace) Name() string

Returns name of Subspace

func (Subspace) Set Uses

func (s Subspace) Set(ctx sdk.Context, key []byte, param interface{})

Set stores the parameter. It returns error if stored parameter has different type from input. It also set to the transient store to record change.

func (Subspace) SetParamSet Uses

func (s Subspace) SetParamSet(ctx sdk.Context, ps ParamSet)

Set from ParamSet

func (Subspace) SetWithSubkey Uses

func (s Subspace) SetWithSubkey(ctx sdk.Context, key []byte, subkey []byte, param interface{})

SetWithSubkey set a parameter with a key and subkey Checks parameter type only over the key

func (Subspace) Update Uses

func (s Subspace) Update(ctx sdk.Context, key []byte, param []byte) error

Update stores raw parameter bytes. It returns error if the stored parameter has a different type from the input. It also sets to the transient store to record change.

func (Subspace) UpdateWithSubkey Uses

func (s Subspace) UpdateWithSubkey(ctx sdk.Context, key []byte, subkey []byte, param []byte) error

UpdateWithSubkey stores raw parameter bytes with a key and subkey. It checks the parameter type only over the key.

func (Subspace) WithKeyTable Uses

func (s Subspace) WithKeyTable(table KeyTable) Subspace

WithKeyTable initializes KeyTable and returns modified Subspace

Package subspace imports 12 packages (graph) and is imported by 4 packages. Updated 2019-08-02. Refresh now. Tools for package owners.