registry

package
v0.0.0-...-2935fa7 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthRegistry        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowRegistry          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupRegistry = fmt.Errorf("proto: unexpected end of group")
)

Functions

This section is empty.

Types

type Cache

type Cache struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Cache helps prevent unnecessary IAVLTree updates and garbage generation.

func NewCache

func NewCache(backend Reader) *Cache

NewCache returns a Cache which can write to an output Writer via Sync. Not goroutine safe, use syncStateCache if you need concurrent access

func (*Cache) Backend

func (cache *Cache) Backend() Reader

func (*Cache) GetNodeByID

func (cache *Cache) GetNodeByID(id crypto.Address) (*NodeIdentity, error)

func (*Cache) GetNodeIDsByAddress

func (cache *Cache) GetNodeIDsByAddress(net string) ([]crypto.Address, error)

func (*Cache) GetNumPeers

func (cache *Cache) GetNumPeers() int

func (*Cache) RemoveNode

func (cache *Cache) RemoveNode(id crypto.Address) error

func (*Cache) Reset

func (cache *Cache) Reset(backend Reader)

Reset the cache to empty initialising the backing map to the same size as the previous iteration

func (*Cache) Sync

func (cache *Cache) Sync(state Writer) error

Sync writes whatever is in the cache to the output state. Does not flush the cache, to do that call Reset() after Sync or use Flush if your wish to use the output state as your next backend

func (*Cache) UpdateNode

func (cache *Cache) UpdateNode(id crypto.Address, node *NodeIdentity) error

type Iterable

type Iterable interface {
	IterateNodes(consumer func(crypto.Address, *NodeIdentity) error) (err error)
}

type IterableReader

type IterableReader interface {
	Iterable
	Reader
}

type IterableReaderWriter

type IterableReaderWriter interface {
	Iterable
	ReaderWriter
}

type NodeFilter

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

func NewNodeFilter

func NewNodeFilter(state IterableReader) *NodeFilter

func (*NodeFilter) NumPeers

func (nf *NodeFilter) NumPeers() int

func (*NodeFilter) QueryPeerByAddress

func (nf *NodeFilter) QueryPeerByAddress(addr string) bool

func (*NodeFilter) QueryPeerByID

func (nf *NodeFilter) QueryPeerByID(id string) bool

type NodeIdentity

type NodeIdentity struct {
	// Peer moniker name
	Moniker string `protobuf:"bytes,1,opt,name=Moniker,proto3" json:"Moniker,omitempty"`
	// Peer network address
	NetworkAddress string `protobuf:"bytes,2,opt,name=NetworkAddress,proto3" json:"NetworkAddress,omitempty"`
	// The Tendermint p2p node ID
	TendermintNodeID github_com_klyed_hivesmartchain_crypto.Address `` /* 133-byte string literal not displayed */
	// The public key that this node will validate with if it becomes a validator
	// (use this to create a binding between p2p node ID and validator)
	ValidatorPublicKey   *github_com_klyed_hivesmartchain_crypto.PublicKey `` /* 149-byte string literal not displayed */
	XXX_NoUnkeyedLiteral struct{}                                          `json:"-"`
	XXX_unrecognized     []byte                                            `json:"-"`
	XXX_sizecache        int32                                             `json:"-"`
}

NodeIdentity stores and establishes a binding between 4 different types of identifiers, a human readable name, a advertised network address, a p2p station-to-station key, and a validator key. Updates must be signed by the node key and the validator key to prove the update is consensual.

func (*NodeIdentity) Descriptor

func (*NodeIdentity) Descriptor() ([]byte, []int)

func (*NodeIdentity) GetMoniker

func (m *NodeIdentity) GetMoniker() string

func (*NodeIdentity) GetNetworkAddress

func (m *NodeIdentity) GetNetworkAddress() string

func (*NodeIdentity) Marshal

func (m *NodeIdentity) Marshal() (dAtA []byte, err error)

func (*NodeIdentity) MarshalTo

func (m *NodeIdentity) MarshalTo(dAtA []byte) (int, error)

func (*NodeIdentity) MarshalToSizedBuffer

func (m *NodeIdentity) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*NodeIdentity) ProtoMessage

func (*NodeIdentity) ProtoMessage()

func (*NodeIdentity) Reset

func (m *NodeIdentity) Reset()

func (*NodeIdentity) Size

func (m *NodeIdentity) Size() (n int)

func (*NodeIdentity) String

func (rn *NodeIdentity) String() string

func (*NodeIdentity) Unmarshal

func (m *NodeIdentity) Unmarshal(dAtA []byte) error

func (*NodeIdentity) XXX_DiscardUnknown

func (m *NodeIdentity) XXX_DiscardUnknown()

func (*NodeIdentity) XXX_Marshal

func (m *NodeIdentity) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*NodeIdentity) XXX_Merge

func (m *NodeIdentity) XXX_Merge(src proto.Message)

func (*NodeIdentity) XXX_MessageName

func (*NodeIdentity) XXX_MessageName() string

func (*NodeIdentity) XXX_Size

func (m *NodeIdentity) XXX_Size() int

func (*NodeIdentity) XXX_Unmarshal

func (m *NodeIdentity) XXX_Unmarshal(b []byte) error

type NodeStats

type NodeStats struct {
	Addresses map[string]map[crypto.Address]struct{}
}

func NewNodeStats

func NewNodeStats() NodeStats

func (*NodeStats) GetAddresses

func (ns *NodeStats) GetAddresses(net string) []crypto.Address

func (*NodeStats) Insert

func (ns *NodeStats) Insert(net string, id crypto.Address)

func (*NodeStats) Remove

func (ns *NodeStats) Remove(node *NodeIdentity) bool

type Reader

type Reader interface {
	GetNodeByID(crypto.Address) (*NodeIdentity, error)
	GetNodeIDsByAddress(net string) ([]crypto.Address, error)
	GetNumPeers() int
}

type ReaderWriter

type ReaderWriter interface {
	Reader
	Writer
}

type Writer

type Writer interface {
	// Updates the node, creating it if it does not exist
	UpdateNode(crypto.Address, *NodeIdentity) error
	// Remove the node by address
	RemoveNode(crypto.Address) error
}

Jump to

Keyboard shortcuts

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