payer

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2025 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HashKey added in v0.2.0

func HashKey(topic topic.Topic) uint32

HashKey hashes the topic to a stable uint16 hash

Types

type ClientManager added in v0.1.1

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

* The ClientManager contains a mapping of nodeIDs to gRPC client connections.

These client connections are safe to be shared and re-used and will automatically attempt to reconnect if the underlying socket connection is lost. *

func NewClientManager added in v0.1.1

func NewClientManager(
	log *zap.Logger,
	nodeRegistry registry.NodeRegistry,
	clientMetrics *grpcprom.ClientMetrics,
) *ClientManager

func (*ClientManager) GetClient added in v0.1.1

func (c *ClientManager) GetClient(nodeID uint32) (*grpc.ClientConn, error)

type DefaultMetadataApiClientConstructor added in v0.2.0

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

func (*DefaultMetadataApiClientConstructor) NewMetadataApiClient added in v0.2.0

func (c *DefaultMetadataApiClientConstructor) NewMetadataApiClient(
	nodeId uint32,
) (metadata_api.MetadataApiClient, error)

type MetadataApiClientConstructor added in v0.2.0

type MetadataApiClientConstructor interface {
	NewMetadataApiClient(nodeId uint32) (metadata_api.MetadataApiClient, error)
}

type NodeCursorTracker added in v0.2.0

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

func NewNodeCursorTracker added in v0.2.0

func NewNodeCursorTracker(ctx context.Context,
	log *zap.Logger, metadataApiClient MetadataApiClientConstructor,
) *NodeCursorTracker

func (*NodeCursorTracker) BlockUntilDesiredCursorReached added in v0.2.0

func (ct *NodeCursorTracker) BlockUntilDesiredCursorReached(
	parentCtx context.Context,
	nodeId uint32,
	desiredOriginatorId uint32,
	desiredSequenceId uint64,
) error

type NodeSelectorAlgorithm added in v0.2.0

type NodeSelectorAlgorithm interface {
	GetNode(topic topic.Topic, banlist ...[]uint32) (uint32, error)
}

type Service

type Service struct {
	payer_api.UnimplementedPayerApiServer
	// contains filtered or unexported fields
}

func NewPayerApiService

func NewPayerApiService(
	ctx context.Context,
	log *zap.Logger,
	nodeRegistry registry.NodeRegistry,
	payerPrivateKey *ecdsa.PrivateKey,
	blockchainPublisher blockchain.IBlockchainPublisher,
	metadataApiClient MetadataApiClientConstructor,
	clientMetrics *grpcprom.ClientMetrics,
) (*Service, error)

func (*Service) GetReaderNode added in v0.4.0

func (s *Service) GetReaderNode(
	ctx context.Context,
	req *payer_api.GetReaderNodeRequest,
) (resp *payer_api.GetReaderNodeResponse, err error)

GetReaderNode returns a reader node and a list of backup nodes. For now, the reader node is chosen randomly from the list of nodes. In the future, different algorithms can be implemented and selected in the request.

type StableHashingNodeSelectorAlgorithm added in v0.2.0

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

func NewStableHashingNodeSelectorAlgorithm added in v0.2.0

func NewStableHashingNodeSelectorAlgorithm(
	reg registry.NodeRegistry,
) *StableHashingNodeSelectorAlgorithm

func (*StableHashingNodeSelectorAlgorithm) GetNode added in v0.2.0

func (s *StableHashingNodeSelectorAlgorithm) GetNode(
	topic topic.Topic,
	banlist ...[]uint32,
) (uint32, error)

GetNode selects a node for a given topic using stable hashing

Jump to

Keyboard shortcuts

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