cosmos-sdk: github.com/cosmos/cosmos-sdk/x/capability/types Index | Files

package types

import "github.com/cosmos/cosmos-sdk/x/capability/types"

Index

Package Files

capability.pb.go codec.go errors.go genesis.go genesis.pb.go keys.go types.go

Constants

const (
    // ModuleName defines the module name
    ModuleName = "capability"

    // StoreKey defines the primary module store key
    StoreKey = ModuleName

    // MemStoreKey defines the in-memory store key
    MemStoreKey = "mem_capability"
)
const DefaultIndex uint64 = 1

DefaultIndex is the default capability global index

Variables

var (
    ErrInvalidLengthCapability        = fmt.Errorf("proto: negative length found during unmarshaling")
    ErrIntOverflowCapability          = fmt.Errorf("proto: integer overflow")
    ErrUnexpectedEndOfGroupCapability = fmt.Errorf("proto: unexpected end of group")
)
var (
    ErrCapabilityTaken          = sdkerrors.Register(ModuleName, 2, "capability name already taken")
    ErrOwnerClaimed             = sdkerrors.Register(ModuleName, 3, "given owner already claimed capability")
    ErrCapabilityNotOwned       = sdkerrors.Register(ModuleName, 4, "capability not owned by module")
    ErrCapabilityNotFound       = sdkerrors.Register(ModuleName, 5, "capability not found")
    ErrCapabilityOwnersNotFound = sdkerrors.Register(ModuleName, 6, "owners not found for capability")
)

x/capability module sentinel errors

var (
    ErrInvalidLengthGenesis        = fmt.Errorf("proto: negative length found during unmarshaling")
    ErrIntOverflowGenesis          = fmt.Errorf("proto: integer overflow")
    ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group")
)
var (
    // KeyIndex defines the key that stores the current globally unique capability
    // index.
    KeyIndex = []byte("index")

    // KeyPrefixIndexCapability defines a key prefix that stores index to capability
    // name mappings.
    KeyPrefixIndexCapability = []byte("capability_index")
)

func FwdCapabilityKey Uses

func FwdCapabilityKey(module string, cap *Capability) []byte

FwdCapabilityKey returns a forward lookup key for a given module and capability reference.

func IndexFromKey Uses

func IndexFromKey(key []byte) uint64

IndexFromKey returns an index from a call to IndexToKey for a given capability index.

func IndexToKey Uses

func IndexToKey(index uint64) []byte

IndexToKey returns bytes to be used as a key for a given capability index.

func RegisterCodec Uses

func RegisterCodec(cdc *codec.LegacyAmino)

RegisterCodec registers all the necessary types and interfaces for the capability module.

func RevCapabilityKey Uses

func RevCapabilityKey(module, name string) []byte

RevCapabilityKey returns a reverse lookup key for a given module and capability name.

type Capability Uses

type Capability struct {
    Index uint64 `protobuf:"varint,1,opt,name=index,proto3" json:"index,omitempty" yaml:"index"`
}

Capability defines an implementation of an object capability. The index provided to a Capability must be globally unique.

func NewCapability Uses

func NewCapability(index uint64) *Capability

NewCapability returns a reference to a new Capability to be used as an actual capability.

func (*Capability) Descriptor Uses

func (*Capability) Descriptor() ([]byte, []int)

func (*Capability) GetIndex Uses

func (m *Capability) GetIndex() uint64

func (*Capability) Marshal Uses

func (m *Capability) Marshal() (dAtA []byte, err error)

func (*Capability) MarshalTo Uses

func (m *Capability) MarshalTo(dAtA []byte) (int, error)

func (*Capability) MarshalToSizedBuffer Uses

func (m *Capability) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Capability) ProtoMessage Uses

func (*Capability) ProtoMessage()

func (*Capability) Reset Uses

func (m *Capability) Reset()

func (*Capability) Size Uses

func (m *Capability) Size() (n int)

func (*Capability) String Uses

func (ck *Capability) String() string

String returns the string representation of a Capability. The string contains the Capability's memory reference as the string is to be used in a composite key and to authenticate capabilities.

func (*Capability) Unmarshal Uses

func (m *Capability) Unmarshal(dAtA []byte) error

func (*Capability) XXX_DiscardUnknown Uses

func (m *Capability) XXX_DiscardUnknown()

func (*Capability) XXX_Marshal Uses

func (m *Capability) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Capability) XXX_Merge Uses

func (m *Capability) XXX_Merge(src proto.Message)

func (*Capability) XXX_Size Uses

func (m *Capability) XXX_Size() int

func (*Capability) XXX_Unmarshal Uses

func (m *Capability) XXX_Unmarshal(b []byte) error

