keeper

package
v0.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 10, 2023 License: LGPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const BondIDAttributeName = "bondId"

BondIDAttributeName denotes the record bond ID.

View Source
const ExpiryTimeAttributeName = "expiryTime"

ExpiryTimeAttributeName denotes the record expiry time.

Variables

View Source
var (

	// PrefixCIDToRecordIndex is the prefix for CID -> Record index.
	// Note: This is the primary index in the system.
	// Note: Golang doesn't support const arrays.
	PrefixCIDToRecordIndex = []byte{0x00}

	// PrefixNameAuthorityRecordIndex is the prefix for the name -> NameAuthority index.
	PrefixNameAuthorityRecordIndex = []byte{0x01}

	// PrefixCRNToNameRecordIndex is the prefix for the CRN -> NamingRecord index.
	PrefixCRNToNameRecordIndex = []byte{0x02}

	// PrefixBondIDToRecordsIndex is the prefix for the Bond ID -> [Record] index.
	PrefixBondIDToRecordsIndex = []byte{0x03}

	// PrefixBlockChangesetIndex is the prefix for the block changeset index.
	PrefixBlockChangesetIndex = []byte{0x04}

	// PrefixAuctionToAuthorityNameIndex is the prefix for the auction ID -> authority name index.
	PrefixAuctionToAuthorityNameIndex = []byte{0x05}

	// PrefixBondIDToAuthoritiesIndex is the prefix for the Bond ID -> [Authority] index.
	PrefixBondIDToAuthoritiesIndex = []byte{0x06}

	//  PrefixAttributesIndex is the prefix for the registry Record.Attribute -> []Record.ID index
	PrefixAttributesIndex = []byte{0x07}

	// PrefixExpiryTimeToRecordsIndex is the prefix for the Expiry Time -> [Record] index.
	PrefixExpiryTimeToRecordsIndex = []byte{0x10}

	// PrefixExpiryTimeToAuthoritiesIndex is the prefix for the Expiry Time -> [Authority] index.
	PrefixExpiryTimeToAuthoritiesIndex = []byte{0x11}

	// PrefixCIDToNamesIndex the the reverse index for naming, i.e. maps CID -> []Names.
	// TODO(ashwin): Move out of WNS once we have an indexing service.
	PrefixCIDToNamesIndex = []byte{0xe0}
)

Functions

func AddRecordToNameMapping

func AddRecordToNameMapping(store sdk.KVStore, id string, crn string)

AddRecordToNameMapping adds a name to the record ID -> []names index.

func GetAttributeValue

func GetAttributeValue(input *types.QueryListRecordsRequest_ValueInput) interface{}

func GetAttributesIndexKey

func GetAttributesIndexKey(key string, value interface{}) []byte

func GetAuctionToAuthorityIndexKey

func GetAuctionToAuthorityIndexKey(auctionID string) []byte

func GetBlockChangeSetIndexKey

func GetBlockChangeSetIndexKey(height int64) []byte

func GetCIDToNamesIndexKey

func GetCIDToNamesIndexKey(id string) []byte

func GetNameAuthority

func GetNameAuthority(store sdk.KVStore, codec codec.BinaryCodec, name string) types.NameAuthority

GetNameAuthority - gets a name authority from the store.

func GetNameAuthorityIndexKey

func GetNameAuthorityIndexKey(name string) []byte

GetNameAuthorityIndexKey Generates name -> NameAuthority index key.

func GetNameRecord

func GetNameRecord(store sdk.KVStore, codec codec.BinaryCodec, crn string) *types.NameRecord

GetNameRecord - gets a name record from the store.

func GetNameRecordIndexKey

func GetNameRecordIndexKey(crn string) []byte

GetNameRecordIndexKey Generates CRN -> NameRecord index key.

func GetRecordIndexKey

func GetRecordIndexKey(id string) []byte

GetRecordIndexKey Generates Bond ID -> Bond index key.

func HasNameAuthority

