registry

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2022 License: Apache-2.0, BSD-2-Clause Imports: 20 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const BlobCacheDefaultTTL = 1 * time.Hour

Variables

View Source
var ErrDKShareNotFound = errors.New("dkShare not found")

Functions

func MakeChainRecordDbKey added in v0.2.0

func MakeChainRecordDbKey(chainID *isc.ChainID) []byte

Types

type AuxChainRecord added in v0.3.3

type AuxChainRecord struct {
	Active  bool
	ChainID string
}

type ChainRecord added in v0.1.0

type ChainRecord struct {
	ChainID isc.ChainID
	Active  bool
}

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 *isc.ChainID) (*ChainRecord, error)
	GetChainRecords() ([]*ChainRecord, error)
	UpdateChainRecord(chainID *isc.ChainID, f func(*ChainRecord) bool) (*ChainRecord, error)
	ActivateChainRecord(chainID *isc.ChainID) (*ChainRecord, error)
	DeactivateChainRecord(chainID *isc.ChainID) (*ChainRecord, error)
	SaveChainRecord(rec *ChainRecord) error
}

ChainRecordRegistryProvider stands for a partial registry interface, needed for this package.

type Config added in v0.3.0

type Config struct {
	UseText  bool
	Filename string
}

func DefaultConfig added in v0.3.0

func DefaultConfig() *Config

type DKShareRegistryProvider added in v0.2.0

type DKShareRegistryProvider interface {
	SaveDKShare(dkShare tcrypto.DKShare) error
	LoadDKShare(sharedAddress iotago.Address) (tcrypto.DKShare, error)
}

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

func NewRegistry(log *logger.Logger, store kvstore.KVStore) *Impl

New creates new instance of the registry implementation.

func (*Impl) ActivateChainRecord added in v0.2.0

func (r *Impl) ActivateChainRecord(chainID *isc.ChainID) (*ChainRecord, error)

func (*Impl) DeactivateChainRecord added in v0.2.0

func (r *Impl) DeactivateChainRecord(chainID *isc.ChainID) (*ChainRecord, error)

func (*Impl) DistrustPeer added in v0.2.0

func (r *Impl) DistrustPeer(pubKey *cryptolib.PublicKey) (*peering.TrustedPeer, error)

DistrustPeer implements TrustedNetworkManager interface. Get is kind of optional, so we ignore errors related to it.

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) GetChainRecordByChainID added in v0.2.0

func (r *Impl) GetChainRecordByChainID(chainID *isc.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

func (r *Impl) GetNodeIdentity() *cryptolib.KeyPair

GetNodeIdentity implements NodeIdentityProvider.

func (*Impl) GetNodePublicKey added in v0.1.0

func (r *Impl) GetNodePublicKey() *cryptolib.PublicKey

GetNodePublicKey implements NodeIdentityProvider.

func (*Impl) HasBlob added in v0.1.0

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

func (*Impl) IsTrustedPeer added in v0.2.0

func (r *Impl) IsTrustedPeer(pubKey *cryptolib.PublicKey) error

IsTrustedPeer implements TrustedNetworkManager interface.

func (*Impl) LoadConsensusJournal added in v0.3.0

func (r *Impl) LoadConsensusJournal(id journal.ID) (journal.LogIndex, journal.LocalView, error)

func (*Impl) LoadDKShare added in v0.1.0

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

LoadDKShare implements dkg.DKShareRegistryProvider.

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) SaveChainRecord added in v0.2.0

func (r *Impl) SaveChainRecord(rec *ChainRecord) error

func (*Impl) SaveConsensusJournalLocalView added in v0.3.0

func (r *Impl) SaveConsensusJournalLocalView(id journal.ID, localView journal.LocalView) error

func (*Impl) SaveConsensusJournalLogIndex added in v0.3.0

func (r *Impl) SaveConsensusJournalLogIndex(id journal.ID, logIndex journal.LogIndex) error

func (*Impl) SaveDKShare added in v0.1.0

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

SaveDKShare implements dkg.DKShareRegistryProvider.

func (*Impl) TrustPeer added in v0.2.0

func (r *Impl) TrustPeer(pubKey *cryptolib.PublicKey, netID string) (*peering.TrustedPeer, error)

TrustPeer implements TrustedNetworkManager interface.

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 *isc.ChainID, f func(*ChainRecord) bool) (*ChainRecord, error)

type NodeIdentityProvider added in v0.1.0

type NodeIdentityProvider interface {
	GetNodeIdentity() *cryptolib.KeyPair
	GetNodePublicKey() *cryptolib.PublicKey
}

type Provider added in v0.2.0

type Provider func() Registry

type Registry added in v0.3.3

func NewTextRegistry added in v0.3.3

func NewTextRegistry(log *logger.Logger, filename string) Registry

Jump to

Keyboard shortcuts

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