type CapabilityOwners Uses

type CapabilityOwners struct {
    Owners []Owner `protobuf:"bytes,1,rep,name=owners,proto3" json:"owners"`
}

CapabilityOwners defines a set of owners of a single Capability. The set of owners must be unique.

func NewCapabilityOwners Uses

func NewCapabilityOwners() *CapabilityOwners

func (*CapabilityOwners) Descriptor Uses

func (*CapabilityOwners) Descriptor() ([]byte, []int)

func (*CapabilityOwners) Get Uses

func (co *CapabilityOwners) Get(owner Owner) (int, bool)

Get returns (i, true) of the provided owner in the CapabilityOwners if the owner exists, where i indicates the owner's index in the set. Otherwise (i, false) where i indicates where in the set the owner should be added.

func (*CapabilityOwners) GetOwners Uses

func (m *CapabilityOwners) GetOwners() []Owner

func (*CapabilityOwners) Marshal Uses

func (m *CapabilityOwners) Marshal() (dAtA []byte, err error)

func (*CapabilityOwners) MarshalTo Uses

func (m *CapabilityOwners) MarshalTo(dAtA []byte) (int, error)

func (*CapabilityOwners) MarshalToSizedBuffer Uses

func (m *CapabilityOwners) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*CapabilityOwners) ProtoMessage Uses

func (*CapabilityOwners) ProtoMessage()

func (*CapabilityOwners) Remove Uses

func (co *CapabilityOwners) Remove(owner Owner)

Remove removes a provided owner from the CapabilityOwners if it exists. If the owner does not exist, Remove is considered a no-op.

func (*CapabilityOwners) Reset Uses

func (m *CapabilityOwners) Reset()

func (*CapabilityOwners) Set Uses

func (co *CapabilityOwners) Set(owner Owner) error

Set attempts to add a given owner to the CapabilityOwners. If the owner already exists, an error will be returned. Set runs in O(log n) average time and O(n) in the worst case.

func (*CapabilityOwners) Size Uses

func (m *CapabilityOwners) Size() (n int)

func (*CapabilityOwners) String Uses

func (m *CapabilityOwners) String() string

func (*CapabilityOwners) Unmarshal Uses

func (m *CapabilityOwners) Unmarshal(dAtA []byte) error

func (*CapabilityOwners) XXX_DiscardUnknown Uses

func (m *CapabilityOwners) XXX_DiscardUnknown()

func (*CapabilityOwners) XXX_Marshal Uses

func (m *CapabilityOwners) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*CapabilityOwners) XXX_Merge Uses

func (m *CapabilityOwners) XXX_Merge(src proto.Message)

func (*CapabilityOwners) XXX_Size Uses

func (m *CapabilityOwners) XXX_Size() int

func (*CapabilityOwners) XXX_Unmarshal Uses

func (m *CapabilityOwners) XXX_Unmarshal(b []byte) error

type GenesisOwners Uses

type GenesisOwners struct {
    // index is the index of the capability owner.
    Index uint64 `protobuf:"varint,1,opt,name=index,proto3" json:"index,omitempty"`
    // index_owners are the owners at the given index.
    IndexOwners CapabilityOwners `protobuf:"bytes,2,opt,name=index_owners,json=indexOwners,proto3" json:"index_owners" yaml:"index_owners"`
}

GenesisOwners defines the capability owners with their corresponding index.

func (*GenesisOwners) Descriptor Uses

func (*GenesisOwners) Descriptor() ([]byte, []int)

func (*GenesisOwners) GetIndex Uses

func (m *GenesisOwners) GetIndex() uint64

func (*GenesisOwners) GetIndexOwners Uses

func (m *GenesisOwners) GetIndexOwners() CapabilityOwners

func (*GenesisOwners) Marshal Uses

func (m *GenesisOwners) Marshal() (dAtA []byte, err error)

func (*GenesisOwners) MarshalTo Uses

func (m *GenesisOwners) MarshalTo(dAtA []byte) (int, error)

func (*GenesisOwners) MarshalToSizedBuffer Uses

func (m *GenesisOwners) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*GenesisOwners) ProtoMessage Uses

func (*GenesisOwners) ProtoMessage()

func (*GenesisOwners) Reset Uses

func (m *GenesisOwners) Reset()

func (*GenesisOwners) Size Uses

func (m *GenesisOwners) Size() (n int)

func (*GenesisOwners) String Uses

func (m *GenesisOwners) String() string

func (*GenesisOwners) Unmarshal Uses

func (m *GenesisOwners) Unmarshal(dAtA []byte) error

func (*GenesisOwners) XXX_DiscardUnknown Uses