func HasNameAuthority(store sdk.KVStore, name string) bool

HasNameAuthority - checks if a name authority entry exists.

func NewMsgServerImpl

func NewMsgServerImpl(keeper Keeper) types.MsgServer

NewMsgServerImpl returns an implementation of the bond MsgServer interface for the provided Keeper.

func RecordInvariants

func RecordInvariants(k Keeper) sdk.Invariant

RecordInvariants checks that every record: (1) has a corresponding naming record & (2) associated bond exists, if bondID is not null.

func RegisterInvariants

func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper)

RegisterInvariants registers all registry module invariants.

func RemoveBondToAuthorityIndexEntry

func RemoveBondToAuthorityIndexEntry(store sdk.KVStore, bondID string, name string)

func RemoveRecordToNameMapping

func RemoveRecordToNameMapping(store sdk.KVStore, id string, crn string)

RemoveRecordToNameMapping removes a name from the record ID -> []names index.

func ResolveCRN

func ResolveCRN(store sdk.KVStore, crn string, k Keeper, c sdk.Context) (*types.Record, *types.NameRecord)

ResolveCRN resolves a CRN to a record.

func SetNameAuthority

func SetNameAuthority(ctx sdk.Context, store sdk.KVStore, codec codec.BinaryCodec, name string, authority *types.NameAuthority)

func SetNameRecord

func SetNameRecord(store sdk.KVStore, codec codec.BinaryCodec, crn string, id string, height int64)

SetNameRecord - sets a name record.

Types

type Keeper

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

Keeper maintains the link to storage and exposes getter/setter methods for the various parts of the state machine

func NewKeeper

func NewKeeper(cdc codec.BinaryCodec, accountKeeper auth.AccountKeeper, bankKeeper bank.Keeper, recordKeeper RecordKeeper,
	bondKeeper bondkeeper.Keeper, auctionKeeper auctionkeeper.Keeper, storeKey storetypes.StoreKey, ps paramtypes.Subspace,
) Keeper

NewKeeper creates new instances of the registry Keeper

func (Keeper) AddAuctionToAuthorityMapping

func (k Keeper) AddAuctionToAuthorityMapping(ctx sdk.Context, auctionID string, name string)

func (Keeper) AddBondToAuthorityIndexEntry

func (k Keeper) AddBondToAuthorityIndexEntry(ctx sdk.Context, bondID string, name string)

AddBondToAuthorityIndexEntry adds the Bond ID -> [Authority] index entry.

func (Keeper) AddBondToRecordIndexEntry

func (k Keeper) AddBondToRecordIndexEntry(ctx sdk.Context, bondID string, id string)

AddBondToRecordIndexEntry adds the Bond ID -> [Record] index entry.

func (Keeper) AuthorityExpiryQueueIterator

func (k Keeper) AuthorityExpiryQueueIterator(ctx sdk.Context, endTime time.Time) sdk.Iterator

AuthorityExpiryQueueIterator returns all the authority expiry queue timeslices from time 0 until endTime.

func (Keeper) DeleteAuthorityExpiryQueue

func (k Keeper) DeleteAuthorityExpiryQueue(ctx sdk.Context, name string, authority types.NameAuthority)

DeleteAuthorityExpiryQueue deletes an authority name from the authority expiry queue.

func (Keeper) DeleteAuthorityExpiryQueueTimeSlice

func (k Keeper) DeleteAuthorityExpiryQueueTimeSlice(ctx sdk.Context, timestamp time.Time)

DeleteAuthorityExpiryQueueTimeSlice deletes a specific authority expiry queue timeslice.

func (Keeper) DeleteRecordExpiryQueue

func (k Keeper) DeleteRecordExpiryQueue(ctx sdk.Context, record types.Record)

DeleteRecordExpiryQueue deletes a record CID from the record expiry queue.

func (Keeper) DeleteRecordExpiryQueueTimeSlice

func (k Keeper) DeleteRecordExpiryQueueTimeSlice(ctx sdk.Context, timestamp time.Time)

