rootchain

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2025 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CertRequestBuffer

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

func NewCertificationRequestBuffer

func NewCertificationRequestBuffer(m metric.Meter) (*CertRequestBuffer, error)

NewCertificationRequestBuffer create new certification nodeRequest buffer

func (*CertRequestBuffer) Add

Add request to certification store. Per node id first valid request is stored. Rest are either duplicate or equivocating and in both cases error is returned. Clear in order to receive new nodeRequest (ie to start collecting requests for the next round).

func (*CertRequestBuffer) Clear

func (c *CertRequestBuffer) Clear(ctx context.Context, partition types.PartitionID, shard types.ShardID)

Clear clears node request in one shard - this must be called when the shard's Certification Request for a round has been processed in order for the buffer to accept requests for the next round.

func (*CertRequestBuffer) IsConsensusReceived

func (c *CertRequestBuffer) IsConsensusReceived(partition types.PartitionID, shard types.ShardID, tb QuorumInfo) QuorumStatus

type ConsensusManager

type ConsensusManager interface {
	// RequestCertification accepts certification requests with proof of quorum or no-quorum.
	RequestCertification(ctx context.Context, cr consensus.IRChangeRequest) error
	// CertificationResult read the channel to receive certification results
	CertificationResult() <-chan *certification.CertificationResponse
	ShardInfo(partition types.PartitionID, shard types.ShardID) (*storage.ShardInfo, error)
	// Run consensus algorithm
	Run(ctx context.Context) error
}

type Node

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

func New

func New(
	peer *network.Peer,
	pNet PartitionNet,
	cm ConsensusManager,
	observe Observability,
) (*Node, error)

New creates a new instance of the root chain node

func (*Node) GetPeer

func (v *Node) GetPeer() *network.Peer

func (*Node) Run

func (v *Node) Run(ctx context.Context) error

type Observability

type Observability interface {
	Meter(name string, opts ...metric.MeterOption) metric.Meter
	Tracer(name string, options ...trace.TracerOption) trace.Tracer
	Logger() *slog.Logger
}

type PartitionNet

type PartitionNet interface {
	Send(ctx context.Context, msg any, receivers ...peer.ID) error
	ReceivedChannel() <-chan any
}

type QuorumInfo

type QuorumInfo interface {
	GetQuorum() uint64
	GetTotalNodes() uint64
}

type QuorumStatus

type QuorumStatus uint8
const (
	QuorumUnknown QuorumStatus = iota
	QuorumInProgress
	QuorumAchieved
	QuorumNotPossible
)

func (QuorumStatus) String

func (qs QuorumStatus) String() string

type Subscriptions

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

func NewSubscriptions

func NewSubscriptions(sender func(ctx context.Context, msg any, receivers ...peer.ID) error, obs Observability) (*Subscriptions, error)

func (*Subscriptions) Send

func (*Subscriptions) Subscribe

func (s *Subscriptions) Subscribe(partition types.PartitionID, shard types.ShardID, nodeId string) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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