func (m *GenesisOwners) XXX_DiscardUnknown()

func (*GenesisOwners) XXX_Marshal Uses

func (m *GenesisOwners) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*GenesisOwners) XXX_Merge Uses

func (m *GenesisOwners) XXX_Merge(src proto.Message)

func (*GenesisOwners) XXX_Size Uses

func (m *GenesisOwners) XXX_Size() int

func (*GenesisOwners) XXX_Unmarshal Uses

func (m *GenesisOwners) XXX_Unmarshal(b []byte) error

type GenesisState Uses

type GenesisState struct {
    // index is the capability global index.
    Index uint64 `protobuf:"varint,1,opt,name=index,proto3" json:"index,omitempty"`
    // owners represents a map from index to owners of the capability index
    // index key is string to allow amino marshalling.
    Owners []GenesisOwners `protobuf:"bytes,2,rep,name=owners,proto3" json:"owners"`
}

GenesisState defines the capability module's genesis state.

func DefaultGenesis Uses

func DefaultGenesis() *GenesisState

DefaultGenesis returns the default Capability genesis state

func (*GenesisState) Descriptor Uses

func (*GenesisState) Descriptor() ([]byte, []int)

func (*GenesisState) GetIndex Uses

func (m *GenesisState) GetIndex() uint64

func (*GenesisState) GetOwners Uses

func (m *GenesisState) GetOwners() []GenesisOwners

func (*GenesisState) Marshal Uses

func (m *GenesisState) Marshal() (dAtA []byte, err error)

func (*GenesisState) MarshalTo Uses

func (m *GenesisState) MarshalTo(dAtA []byte) (int, error)

func (*GenesisState) MarshalToSizedBuffer Uses

func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*GenesisState) ProtoMessage Uses

func (*GenesisState) ProtoMessage()

func (*GenesisState) Reset Uses

func (m *GenesisState) Reset()

func (*GenesisState) Size Uses

func (m *GenesisState) Size() (n int)

func (*GenesisState) String Uses

func (m *GenesisState) String() string

func (*GenesisState) Unmarshal Uses

func (m *GenesisState) Unmarshal(dAtA []byte) error

func (GenesisState) Validate Uses

func (gs GenesisState) Validate() error

Validate performs basic genesis state validation returning an error upon any failure.

func (*GenesisState) XXX_DiscardUnknown Uses

func (m *GenesisState) XXX_DiscardUnknown()

func (*GenesisState) XXX_Marshal Uses

func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*GenesisState) XXX_Merge Uses

func (m *GenesisState) XXX_Merge(src proto.Message)

func (*GenesisState) XXX_Size Uses

func (m *GenesisState) XXX_Size() int

func (*GenesisState) XXX_Unmarshal Uses

func (m *GenesisState) XXX_Unmarshal(b []byte) error

type Owner Uses

type Owner struct {
    Module string `protobuf:"bytes,1,opt,name=module,proto3" json:"module,omitempty" yaml:"module"`
    Name   string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty" yaml:"name"`
}

Owner defines a single capability owner. An owner is defined by the name of capability and the module name.

func NewOwner Uses

func NewOwner(module, name string) Owner

func (*Owner) Descriptor Uses

func (*Owner) Descriptor() ([]byte, []int)

func (Owner) Key Uses

func (o Owner) Key() string

Key returns a composite key for an Owner.

func (*Owner) Marshal Uses

func (m *Owner) Marshal() (dAtA []byte, err error)

func (*Owner) MarshalTo Uses

func (m *Owner) MarshalTo(dAtA []byte) (int, error)

func (*Owner) MarshalToSizedBuffer Uses

func (m *Owner) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Owner) ProtoMessage Uses

func (*Owner) ProtoMessage()

func (*Owner) Reset Uses

func (m *Owner) Reset()

func (*Owner) Size Uses

func (m *Owner) Size() (n int)

func (Owner) String Uses

func (o Owner) String() string

func (*Owner) Unmarshal Uses

func (m *Owner) Unmarshal(dAtA []byte) error

func (*Owner) XXX_DiscardUnknown Uses

func (m *Owner) XXX_DiscardUnknown()

func (*Owner) XXX_Marshal Uses

func (m *Owner) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Owner) XXX_Merge Uses

func (m *Owner) XXX_Merge(src proto.Message)

func (*Owner) XXX_Size Uses

func (m *Owner) XXX_Size() int

func (*Owner) XXX_Unmarshal Uses

func (m *Owner) XXX_Unmarshal(b []byte) error

Package types imports 12 packages (graph) and is imported by 13 packages. Updated 2020-08-13. Refresh now. Tools for package owners.