Help us shape the future of Go! Take the 2026 Go Developer Survey

keepers

package
v0.0.32 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2021 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TagAccount                 = "a"
	TagPushKey                 = "g"
	TagAddressPushKeyID        = "ag"
	TagRepo                    = "r"
	TagRepoPropVote            = "rpv"
	TagRepoPropEndIndex        = "rei"
	TagNS                      = "ns"
	TagClosedProp              = "cp"
	TagBlockInfo               = "b"
	TagHelmRepo                = "hr"
	TagValidators              = "v"
	TagTrackedRepo             = "tr"
	TagAnnouncementScheduleKey = "ak"
	TagRepoRefLastSyncHeight   = "rrh"
	TagAddressRepoPairKey      = "ar"
)

Variables

View Source
var (
	// ErrBlockInfoNotFound means the block info was not found
	ErrBlockInfoNotFound = fmt.Errorf("block info not found")
)

Functions

func MakeAccountKey

func MakeAccountKey(address string) []byte

MakeAccountKey creates a key for accessing an account

func MakeAddrPushKeyIDIndexKey

func MakeAddrPushKeyIDIndexKey(address, pushKeyID string) []byte

MakeAddrPushKeyIDIndexKey creates a key for address to push key index

func MakeAddressRepoPairKey added in v0.0.30

func MakeAddressRepoPairKey(address []byte, repoName string) []byte

MakeAddressRepoPairKey creates a key for associating an address to a repo name

func MakeAnnounceListKey

func MakeAnnounceListKey(key []byte, announceTime int64) []byte

MakeAnnounceListKey creates a key for adding DHT key announcement entry

func MakeBlockValidatorsKey

func MakeBlockValidatorsKey(height int64) []byte

MakeBlockValidatorsKey creates a key for storing validators of blocks

func MakeClosedProposalKey

func MakeClosedProposalKey(name, propID string) []byte

MakeClosedProposalKey creates a key for marking a proposal as "closed"

func MakeKeyBlockInfo

func MakeKeyBlockInfo(height int64) []byte

MakeKeyBlockInfo creates a key for accessing/storing committed block data.

func MakeKeyHelmRepo

func MakeKeyHelmRepo() []byte

MakeKeyHelmRepo creates a key for getting/setting the helm repo

func MakeNamespaceKey

func MakeNamespaceKey(name string) []byte

MakeNamespaceKey creates a key for accessing a namespace

func MakePushKeyKey

func MakePushKeyKey(pushKeyID string) []byte

MakePushKeyKey creates a key for storing push key

func MakeQueryAddressRepoPairKey added in v0.0.30

func MakeQueryAddressRepoPairKey(address []byte) []byte

MakeQueryAddressRepoPairKey creates a key for query addresses associated with a repo name

func MakeQueryAnnounceListKey

func MakeQueryAnnounceListKey() []byte

MakeQueryAnnounceListKey creates a key for accessing all DHT key announcements entries.

func MakeQueryKeyBlockInfo

func MakeQueryKeyBlockInfo() []byte

MakeQueryKeyBlockInfo creates a key for querying committed block data

func MakeQueryKeyBlockValidators

func MakeQueryKeyBlockValidators() []byte

MakeQueryKeyBlockValidators creates a key for querying all block validators

func MakeQueryKeyRepoProposalAtEndHeight

func MakeQueryKeyRepoProposalAtEndHeight(endHeight uint64) []byte

MakeQueryKeyRepoProposalAtEndHeight creates a key for finding repo proposals ending at the given height

func MakeQueryPushKeyIDsOfAddress

func MakeQueryPushKeyIDsOfAddress(address string) []byte

MakeQueryPushKeyIDsOfAddress creates a key for querying push key ids belonging to an address

func MakeQueryTrackedRepoKey

func MakeQueryTrackedRepoKey() []byte

MakeQueryTrackedRepoKey creates a key for accessing all tracked repo.

func MakeRepoKey

func MakeRepoKey(name string) []byte

MakeRepoKey creates a key for accessing a repository object