DeleteRecordExpiryQueueTimeSlice deletes a specific record expiry queue timeslice.

func (Keeper) GetAllExpiredAuthorities

func (k Keeper) GetAllExpiredAuthorities(ctx sdk.Context, currTime time.Time) (expiredAuthorityNames []string)

GetAllExpiredAuthorities returns a concatenated list of all the timeslices before currTime.

func (Keeper) GetAllExpiredRecords

func (k Keeper) GetAllExpiredRecords(ctx sdk.Context, currTime time.Time) (expiredRecordCIDs []string)

GetAllExpiredRecords returns a concatenated list of all the timeslices before currTime.

func (Keeper) GetAttributeMapping

func (k Keeper) GetAttributeMapping(ctx sdk.Context, key []byte) ([]string, error)

func (Keeper) GetAuthorityExpiryQueue

func (k Keeper) GetAuthorityExpiryQueue(ctx sdk.Context) []*types.ExpiryQueueRecord

func (Keeper) GetAuthorityExpiryQueueTimeSlice

func (k Keeper) GetAuthorityExpiryQueueTimeSlice(ctx sdk.Context, timestamp time.Time) []string

func (Keeper) GetModuleBalances

func (k Keeper) GetModuleBalances(ctx sdk.Context) []*types.AccountBalance

GetModuleBalances gets the registry module account(s) balances.

func (Keeper) GetNameAuthority

func (k Keeper) GetNameAuthority(ctx sdk.Context, name string) types.NameAuthority

GetNameAuthority - gets a name authority from the store.

func (Keeper) GetNameRecord

func (k Keeper) GetNameRecord(ctx sdk.Context, crn string) *types.NameRecord

GetNameRecord - gets a name record from the store.

func (Keeper) GetParams

func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)

GetParams - Get all parameters as types.Params.

func (Keeper) GetRecord

func (k Keeper) GetRecord(ctx sdk.Context, id string) (record types.Record)

GetRecord - gets a record from the store.

func (Keeper) GetRecordExpiryQueue

func (k Keeper) GetRecordExpiryQueue(ctx sdk.Context) []*types.ExpiryQueueRecord

func (Keeper) GetRecordExpiryQueueTimeSlice

func (k Keeper) GetRecordExpiryQueueTimeSlice(ctx sdk.Context, timestamp time.Time) []string

GetRecordExpiryQueueTimeSlice gets a specific record queue timeslice. A timeslice is a slice of CIDs corresponding to records that expire at a certain time.

func (Keeper) HasNameAuthority

func (k Keeper) HasNameAuthority(ctx sdk.Context, name string) bool

HasNameAuthority - checks if a name/authority exists.

func (Keeper) HasNameRecord

func (k Keeper) HasNameRecord(ctx sdk.Context, crn string) bool

HasNameRecord - checks if a name record exists.

func (Keeper) HasRecord

func (k Keeper) HasRecord(ctx sdk.Context, id string) bool

HasRecord - checks if a record by the given ID exists.

func (Keeper) InsertAuthorityExpiryQueue

func (k Keeper) InsertAuthorityExpiryQueue(ctx sdk.Context, name string, expiryTime time.Time)

func (Keeper) InsertRecordExpiryQueue

func (k Keeper) InsertRecordExpiryQueue(ctx sdk.Context, val types.Record)

InsertRecordExpiryQueue inserts a record CID to the appropriate timeslice in the record expiry queue.

func (Keeper) ListNameAuthorityRecords

func (k Keeper) ListNameAuthorityRecords(ctx sdk.Context) map[string]types.NameAuthority

ListNameAuthorityRecords - get all name authority records.

func (Keeper) ListNameRecords

func (k Keeper) ListNameRecords(ctx sdk.Context) []types.NameEntry

ListNameRecords - get all name records.

func (Keeper) ListRecords

func (k Keeper) ListRecords(ctx sdk.Context) []types.Record

ListRecords - get all records.

