coordinator

package
v0.1.7 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrActiveStreamWaitingTransactions is returned when NumberOfWaitingTransactionsForStatus is called
	// while a stream is active. This value cannot be reliably determined in this state.
	ErrActiveStreamWaitingTransactions = errors.New("cannot determine number of waiting transactions for " +
		"status while stream is active")

	// ErrActiveStreamBlockNumber is returned when GetNextExpectedBlockNumber is called while a stream is active.
	// The next expected block number cannot be reliably determined in this state.
	ErrActiveStreamBlockNumber = errors.New("cannot determine next expected block number while stream is active")

	// ErrExistingStreamOrConflictingOp indicates that a stream cannot be created because a stream already exists
	// or a conflicting gRPC API call is being made concurrently.
	ErrExistingStreamOrConflictingOp = errors.New("stream already exists or conflicting operation in progress")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Server             *connection.ServerConfig     `mapstructure:"server"`
	Verifier           connection.MultiClientConfig `mapstructure:"verifier"`
	ValidatorCommitter connection.MultiClientConfig `mapstructure:"validator-committer"`
	DependencyGraph    *DependencyGraphConfig       `mapstructure:"dependency-graph"`
	Monitoring         monitoring.Config            `mapstructure:"monitoring"`
	// ChannelBufferSizePerGoroutine defines the buffer size per go-routine.
	ChannelBufferSizePerGoroutine int `mapstructure:"per-channel-buffer-size-per-goroutine"`
}

Config is the configuration for coordinator service. It contains configurations for all managers.

type DependencyGraphConfig

type DependencyGraphConfig struct {
	NumOfLocalDepConstructors int `mapstructure:"num-of-local-dep-constructors"`
	WaitingTxsLimit           int `mapstructure:"waiting-txs-limit"`
}

DependencyGraphConfig is the configuration for dependency graph manager. It contains resource limits.

type Service

type Service struct {
	protocoordinatorservice.UnimplementedCoordinatorServer
	// contains filtered or unexported fields
}

Service is responsible for coordinating signature verification, dependency tracking, and validation and commit of each transaction.

func NewCoordinatorService

func NewCoordinatorService(c *Config) *Service

NewCoordinatorService creates a new coordinator service.

func (*Service) BlockProcessing

BlockProcessing receives a stream of blocks from the client and processes them.

func (*Service) GetConfigTransaction

func (c *Service) GetConfigTransaction(
	ctx context.Context, _ *emptypb.Empty,
) (*protoblocktx.ConfigTransaction, error)

GetConfigTransaction get the config transaction from the state DB.

func (*Service) GetLastCommittedBlockNumber

func (c *Service) GetLastCommittedBlockNumber(
	ctx context.Context,
	_ *emptypb.Empty,
) (*protoblocktx.LastCommittedBlock, error)

GetLastCommittedBlockNumber get the last committed block number in the database/ledger.

func (*Service) GetNextExpectedBlockNumber

func (c *Service) GetNextExpectedBlockNumber(
	ctx context.Context,
	_ *emptypb.Empty,
) (*protoblocktx.BlockInfo, error)

GetNextExpectedBlockNumber returns the next expected block number to be received by the coordinator.

func (*Service) GetTransactionsStatus

func (c *Service) GetTransactionsStatus(
	ctx context.Context,
	q *protoblocktx.QueryStatus,
) (*protoblocktx.TransactionsStatus, error)

GetTransactionsStatus returns the status of given transactions identifiers.

func (*Service) NumberOfWaitingTransactionsForStatus

func (c *Service) NumberOfWaitingTransactionsForStatus(
	context.Context,
	*emptypb.Empty,
) (*protocoordinatorservice.WaitingTransactions, error)

NumberOfWaitingTransactionsForStatus returns the number of transactions waiting to get the final status.

func (*Service) RegisterService added in v0.1.5

func (c *Service) RegisterService(server *grpc.Server)

RegisterService registers for the coordinator's GRPC services.

func (*Service) Run

func (c *Service) Run(ctx context.Context) error

Run starts each manager in the coordinator service.

func (*Service) SetLastCommittedBlockNumber

func (c *Service) SetLastCommittedBlockNumber(
	ctx context.Context,
	lastBlock *protoblocktx.BlockInfo,
) (*emptypb.Empty, error)

SetLastCommittedBlockNumber set the last committed block number in the database/ledger through a vcservice.

func (*Service) WaitForReady

func (c *Service) WaitForReady(ctx context.Context) bool

WaitForReady wait for coordinator to be ready to be exposed as gRPC service. If the context ended before the service is ready, returns false.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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