Documentation ¶
Index ¶
- Constants
- Variables
- func FwdCapabilityKey(module string, cap *Capability) []byte
- func IndexFromKey(key []byte) uint64
- func IndexToKey(index uint64) []byte
- func RevCapabilityKey(module, name string) []byte
- type Capability
- func (*Capability) Descriptor() ([]byte, []int)
- func (m *Capability) GetIndex() uint64
- func (m *Capability) Marshal() (dAtA []byte, err error)
- func (m *Capability) MarshalTo(dAtA []byte) (int, error)
- func (m *Capability) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Capability) ProtoMessage()
- func (m *Capability) Reset()
- func (m *Capability) Size() (n int)
- func (ck *Capability) String() string
- func (m *Capability) Unmarshal(dAtA []byte) error
- func (m *Capability) XXX_DiscardUnknown()
- func (m *Capability) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Capability) XXX_Merge(src proto.Message)
- func (m *Capability) XXX_Size() int
- func (m *Capability) XXX_Unmarshal(b []byte) error
- type CapabilityOwners
- func (*CapabilityOwners) Descriptor() ([]byte, []int)
- func (co *CapabilityOwners) Get(owner Owner) (int, bool)
- func (m *CapabilityOwners) GetOwners() []Owner
- func (m *CapabilityOwners) Marshal() (dAtA []byte, err error)
- func (m *CapabilityOwners) MarshalTo(dAtA []byte) (int, error)
- func (m *CapabilityOwners) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*CapabilityOwners) ProtoMessage()
- func (co *CapabilityOwners) Remove(owner Owner)
- func (m *CapabilityOwners) Reset()
- func (co *CapabilityOwners) Set(owner Owner) error
- func (m *CapabilityOwners) Size() (n int)
- func (m *CapabilityOwners) String() string
- func (m *CapabilityOwners) Unmarshal(dAtA []byte) error
- func (m *CapabilityOwners) XXX_DiscardUnknown()
- func (m *CapabilityOwners) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *CapabilityOwners) XXX_Merge(src proto.Message)
- func (m *CapabilityOwners) XXX_Size() int
- func (m *CapabilityOwners) XXX_Unmarshal(b []byte) error
- type GenesisOwners
- func (*GenesisOwners) Descriptor() ([]byte, []int)
- func (m *GenesisOwners) GetIndex() uint64
- func (m *GenesisOwners) GetIndexOwners() CapabilityOwners
- func (m *GenesisOwners) Marshal() (dAtA []byte, err error)
- func (m *GenesisOwners) MarshalTo(dAtA []byte) (int, error)
- func (m *GenesisOwners) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*GenesisOwners) ProtoMessage()
- func (m *GenesisOwners) Reset()
- func (m *GenesisOwners) Size() (n int)
- func (m *GenesisOwners) String() string
- func (m *GenesisOwners) Unmarshal(dAtA []byte) error
- func (m *GenesisOwners) XXX_DiscardUnknown()
- func (m *GenesisOwners) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *GenesisOwners) XXX_Merge(src proto.Message)
- func (m *GenesisOwners) XXX_Size() int
- func (m *GenesisOwners) XXX_Unmarshal(b []byte) error
- type GenesisState
- func (*GenesisState) Descriptor() ([]byte, []int)
- func (m *GenesisState) GetIndex() uint64
- func (m *GenesisState) GetOwners() []GenesisOwners
- func (m *GenesisState) Marshal() (dAtA []byte, err error)
- func (m *GenesisState) MarshalTo(dAtA []byte) (int, error)
- func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*GenesisState) ProtoMessage()
- func (m *GenesisState) Reset()
- func (m *GenesisState) Size() (n int)
- func (m *GenesisState) String() string
- func (m *GenesisState) Unmarshal(dAtA []byte) error
- func (gs GenesisState) Validate() error
- func (m *GenesisState) XXX_DiscardUnknown()
- func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *GenesisState) XXX_Merge(src proto.Message)
- func (m *GenesisState) XXX_Size() int
- func (m *GenesisState) XXX_Unmarshal(b []byte) error
- type Owner
- func (*Owner) Descriptor() ([]byte, []int)
- func (o Owner) Key() string
- func (m *Owner) Marshal() (dAtA []byte, err error)
- func (m *Owner) MarshalTo(dAtA []byte) (int, error)
- func (m *Owner) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Owner) ProtoMessage()
- func (m *Owner) Reset()
- func (m *Owner) Size() (n int)
- func (o Owner) String() string
- func (m *Owner) Unmarshal(dAtA []byte) error
- func (m *Owner) XXX_DiscardUnknown()
- func (m *Owner) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Owner) XXX_Merge(src proto.Message)
- func (m *Owner) XXX_Size() int
- func (m *Owner) XXX_Unmarshal(b []byte) error
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 ( ErrInvalidCapabilityName = sdkerrors.Register(ModuleName, 2, "capability name not valid") ErrNilCapability = sdkerrors.Register(ModuleName, 3, "provided capability is nil") ErrCapabilityTaken = sdkerrors.Register(ModuleName, 4, "capability name already taken") ErrOwnerClaimed = sdkerrors.Register(ModuleName, 5, "given owner already claimed capability") ErrCapabilityNotOwned = sdkerrors.Register(ModuleName, 6, "capability not owned by module") ErrCapabilityNotFound = sdkerrors.Register(ModuleName, 7, "capability not found") ErrCapabilityOwnersNotFound = sdkerrors.Register(ModuleName, 8, "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 // owners mappings. KeyPrefixIndexCapability = []byte("capability_index") // KeyMemInitialized defines the key that stores the initialized flag in the memory store KeyMemInitialized = []byte("mem_initialized") )
Functions ¶
func FwdCapabilityKey ¶
func FwdCapabilityKey(module string, cap *Capability) []byte
FwdCapabilityKey returns a forward lookup key for a given module and capability reference.
func IndexFromKey ¶
IndexFromKey returns an index from a call to IndexToKey for a given capability index.
func IndexToKey ¶
IndexToKey returns bytes to be used as a key for a given capability index.
func RevCapabilityKey ¶
RevCapabilityKey returns a reverse lookup key for a given module and capability name.
Types ¶
type Capability ¶
type Capability struct {
Index uint64 `protobuf:"varint,1,opt,name=index,proto3" json:"index,omitempty"`
}
Capability defines an implementation of an object capability. The index provided to a Capability must be globally unique.
func NewCapability ¶
func NewCapability(index uint64) *Capability
NewCapability returns a reference to a new Capability to be used as an actual capability.
func (*Capability) Descriptor ¶
func (*Capability) Descriptor() ([]byte, []int)
func (*Capability) GetIndex ¶
func (m *Capability) GetIndex() uint64
func (*Capability) Marshal ¶
func (m *Capability) Marshal() (dAtA []byte, err error)
func (*Capability) MarshalToSizedBuffer ¶
func (m *Capability) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*Capability) ProtoMessage ¶
func (*Capability) ProtoMessage()
func (*Capability) Reset ¶
func (m *Capability) Reset()
func (*Capability) Size ¶
func (m *Capability) Size() (n int)
func (*Capability) String ¶
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 ¶
func (m *Capability) Unmarshal(dAtA []byte) error
func (*Capability) XXX_DiscardUnknown ¶
func (m *Capability) XXX_DiscardUnknown()
func (*Capability) XXX_Marshal ¶
func (m *Capability) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*Capability) XXX_Merge ¶
func (m *Capability) XXX_Merge(src proto.Message)
func (*Capability) XXX_Size ¶
func (m *Capability) XXX_Size() int
func (*Capability) XXX_Unmarshal ¶
func (m *Capability) XXX_Unmarshal(b []byte) error
type CapabilityOwners ¶
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 ¶
func NewCapabilityOwners() *CapabilityOwners
func (*CapabilityOwners) Descriptor ¶
func (*CapabilityOwners) Descriptor() ([]byte, []int)
func (*CapabilityOwners) Get ¶
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 ¶
func (m *CapabilityOwners) GetOwners() []Owner
func (*CapabilityOwners) Marshal ¶
func (m *CapabilityOwners) Marshal() (dAtA []byte, err error)
func (*CapabilityOwners) MarshalToSizedBuffer ¶
func (m *CapabilityOwners) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*CapabilityOwners) ProtoMessage ¶
func (*CapabilityOwners) ProtoMessage()
func (*CapabilityOwners) Remove ¶
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 ¶
func (m *CapabilityOwners) Reset()
func (*CapabilityOwners) Set ¶
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 ¶
func (m *CapabilityOwners) Size() (n int)
func (*CapabilityOwners) String ¶
func (m *CapabilityOwners) String() string
func (*CapabilityOwners) Unmarshal ¶
func (m *CapabilityOwners) Unmarshal(dAtA []byte) error
func (*CapabilityOwners) XXX_DiscardUnknown ¶
func (m *CapabilityOwners) XXX_DiscardUnknown()
func (*CapabilityOwners) XXX_Marshal ¶
func (m *CapabilityOwners) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*CapabilityOwners) XXX_Merge ¶
func (m *CapabilityOwners) XXX_Merge(src proto.Message)
func (*CapabilityOwners) XXX_Size ¶
func (m *CapabilityOwners) XXX_Size() int
func (*CapabilityOwners) XXX_Unmarshal ¶
func (m *CapabilityOwners) XXX_Unmarshal(b []byte) error
type GenesisOwners ¶
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"` }
GenesisOwners defines the capability owners with their corresponding index.
func (*GenesisOwners) Descriptor ¶
func (*GenesisOwners) Descriptor() ([]byte, []int)
func (*GenesisOwners) GetIndex ¶
func (m *GenesisOwners) GetIndex() uint64
func (*GenesisOwners) GetIndexOwners ¶
func (m *GenesisOwners) GetIndexOwners() CapabilityOwners
func (*GenesisOwners) Marshal ¶
func (m *GenesisOwners) Marshal() (dAtA []byte, err error)
func (*GenesisOwners) MarshalToSizedBuffer ¶
func (m *GenesisOwners) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*GenesisOwners) ProtoMessage ¶
func (*GenesisOwners) ProtoMessage()
func (*GenesisOwners) Reset ¶
func (m *GenesisOwners) Reset()
func (*GenesisOwners) Size ¶
func (m *GenesisOwners) Size() (n int)
func (*GenesisOwners) String ¶
func (m *GenesisOwners) String() string
func (*GenesisOwners) Unmarshal ¶
func (m *GenesisOwners) Unmarshal(dAtA []byte) error
func (*GenesisOwners) XXX_DiscardUnknown ¶
func (m *GenesisOwners) XXX_DiscardUnknown()
func (*GenesisOwners) XXX_Marshal ¶
func (m *GenesisOwners) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*GenesisOwners) XXX_Merge ¶
func (m *GenesisOwners) XXX_Merge(src proto.Message)
func (*GenesisOwners) XXX_Size ¶
func (m *GenesisOwners) XXX_Size() int
func (*GenesisOwners) XXX_Unmarshal ¶
func (m *GenesisOwners) XXX_Unmarshal(b []byte) error
type GenesisState ¶
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 ¶
func DefaultGenesis() *GenesisState
DefaultGenesis returns the default Capability genesis state
func (*GenesisState) Descriptor ¶
func (*GenesisState) Descriptor() ([]byte, []int)
func (*GenesisState) GetIndex ¶
func (m *GenesisState) GetIndex() uint64
func (*GenesisState) GetOwners ¶
func (m *GenesisState) GetOwners() []GenesisOwners
func (*GenesisState) Marshal ¶
func (m *GenesisState) Marshal() (dAtA []byte, err error)
func (*GenesisState) MarshalToSizedBuffer ¶
func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*GenesisState) ProtoMessage ¶
func (*GenesisState) ProtoMessage()
func (*GenesisState) Reset ¶
func (m *GenesisState) Reset()
func (*GenesisState) Size ¶
func (m *GenesisState) Size() (n int)
func (*GenesisState) String ¶
func (m *GenesisState) String() string
func (*GenesisState) Unmarshal ¶
func (m *GenesisState) Unmarshal(dAtA []byte) error
func (GenesisState) Validate ¶
func (gs GenesisState) Validate() error
Validate performs basic genesis state validation returning an error upon any failure.
func (*GenesisState) XXX_DiscardUnknown ¶
func (m *GenesisState) XXX_DiscardUnknown()
func (*GenesisState) XXX_Marshal ¶
func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*GenesisState) XXX_Merge ¶
func (m *GenesisState) XXX_Merge(src proto.Message)
func (*GenesisState) XXX_Size ¶
func (m *GenesisState) XXX_Size() int
func (*GenesisState) XXX_Unmarshal ¶
func (m *GenesisState) XXX_Unmarshal(b []byte) error
type Owner ¶
type Owner struct { Module string `protobuf:"bytes,1,opt,name=module,proto3" json:"module,omitempty"` Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` }
Owner defines a single capability owner. An owner is defined by the name of capability and the module name.
func (*Owner) Descriptor ¶
func (*Owner) ProtoMessage ¶
func (*Owner) ProtoMessage()
func (*Owner) XXX_DiscardUnknown ¶
func (m *Owner) XXX_DiscardUnknown()