func (Keeper) ProcessAssociateBond

func (k Keeper) ProcessAssociateBond(ctx sdk.Context, msg types.MsgAssociateBond) error

ProcessAssociateBond associates a record with a bond.

func (Keeper) ProcessAttributes

func (k Keeper) ProcessAttributes(ctx sdk.Context, record types.RecordType) error

func (Keeper) ProcessAuthorityExpiryQueue

func (k Keeper) ProcessAuthorityExpiryQueue(ctx sdk.Context)

ProcessAuthorityExpiryQueue tries to renew expiring authorities (by collecting rent) else marks them as expired.

func (Keeper) ProcessDeleteName

func (k Keeper) ProcessDeleteName(ctx sdk.Context, msg types.MsgDeleteNameAuthority) error

ProcessDeleteName removes a CRN -> Record ID mapping.

func (Keeper) ProcessDissociateBond

func (k Keeper) ProcessDissociateBond(ctx sdk.Context, msg types.MsgDissociateBond) error

ProcessDissociateBond dissociates a record from its bond.

func (Keeper) ProcessDissociateRecords

func (k Keeper) ProcessDissociateRecords(ctx sdk.Context, msg types.MsgDissociateRecords) error

ProcessDissociateRecords dissociates all records associated with a given bond.

func (Keeper) ProcessReAssociateRecords

func (k Keeper) ProcessReAssociateRecords(ctx sdk.Context, msg types.MsgReAssociateRecords) error

ProcessReAssociateRecords switches records from and old to new bond.

func (Keeper) ProcessRecordExpiryQueue

func (k Keeper) ProcessRecordExpiryQueue(ctx sdk.Context)

ProcessRecordExpiryQueue tries to renew expiring records (by collecting rent) else marks them as deleted.

func (Keeper) ProcessRenewRecord

func (k Keeper) ProcessRenewRecord(ctx sdk.Context, msg types.MsgRenewRecord) error

ProcessRenewRecord renews a record.

func (Keeper) ProcessReserveAuthority

func (k Keeper) ProcessReserveAuthority(ctx sdk.Context, msg types.MsgReserveAuthority) error

ProcessReserveAuthority reserves a name authority.

func (Keeper) ProcessReserveSubAuthority

func (k Keeper) ProcessReserveSubAuthority(ctx sdk.Context, name string, msg types.MsgReserveAuthority) error

ProcessReserveSubAuthority reserves a sub-authority.

func (Keeper) ProcessSetAuthorityBond

func (k Keeper) ProcessSetAuthorityBond(ctx sdk.Context, msg types.MsgSetAuthorityBond) error

func (Keeper) ProcessSetName

func (k Keeper) ProcessSetName(ctx sdk.Context, msg types.MsgSetName) error

ProcessSetName creates a CRN -> Record ID mapping.

func (Keeper) ProcessSetRecord

func (k Keeper) ProcessSetRecord(ctx sdk.Context, msg types.MsgSetRecord) (*types.RecordType, error)

ProcessSetRecord creates a record.

func (Keeper) PutRecord

func (k Keeper) PutRecord(ctx sdk.Context, record types.Record)

PutRecord - saves a record to the store and updates ID -> Record index.

func (Keeper) RecordExpiryQueueIterator

func (k Keeper) RecordExpiryQueueIterator(ctx sdk.Context, endTime time.Time) sdk.Iterator

RecordExpiryQueueIterator returns all the record expiry queue timeslices from time 0 until endTime.

func (Keeper) RecordsFromAttributes

func (k Keeper) RecordsFromAttributes(ctx sdk.Context, attributes []*types.QueryListRecordsRequest_KeyValueInput, all bool) ([]types.Record, error)

func (Keeper) RemoveAuctionToAuthorityMapping

func (k Keeper) RemoveAuctionToAuthorityMapping(ctx sdk.Context, auctionID string)

func (Keeper) RemoveBondToAuthorityIndexEntry