func MakeRepoProposalEndIndexKey

func MakeRepoProposalEndIndexKey(repoName, proposalID string, endHeight uint64) []byte

MakeRepoProposalEndIndexKey creates a key that makes a repo proposal to its end height

func MakeRepoProposalVoteKey

func MakeRepoProposalVoteKey(repoName, proposalID, voterAddr string) []byte

MakeRepoProposalVoteKey creates a key as flag for a repo proposal vote

func MakeRepoRefLastSyncHeightKey

func MakeRepoRefLastSyncHeightKey(repo, reference string) []byte

MakeRepoRefLastSyncHeightKey creates a key for storing a repo's reference last successful synchronized height.

func MakeTrackedRepoKey

func MakeTrackedRepoKey(name string) []byte

MakeTrackedRepoKey creates a key for accessing a tracked repo.

Types

type AccountKeeper

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

AccountKeeper manages account state.

func NewAccountKeeper

func NewAccountKeeper(state *tree.SafeTree) *AccountKeeper

NewAccountKeeper creates an instance of AccountKeeper

func (*AccountKeeper) Get

func (a *AccountKeeper) Get(address identifier.Address, blockNum ...uint64) *state.Account

Get returns an account by address.

ARGS: address: The address of the account blockNum: The target block to query (Optional. Default: latest)

CONTRACT: It returns an empty Account if no account is found.

func (*AccountKeeper) Update

func (a *AccountKeeper) Update(address identifier.Address, upd *state.Account)

Update sets a new object at the given address.

ARGS: address: The address of the account to update udp: The updated account object to replace the existing object.

type DHTKeeper

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

DHTKeeper manages DHT operation information.

func NewDHTKeyKeeper

func NewDHTKeyKeeper(db storagetypes.Tx) *DHTKeeper

NewDHTKeyKeeper creates an instance of DHTKeeper

func (*DHTKeeper) AddToAnnounceList

func (d *DHTKeeper) AddToAnnounceList(key []byte, repo string, objType int, announceTime int64) error

AddToAnnounceList adds a key that will be announced at a later time. key is the unique object key. objType is the object type. announceTime is the unix time when the key should be announced.

func (*DHTKeeper) IterateAnnounceList

func (d *DHTKeeper) IterateAnnounceList(it func(key []byte, entry *core.AnnounceListEntry))

IterateAnnounceList iterates over all announcements entries, passing each of them to the provided callback function. Entries with the closest announcement time are returned first.

func (*DHTKeeper) RemoveFromAnnounceList

func (d *DHTKeeper) RemoveFromAnnounceList(key []byte) error

RemoveFromAnnounceList removes a scheduled key announcement

type NamespaceKeeper

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

NamespaceKeeper manages namespaces.

func NewNamespaceKeeper

func NewNamespaceKeeper(state *tree.SafeTree) *NamespaceKeeper

NewNamespaceKeeper creates an instance of NamespaceKeeper

func (*NamespaceKeeper) Get

func (a *NamespaceKeeper) Get(name string, blockNum ...uint64) *state.Namespace

Get finds a namespace by name.

ARGS:
- name: The name of the namespace to find.
- blockNum: The target block to query (Optional. Default: latest)
CONTRACT: It returns an empty Namespace if no matching namespace is found.

func (*NamespaceKeeper) GetTarget

func (a *NamespaceKeeper) GetTarget(path string, blockNum ...uint64) (string, error)

GetTarget looks up the target of a full namespace path

ARGS:
- path: The path to look up.
- blockNum: The target block to query (Optional. Default: latest)

func (*NamespaceKeeper) Update

func (a *NamespaceKeeper) Update(name string, upd *state.Namespace)

Update sets a new object at the given name.

ARGS:
- name: The name of the namespace to update
- udp: The updated namespace object to replace the existing object.

type PushKeyKeeper

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

PushKeyKeeper manages push public keys.

func NewPushKeyKeeper

func NewPushKeyKeeper(state *tree.SafeTree, db storagetypes.Tx) *PushKeyKeeper

