sidecar

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: 48 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsStatusStoredInDB added in v0.1.5

func IsStatusStoredInDB(status protoblocktx.Status) bool

IsStatusStoredInDB returns true if the given status code can be stored in the state DB.

func LoadBootstrapConfig

func LoadBootstrapConfig(conf *Config) error

LoadBootstrapConfig loads the bootstrap config according to the bootstrap method.

func MalformedTxTestCases added in v0.1.5

func MalformedTxTestCases(txb *workload.TxBuilder) (
	txs []*protoloadgen.TX, expectedStatuses []protoblocktx.Status,
)

MalformedTxTestCases are valid and invalid TXs due to malformed.

func OverwriteConfigFromBlock

func OverwriteConfigFromBlock(conf *Config, configBlock *common.Block) error

OverwriteConfigFromBlock overwrites the orderer connection with fields from a config block.

func OverwriteConfigFromBlockFile

func OverwriteConfigFromBlockFile(conf *Config) error

OverwriteConfigFromBlockFile overwrites the orderer connection with fields from the bootstrap config block.

func OverwriteConfigFromEnvelope

func OverwriteConfigFromEnvelope(conf *Config, envelope *common.Envelope) error

OverwriteConfigFromEnvelope overwrites the orderer connection with fields from a config transaction. For now, it fetches the following: - Orderer endpoints. TODO: Fetch Root CAs.

func RequireNotifications added in v0.1.5

func RequireNotifications(
	t *testing.T,
	notifyStream protonotify.Notifier_OpenNotificationStreamClient,
	expectedBlockNumber uint64,
	txIDs []string,
	status []protoblocktx.Status,
)

RequireNotifications verifies that the expected notification were received.

Types

type Bootstrap

type Bootstrap struct {
	// GenesisBlockFilePath is the path for the genesis block.
	// If omitted, the local configuration will be used.
	GenesisBlockFilePath string `mapstructure:"genesis-block-file-path" yaml:"genesis-block-file-path,omitempty"`
}

Bootstrap configures how to obtain the bootstrap configuration.

type Config

type Config struct {
	Server                        *connection.ServerConfig  `mapstructure:"server"`
	Monitoring                    monitoring.Config         `mapstructure:"monitoring"`
	Committer                     *connection.ClientConfig  `mapstructure:"committer"`
	Orderer                       ordererconn.Config        `mapstructure:"orderer"`
	Ledger                        LedgerConfig              `mapstructure:"ledger"`
	Notification                  NotificationServiceConfig `mapstructure:"notification"`
	LastCommittedBlockSetInterval time.Duration             `mapstructure:"last-committed-block-set-interval"`
	WaitingTxsLimit               int                       `mapstructure:"waiting-txs-limit"`
	// ChannelBufferSize is the buffer size that will be used to queue blocks, requests, and statuses.
	ChannelBufferSize int       `mapstructure:"channel-buffer-size"`
	Bootstrap         Bootstrap `mapstructure:"bootstrap"`
}

Config holds the configuration of the sidecar service. This includes sidecar endpoint, committer endpoint to which the sidecar pushes the block and pulls statuses, and the config of ledger service, and the orderer setup. It may contain the orderer endpoint from which the sidecar pulls blocks.

type LedgerConfig

type LedgerConfig struct {
	Path string `mapstructure:"path"`
}

LedgerConfig holds the ledger path.

type NotificationServiceConfig added in v0.1.5

type NotificationServiceConfig struct {
	// MaxTimeout is an upper limit on the request's timeout to prevent resource exhaustion.
	// If a request doesn't specify a timeout, this value will be used.
	MaxTimeout time.Duration `mapstructure:"max-timeout"`
}

NotificationServiceConfig holds the parameters for notifications.

type Service

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

Service is a relay service which relays the block from orderer to committer. Further, it aggregates the transaction status and forwards the validated block to clients who have registered on the ledger server.

func New

func New(c *Config) (*Service, error)

New creates a sidecar service.

func (*Service) Close

func (s *Service) Close()

Close closes the ledger.

func (*Service) RegisterService added in v0.1.5

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

RegisterService registers for the sidecar's GRPC services.

func (*Service) Run

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

Run starts the sidecar service. The call to Run blocks until an error occurs or the context is canceled.

func (*Service) WaitForReady

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

WaitForReady wait for sidecar 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