func (k Keeper) RemoveBondToAuthorityIndexEntry(ctx sdk.Context, bondID string, name string)

RemoveBondToAuthorityIndexEntry removes the Bond ID -> [Authority] index entry.

func (Keeper) RemoveBondToRecordIndexEntry

func (k Keeper) RemoveBondToRecordIndexEntry(ctx sdk.Context, bondID string, id string)

RemoveBondToRecordIndexEntry removes the Bond ID -> [Record] index entry.

func (Keeper) ResolveCRN

func (k Keeper) ResolveCRN(ctx sdk.Context, crn string) *types.Record

ResolveCRN resolves a CRN to a record.

func (Keeper) SetAttributeMapping

func (k Keeper) SetAttributeMapping(ctx sdk.Context, key []byte, recordID string) error

func (Keeper) SetAuthorityExpiryQueueTimeSlice

func (k Keeper) SetAuthorityExpiryQueueTimeSlice(ctx sdk.Context, timestamp time.Time, names []string)

func (Keeper) SetNameAuthority

func (k Keeper) SetNameAuthority(ctx sdk.Context, name string, authority *types.NameAuthority)

SetNameAuthority creates the NameAuthority record.

func (Keeper) SetNameRecord

func (k Keeper) SetNameRecord(ctx sdk.Context, crn string, id string)

SetNameRecord - sets a name record.

func (Keeper) SetParams

func (k Keeper) SetParams(ctx sdk.Context, params types.Params)

SetParams - set the params.

func (Keeper) SetRecordExpiryQueueTimeSlice

func (k Keeper) SetRecordExpiryQueueTimeSlice(ctx sdk.Context, timestamp time.Time, cids []string)

SetRecordExpiryQueueTimeSlice sets a specific record expiry queue timeslice.

func (Keeper) TryTakeAuthorityRent

func (k Keeper) TryTakeAuthorityRent(ctx sdk.Context, name string, authority types.NameAuthority)

TryTakeAuthorityRent tries to take rent from the authority bond.

func (Keeper) TryTakeRecordRent

func (k Keeper) TryTakeRecordRent(ctx sdk.Context, record types.Record)

TryTakeRecordRent tries to take rent from the record bond.

type Querier

type Querier struct {
	Keeper
}

func (Querier) LookupCrn

func (Querier) ResolveCrn

func (Querier) Whois

type RecordKeeper

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

RecordKeeper exposes the bare minimal read-only API for other modules.

func NewRecordKeeper

func NewRecordKeeper(auctionKeeper auctionkeeper.Keeper, storeKey storetypes.StoreKey, cdc codec.BinaryCodec) RecordKeeper

NewRecordKeeper creates new instances of the registry RecordKeeper

func (RecordKeeper) GetAuctionToAuthorityMapping

func (k RecordKeeper) GetAuctionToAuthorityMapping(ctx sdk.Context, auctionID string) string

func (RecordKeeper) ModuleName

func (k RecordKeeper) ModuleName() string

ModuleName returns the module name.

func (RecordKeeper) OnAuction

func (k RecordKeeper) OnAuction(ctx sdk.Context, auctionID string)

func (RecordKeeper) OnAuctionBid

func (k RecordKeeper) OnAuctionBid(ctx sdk.Context, auctionID string, bidderAddress string)

func (RecordKeeper) OnAuctionWinnerSelected

func (k RecordKeeper) OnAuctionWinnerSelected(ctx sdk.Context, auctionID string)

func (RecordKeeper) QueryRecordsByBond

func (k RecordKeeper) QueryRecordsByBond(ctx sdk.Context, bondID string) []types.Record

QueryRecordsByBond - get all records for the given bond.

func (RecordKeeper) UsesAuction

func (k RecordKeeper) UsesAuction(ctx sdk.Context, auctionID string) bool

func (RecordKeeper) UsesBond

func (k RecordKeeper) UsesBond(ctx sdk.Context, bondID string) bool

UsesBond returns true if the bond has associated records.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL