sidecar

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2025 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadBootstrapConfig

func LoadBootstrapConfig(conf *Config) error

LoadBootstrapConfig loads the bootstrap config according to the bootstrap method.

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.

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"`
	Committer                     CoordinatorConfig        `mapstructure:"committer"`
	Ledger                        LedgerConfig             `mapstructure:"ledger"`
	Orderer                       broadcastdeliver.Config  `mapstructure:"orderer"`
	LastCommittedBlockSetInterval time.Duration            `mapstructure:"last-committed-block-set-interval"`
	WaitingTxsLimit               int                      `mapstructure:"waiting-txs-limit"`
	Monitoring                    monitoring.Config        `mapstructure:"monitoring"`
	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 CoordinatorConfig

type CoordinatorConfig struct {
	Endpoint connection.Endpoint `mapstructure:"endpoint"`
}

CoordinatorConfig holds the endpoint of the coordinator component in the committer service.

type LedgerConfig

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

LedgerConfig holds the ledger path.

type LedgerService

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

LedgerService implements peer.DeliverServer.

func (*LedgerService) Deliver

Deliver delivers the requested blocks.

func (*LedgerService) DeliverFiltered

DeliverFiltered implements an API in peer.DeliverServer. Deprecated: this method is implemented to have compatibility with Fabric so that the fabric smart client can easily integrate with both FabricX and Fabric. Eventually, this method will be removed.

func (*LedgerService) DeliverWithPrivateData

DeliverWithPrivateData implements an API in peer.DeliverServer. Deprecated: this method is implemented to have compatibility with Fabric so that the fabric smart client can easily integrate with both FabricX and Fabric. Eventually, this method will be removed.

func (*LedgerService) GetBlockHeight

func (s *LedgerService) GetBlockHeight() uint64

GetBlockHeight returns the height of the block store, i.e., the last committed block + 1. The +1 is needed to include block 0 as well.

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) GetLedgerService

func (s *Service) GetLedgerService() *LedgerService

GetLedgerService returns the ledger that implements peer.DeliverServer.

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