NewPushKeyKeeper creates an instance of PushKeyKeeper

func (*PushKeyKeeper) Get

func (g *PushKeyKeeper) Get(pushKeyID string, blockNum ...uint64) *state.PushKey

Get finds and returns a push key

ARGS: pushKeyID: The unique ID of the public key blockNum: The target block to query (Optional. Default: latest)

CONTRACT: It returns an empty Account if the key is not found.

func (*PushKeyKeeper) GetByAddress

func (g *PushKeyKeeper) GetByAddress(address string) []string

GetByAddress returns all public keys associated with the given address

ARGS: address: The target address

func (*PushKeyKeeper) Remove

func (g *PushKeyKeeper) Remove(pushKeyID string) bool

Remove removes a push key by its id

ARGS: pushKeyID: The public key unique ID

func (*PushKeyKeeper) Update

func (g *PushKeyKeeper) Update(pushKeyID string, upd *state.PushKey) error

Update sets a new value for the given public key id. It also adds an address->pubID index search for public keys by address.

ARGS: pushKeyID: The public key unique ID udp: The updated object to replace the existing object.

type RepoKeeper

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

RepoKeeper manages repository state.

func NewRepoKeeper

func NewRepoKeeper(state *tree.SafeTree, db storagetypes.Tx) *RepoKeeper

NewRepoKeeper creates an instance of RepoKeeper

func (*RepoKeeper) Get

func (rk *RepoKeeper) Get(name string, blockNum ...uint64) *state.Repository

Get implements RepoKeeper

func (*RepoKeeper) GetNoPopulate

func (rk *RepoKeeper) GetNoPopulate(name string, blockNum ...uint64) *state.Repository

GetNoPopulate implements RepoKeeper

func (*RepoKeeper) GetProposalVote

func (rk *RepoKeeper) GetProposalVote(
	name, propID,
	voterAddr string) (vote int, found bool, err error)

GetProposalVote implements RepoKeeper

func (*RepoKeeper) GetProposalsEndingAt

func (rk *RepoKeeper) GetProposalsEndingAt(height uint64) []*core.EndingProposals

GetProposalsEndingAt implements RepoKeeper

func (*RepoKeeper) GetReposCreatedByAddress added in v0.0.30

func (rk *RepoKeeper) GetReposCreatedByAddress(address []byte) (res []string, err error)

GetReposCreatedByAddress implements RepoKeeper

func (*RepoKeeper) IndexProposalEnd

func (rk *RepoKeeper) IndexProposalEnd(name, propID string, endHeight uint64) error

IndexProposalEnd implements RepoKeeper

func (*RepoKeeper) IndexProposalVote

func (rk *RepoKeeper) IndexProposalVote(name, propID, voterAddr string, vote int) error

IndexProposalVote implements RepoKeeper

func (*RepoKeeper) IndexRepoCreatedByAddress added in v0.0.30

func (rk *RepoKeeper) IndexRepoCreatedByAddress(address []byte, repoName string) error

IndexRepoCreatedByAddress implements RepoKeeper

func (*RepoKeeper) IsProposalClosed

func (rk *RepoKeeper) IsProposalClosed(name, propID string) (bool, error)

IsProposalClosed implements RepoKeeper

func (*RepoKeeper) MarkProposalAsClosed

func (rk *RepoKeeper) MarkProposalAsClosed(name, propID string) error

MarkProposalAsClosed implements RepoKeeper

func (*RepoKeeper) Update

func (rk *RepoKeeper) Update(name string, upd *state.Repository)

Update implements RepoKeeper

type RepoSyncInfoKeeper

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

RepoSyncInfoKeeper manages information about repositories that are being tracked.

func NewRepoSyncInfoKeeper

func NewRepoSyncInfoKeeper(db storagetypes.Tx, state *tree.SafeTree) *RepoSyncInfoKeeper

NewRepoSyncInfoKeeper creates an instance of RepoSyncInfoKeeper

func (*RepoSyncInfoKeeper) GetRefLastSyncHeight

