registry

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2021 License: Apache-2.0, BSD-2-Clause Imports: 21 Imported by: 1

Documentation

Overview

Package registry provides a business specific API to the local database.

Index

Constants

View Source
const (
	// CfgBindAddress defines the config flag of the web API binding address.
	CfgRewardAddress = "reward.address"
)

Variables

This section is empty.

Functions

func GetFeeDestination added in v0.1.0

func GetFeeDestination(scaddr *address.Address) address.Address

func InitFlags

func InitFlags()

func InitLogger

func InitLogger()

func SaveChainRecord added in v0.1.0

func SaveChainRecord(bd *ChainRecord) error

Types

type ChainRecord added in v0.1.0

type ChainRecord struct {
	ChainID        coretypes.ChainID
	Color          balance.Color // origin tx hash
	CommitteeNodes []string      // "host_addr:port"
	Active         bool
}

ChainRecord is a minimum data needed to load a committee for the chain it is up to the node (not smart contract) to check authorizations to create/update this record

func ActivateChainRecord added in v0.1.0

func ActivateChainRecord(chainID *coretypes.ChainID) (*ChainRecord, error)

func DeactivateChainRecord added in v0.1.0

func DeactivateChainRecord(chainID *coretypes.ChainID) (*ChainRecord, error)

func GetChainRecord added in v0.1.0

func GetChainRecord(chainID *coretypes.ChainID) (*ChainRecord, error)

func GetChainRecords added in v0.1.0

func GetChainRecords() ([]*ChainRecord, error)

func UpdateChainRecord added in v0.1.0

func UpdateChainRecord(chainID *coretypes.ChainID, f func(*ChainRecord) bool) (*ChainRecord, error)

func (*ChainRecord) Read added in v0.1.0

func (bd *ChainRecord) Read(r io.Reader) error

func (*ChainRecord) String added in v0.1.0

func (bd *ChainRecord) String() string

func (*ChainRecord) Write added in v0.1.0

func (bd *ChainRecord) Write(w io.Writer) error

type Impl added in v0.1.0

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

Impl is just a placeholder to implement all interfaces needed by different components. Each of the interfaces are implemented in the corresponding file in this package.

func NewRegistry added in v0.1.0

func NewRegistry(suite tcrypto.Suite, log *logger.Logger, dbp ...*dbprovider.DBProvider) *Impl

New creates new instance of the registry implementation.

func (*Impl) GetBlob added in v0.1.0

func (r *Impl) GetBlob(h hashing.HashValue) ([]byte, bool, error)

Reads data from registry by hash. Returns existence flag

func (*Impl) GetNodeIdentity added in v0.1.0

func (r *Impl) GetNodeIdentity() (*key.Pair, error)

GetNodeIdentity implements NodeIdentityProvider.

func (*Impl) GetNodePublicKey added in v0.1.0

func (r *Impl) GetNodePublicKey() (kyber.Point, error)

GetNodePublicKey implements NodeIdentityProvider.

func (*Impl) HasBlob added in v0.1.0

func (r *Impl) HasBlob(h hashing.HashValue) (bool, error)

func (*Impl) LoadDKShare added in v0.1.0

func (r *Impl) LoadDKShare(sharedAddress *address.Address) (*tcrypto.DKShare, error)

LoadDKShare implements dkg.RegistryProvider.

func (*Impl) PutBlob added in v0.1.0

func (r *Impl) PutBlob(data []byte, ttl ...time.Duration) (hashing.HashValue, error)

PutBlob Writes data into the registry with the key of its hash Also stores TTL if provided

func (*Impl) SaveDKShare added in v0.1.0

func (r *Impl) SaveDKShare(dkShare *tcrypto.DKShare) error

SaveDKShare implements dkg.RegistryProvider.

type NodeIdentityProvider added in v0.1.0

type NodeIdentityProvider interface {
	GetNodeIdentity() (*key.Pair, error)
	GetNodePublicKey() (kyber.Point, error)
}

NodeIdentityProvider is a subset of the registry interface providing access to the persistent node identity information.

Jump to

Keyboard shortcuts

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