Documentation ¶
Overview ¶
Package registry provides a business specific API to the local database.
Index ¶
- Constants
- Variables
- func GetFeeDestination(chainID *iscp.ChainID) ledgerstate.Address
- func InitFlags()
- func MakeChainRecordDbKey(chainID *iscp.ChainID) []byte
- type BlobCache
- type ChainRecord
- type ChainRecordRegistryProvider
- type DKShareRegistryProvider
- type Impl
- func (r *Impl) ActivateChainRecord(chainID *iscp.ChainID) (*ChainRecord, error)
- func (r *Impl) DeactivateChainRecord(chainID *iscp.ChainID) (*ChainRecord, error)
- func (r *Impl) DistrustPeer(pubKey ed25519.PublicKey) (*peering.TrustedPeer, error)
- func (r *Impl) GetBlob(h hashing.HashValue) ([]byte, bool, error)
- func (r *Impl) GetChainRecordByChainID(chainID *iscp.ChainID) (*ChainRecord, error)
- func (r *Impl) GetChainRecords() ([]*ChainRecord, error)
- func (r *Impl) GetNodeIdentity() (*ed25519.KeyPair, error)
- func (r *Impl) GetNodePublicKey() (*ed25519.PublicKey, error)
- func (r *Impl) HasBlob(h hashing.HashValue) (bool, error)
- func (r *Impl) IsTrustedPeer(pubKey ed25519.PublicKey) error
- func (r *Impl) LoadDKShare(sharedAddress ledgerstate.Address) (*tcrypto.DKShare, error)
- func (r *Impl) PutBlob(data []byte, ttl ...time.Duration) (hashing.HashValue, error)
- func (r *Impl) SaveChainRecord(rec *ChainRecord) error
- func (r *Impl) SaveDKShare(dkShare *tcrypto.DKShare) error
- func (r *Impl) TrustPeer(pubKey ed25519.PublicKey, netID string) (*peering.TrustedPeer, error)
- func (r *Impl) TrustedPeers() ([]*peering.TrustedPeer, error)
- func (r *Impl) UpdateChainRecord(chainID *iscp.ChainID, f func(*ChainRecord) bool) (*ChainRecord, error)
- type NodeIdentityProvider
- type Provider
Constants ¶
const BlobCacheDefaultTTL = 1 * time.Hour
const (
// CfgBindAddress defines the config flag of the web API binding address.
CfgRewardAddress = "reward.address"
)
Variables ¶
Functions ¶
func GetFeeDestination ¶ added in v0.1.0
func GetFeeDestination(chainID *iscp.ChainID) ledgerstate.Address
func MakeChainRecordDbKey ¶ added in v0.2.0
Types ¶
type BlobCache ¶ added in v0.2.0
type BlobCache interface { GetBlob(h hashing.HashValue) ([]byte, bool, error) HasBlob(h hashing.HashValue) (bool, error) // PutBlob ttl s TimeToLive, expiration time in Unix nanoseconds PutBlob(data []byte, ttl ...time.Duration) (hashing.HashValue, error) }
BlobCache is an access to the cache of big binary objects
type ChainRecord ¶ added in v0.1.0
ChainRecord represents chain the node is participating in TODO optimize, no need for a persistent structure, simple activity tag is enough
func ChainRecordFromBytes ¶ added in v0.2.0
func ChainRecordFromBytes(data []byte) (*ChainRecord, error)
CommitteeRecordFromBytes
func FromMarshalUtil ¶ added in v0.2.0
func FromMarshalUtil(mu *marshalutil.MarshalUtil) (*ChainRecord, error)
func (*ChainRecord) Bytes ¶ added in v0.2.0
func (rec *ChainRecord) Bytes() []byte
func (*ChainRecord) String ¶ added in v0.1.0
func (rec *ChainRecord) String() string
type ChainRecordRegistryProvider ¶ added in v0.2.0
type ChainRecordRegistryProvider interface { GetChainRecordByChainID(chainID *iscp.ChainID) (*ChainRecord, error) GetChainRecords() ([]*ChainRecord, error) UpdateChainRecord(chainID *iscp.ChainID, f func(*ChainRecord) bool) (*ChainRecord, error) ActivateChainRecord(chainID *iscp.ChainID) (*ChainRecord, error) DeactivateChainRecord(chainID *iscp.ChainID) (*ChainRecord, error) }
ChainRecordRegistryProvider stands for a partial registry interface, needed for this package.
type DKShareRegistryProvider ¶ added in v0.2.0
type DKShareRegistryProvider interface {}
DKShareRegistryProvider stands for a partial registry interface, needed for this package. It should be implemented by registry.impl
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
New creates new instance of the registry implementation.
func (*Impl) ActivateChainRecord ¶ added in v0.2.0
func (r *Impl) ActivateChainRecord(chainID *iscp.ChainID) (*ChainRecord, error)
func (*Impl) DeactivateChainRecord ¶ added in v0.2.0
func (r *Impl) DeactivateChainRecord(chainID *iscp.ChainID) (*ChainRecord, error)
func (*Impl) DistrustPeer ¶ added in v0.2.0
DistrustPeer implements TrustedNetworkManager interface. Get is kind of optional, so we ignore errors related to it.
func (*Impl) GetChainRecordByChainID ¶ added in v0.2.0
func (r *Impl) GetChainRecordByChainID(chainID *iscp.ChainID) (*ChainRecord, error)
func (*Impl) GetChainRecords ¶ added in v0.2.0
func (r *Impl) GetChainRecords() ([]*ChainRecord, error)
func (*Impl) GetNodeIdentity ¶ added in v0.1.0
GetNodeIdentity implements NodeIdentityProvider.
func (*Impl) GetNodePublicKey ¶ added in v0.1.0
GetNodePublicKey implements NodeIdentityProvider.
func (*Impl) IsTrustedPeer ¶ added in v0.2.0
IsTrustedPeer implements TrustedNetworkManager interface.
func (*Impl) LoadDKShare ¶ added in v0.1.0
LoadDKShare implements dkg.DKShareRegistryProvider.
func (*Impl) PutBlob ¶ added in v0.1.0
PutBlob Writes data into the registry with the key of its hash Also stores TTL if provided
func (*Impl) SaveChainRecord ¶ added in v0.2.0
func (r *Impl) SaveChainRecord(rec *ChainRecord) error
func (*Impl) SaveDKShare ¶ added in v0.1.0
SaveDKShare implements dkg.DKShareRegistryProvider.
func (*Impl) TrustedPeers ¶ added in v0.2.0
func (r *Impl) TrustedPeers() ([]*peering.TrustedPeer, error)
TrustedPeers implements TrustedNetworkManager interface.
func (*Impl) UpdateChainRecord ¶ added in v0.2.0
func (r *Impl) UpdateChainRecord(chainID *iscp.ChainID, f func(*ChainRecord) bool) (*ChainRecord, error)