func (t *RepoSyncInfoKeeper) GetRefLastSyncHeight(repo, ref string) (uint64, error)

GetLastSyncedNonce returns the last synchronized height of the given repo's reference

func (*RepoSyncInfoKeeper) GetTracked

func (t *RepoSyncInfoKeeper) GetTracked(name string) *core.TrackedRepo

GetTracked returns a repo.

Returns nil if not found

func (*RepoSyncInfoKeeper) Track

func (t *RepoSyncInfoKeeper) Track(targets string, height ...uint64) error

Add adds repositories to the track list.

Target can be one or more comma-separated list of repositories or user namespaces.

If a user namespace is provided, all repository targets are added.

If height is provided, it will be used as the last update height.

If will not re-add an already repo

func (*RepoSyncInfoKeeper) Tracked

func (t *RepoSyncInfoKeeper) Tracked() (res map[string]*core.TrackedRepo)

Tracked returns a map of repositories.

func (*RepoSyncInfoKeeper) UnTrack

func (t *RepoSyncInfoKeeper) UnTrack(targets string) error

Remove removes repositories from the track list.

Target can be one or more comma-separated list of repositories or user namespaces.

If a user namespace is provided, all repository targets are removed.

func (*RepoSyncInfoKeeper) UpdateRefLastSyncHeight

func (t *RepoSyncInfoKeeper) UpdateRefLastSyncHeight(repo, ref string, height uint64) error

SetLastSyncedNonce sets the last synchronized height of repo's reference.

type SystemKeeper

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

SystemKeeper stores system information such as app states, commit history and more.

func NewSystemKeeper

func NewSystemKeeper(db storagetypes.Tx) *SystemKeeper

NewSystemKeeper creates an instance of SystemKeeper

func (*SystemKeeper) GetBlockInfo

func (s *SystemKeeper) GetBlockInfo(height int64) (*state.BlockInfo, error)

GetBlockInfo returns block information at a given height

func (*SystemKeeper) GetCurrentEpoch added in v0.0.29

func (s *SystemKeeper) GetCurrentEpoch() (int64, error)

GetCurrentEpoch returns the current epoch

func (*SystemKeeper) GetCurrentEpochStartBlock added in v0.0.29

func (s *SystemKeeper) GetCurrentEpochStartBlock() (*state.BlockInfo, error)

GetCurrentEpochStartBlock GetEpochStartBlock returns the block info of the first block of an epoch

func (*SystemKeeper) GetEpochAt added in v0.0.29

func (s *SystemKeeper) GetEpochAt(height int64) int64

GetEpochAt returns the epoch of a given height

func (*SystemKeeper) GetHelmRepo

func (s *SystemKeeper) GetHelmRepo() (string, error)

GetHelmRepo gets the governing repository of the network

func (*SystemKeeper) GetLastBlockInfo

func (s *SystemKeeper) GetLastBlockInfo() (*state.BlockInfo, error)

GetLastBlockInfo returns information about the last committed block.

func (*SystemKeeper) SaveBlockInfo

func (s *SystemKeeper) SaveBlockInfo(info *state.BlockInfo) error

SaveBlockInfo saves a committed block information. Indexes the saved block info for faster future retrieval so that GetLastBlockInfo will not re-fetched

func (*SystemKeeper) SetHelmRepo

func (s *SystemKeeper) SetHelmRepo(name string) error

SetHelmRepo sets the governing repository of the network

type ValidatorKeeper

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

ValidatorKeeper manages information about validators

func NewValidatorKeeper

func NewValidatorKeeper(db storagetypes.Tx) *ValidatorKeeper

NewValidatorKeeper creates an instance of ValidatorKeeper

func (*ValidatorKeeper) Get

func (v *ValidatorKeeper) Get(height int64) (core.BlockValidators, error)

Get gets validators at the given height. If height is <= 0, the validator set of the highest height is returned.

func (*ValidatorKeeper) Index

func (v *ValidatorKeeper) Index(height int64, validators []*core.Validator) error

Index adds a set of validators associated to the given height

Jump to

Keyboard shortcuts

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