Documentation
¶
Index ¶
- Constants
- Variables
- func MapValidationCode(code int32) (int, string)
- func NewParallelDependencyResolver() *parallelDependencyResolver
- func NewSerialDependencyResolver() *serialDependencyResolver
- type ChaincodeEvent
- type CommitTx
- type Committer
- func (c *Committer) AddFinalityListener(txID string, listener driver.FinalityListener) error
- func (c *Committer) AddTransactionFilter(sr driver.TransactionFilter) error
- func (c *Committer) Commit(ctx context.Context, block *common.Block) error
- func (c *Committer) CommitConfig(ctx context.Context, blockNumber driver.BlockNum, txNum driver.TxNum, ...) error
- func (c *Committer) CommitEndorserTransaction(ctx context.Context, txID string, blockNum driver2.BlockNum, ...) (bool, error)
- func (c *Committer) CommitTX(ctx context.Context, txID string, block driver.BlockNum, ...) (err error)
- func (c *Committer) DiscardEndorserTransaction(ctx context.Context, txID string, blockNum driver2.BlockNum, envRaw []byte, ...) error
- func (c *Committer) DiscardTx(ctx context.Context, txID string, message string) error
- func (c *Committer) GetChaincodeEvents(env *common.Envelope, blockNum driver2.BlockNum) error
- func (c *Committer) GetProcessNamespace() []string
- func (c *Committer) HandleConfig(ctx context.Context, _ *common.BlockMetadata, tx CommitTx) (*FinalityEvent, error)
- func (c *Committer) HandleEndorserTransaction(ctx context.Context, block *common.BlockMetadata, tx CommitTx) (*FinalityEvent, error)
- func (c *Committer) IsFinal(ctx context.Context, txID string) error
- func (c *Committer) ProcessNamespace(nss ...string) error
- func (c *Committer) ReloadConfigTransactions() error
- func (c *Committer) RemoveFinalityListener(txID string, listener driver.FinalityListener) error
- func (c *Committer) Start(context context.Context) error
- func (c *Committer) Status(ctx context.Context, txID driver2.TxID) (driver.ValidationCode, string, error)
- type DependencyResolver
- type FabricFinality
- type FinalityEvent
- type FinalityManager
- type Metrics
- type OrdererConfig
- type OrderingService
- type ParallelExecutable
- type SerialExecutable
- type TransactionHandler
- type ValidationFlags
Constants ¶
const ConfigTXPrefix = "configtx_"
Variables ¶
var ( // ErrDiscardTX this error can be used to signal that a valid transaction should be discarded anyway ErrDiscardTX = errors.New("discard tx") )
Functions ¶
func MapValidationCode ¶ added in v0.4.0
func NewParallelDependencyResolver ¶ added in v0.4.0
func NewParallelDependencyResolver() *parallelDependencyResolver
func NewSerialDependencyResolver ¶ added in v0.4.0
func NewSerialDependencyResolver() *serialDependencyResolver
Types ¶
type ChaincodeEvent ¶
type ChaincodeEvent struct {
BlockNumber uint64
TransactionID string
ChaincodeID string
EventName string
Payload []byte
Err error
}
ChaincodeEvent models the chaincode event details.
func (*ChaincodeEvent) Message ¶
func (chaincodeEvent *ChaincodeEvent) Message() interface{}
func (*ChaincodeEvent) Topic ¶
func (chaincodeEvent *ChaincodeEvent) Topic() string
type Committer ¶ added in v0.2.0
type Committer struct {
ConfigService driver.ConfigService
ChannelConfig driver.ChannelConfig
Vault driver.Vault
EnvelopeService driver.EnvelopeService
TransactionFilters *committer.AggregatedTransactionFilter
ProcessNamespaces []string
Ledger driver.Ledger
RWSetLoaderService driver.RWSetLoader
ProcessorManager driver.ProcessorManager
MembershipService driver.MembershipService
OrderingService OrderingService
FabricFinality FabricFinality
TransactionManager driver.TransactionManager
DependencyResolver DependencyResolver
// events
FinalityManager *FinalityManager
EventsPublisher events.Publisher
Handlers map[common.HeaderType]TransactionHandler
QuietNotifier bool
// contains filtered or unexported fields
}
func New ¶
func New( configService driver.ConfigService, channelConfig driver.ChannelConfig, vault driver.Vault, envelopeService driver.EnvelopeService, ledger driver.Ledger, rwsetLoaderService driver.RWSetLoader, processorManager driver.ProcessorManager, eventsPublisher events.Publisher, channelMembershipService driver.MembershipService, orderingService OrderingService, fabricFinality FabricFinality, transactionManager driver.TransactionManager, dependencyResolver DependencyResolver, quiet bool, listenerManager driver.ListenerManager, tracerProvider tracing.Provider, metricsProvider metrics.Provider, ) *Committer
func (*Committer) AddFinalityListener ¶ added in v0.4.0
func (c *Committer) AddFinalityListener(txID string, listener driver.FinalityListener) error
func (*Committer) AddTransactionFilter ¶ added in v0.4.0
func (c *Committer) AddTransactionFilter(sr driver.TransactionFilter) error
func (*Committer) Commit ¶ added in v0.2.0
Commit commits the transactions in the block passed as argument
func (*Committer) CommitConfig ¶ added in v0.4.0
func (c *Committer) CommitConfig(ctx context.Context, blockNumber driver.BlockNum, txNum driver.TxNum, raw []byte, env *common.Envelope) error
CommitConfig is used to validate and apply configuration transactions for a Channel.
func (*Committer) CommitEndorserTransaction ¶ added in v0.2.0
func (c *Committer) CommitEndorserTransaction(ctx context.Context, txID string, blockNum driver2.BlockNum, indexInBlock uint64, env *common.Envelope, event *FinalityEvent) (bool, error)
CommitEndorserTransaction commits the transaction to the vault. It returns true, if the transaction was already processed, false otherwise.
func (*Committer) DiscardEndorserTransaction ¶ added in v0.2.0
func (c *Committer) DiscardEndorserTransaction(ctx context.Context, txID string, blockNum driver2.BlockNum, envRaw []byte, event *FinalityEvent) error
DiscardEndorserTransaction discards the transaction from the vault
func (*Committer) GetChaincodeEvents ¶ added in v0.3.0
GetChaincodeEvents reads the chaincode events and notifies the listeners registered to the specific chaincode.
func (*Committer) GetProcessNamespace ¶ added in v0.4.0
func (*Committer) HandleConfig ¶ added in v0.3.0
func (c *Committer) HandleConfig(ctx context.Context, _ *common.BlockMetadata, tx CommitTx) (*FinalityEvent, error)
func (*Committer) HandleEndorserTransaction ¶ added in v0.3.0
func (c *Committer) HandleEndorserTransaction(ctx context.Context, block *common.BlockMetadata, tx CommitTx) (*FinalityEvent, error)
func (*Committer) IsFinal ¶ added in v0.2.0
IsFinal takes in input a transaction id and waits for its confirmation with the respect to the passed context that can be used to set a deadline for the waiting time.
func (*Committer) ProcessNamespace ¶ added in v0.4.0
func (*Committer) ReloadConfigTransactions ¶ added in v0.4.0
func (*Committer) RemoveFinalityListener ¶ added in v0.4.0
func (c *Committer) RemoveFinalityListener(txID string, listener driver.FinalityListener) error
type DependencyResolver ¶ added in v0.4.0
type DependencyResolver interface {
// Resolve returns a two-dimensional array that indicates how commits can be parallelized.
// The transactions in each SerialExecutable slice have to follow the order indicated.
// Each slice of the ParallelExecutable slice can be committed independently without waiting on the others.
// Hence, for each element of the ParallelExecutable slice, a new goroutine can be launched.
Resolve([]CommitTx) ParallelExecutable[SerialExecutable[CommitTx]]
}
DependencyResolver analyzes the dependencies between the transactions of a block and indicates which commits can take place in parallel and which have to take place serially
type FabricFinality ¶ added in v0.4.0
type FinalityEvent ¶ added in v0.4.0
type FinalityEvent = driver2.FinalityEvent[driver.ValidationCode]
func MapFinalityEvent ¶ added in v0.4.0
func MapFinalityEvent(ctx context.Context, block *common.BlockMetadata, txNum driver.TxNum, txID string) (uint8, *FinalityEvent, error)
type FinalityManager ¶ added in v0.4.0
type FinalityManager = committer.FinalityManager[driver.ValidationCode]
type Metrics ¶
type Metrics struct {
NotifyStatusDuration metrics.Histogram
NotifyFinalityDuration metrics.Histogram
PostFinalityDuration metrics.Histogram
HandlerDuration metrics.Histogram
EventQueueDuration metrics.Histogram
BlockCommitDuration metrics.Histogram
EventQueueLength metrics.Gauge
Commits trace.Tracer
Listens trace.Tracer
}
type OrdererConfig ¶ added in v0.5.0
type OrdererConfig interface {
ConsensusType() string
Endpoints() []*grpc.ConnectionConfig
}
type OrderingService ¶ added in v0.4.0
type OrderingService interface {
Configure(consensusType string, orderers []*grpc.ConnectionConfig) error
}
type ParallelExecutable ¶ added in v0.4.0
type ParallelExecutable[V any] []V
ParallelExecutable is a marker type for processes that can take place in parallel
type SerialExecutable ¶ added in v0.4.0
type SerialExecutable[V any] []V
SerialExecutable is a marker type for processes that must take place serially
type TransactionHandler ¶ added in v0.3.0
type TransactionHandler = func(ctx context.Context, block *common.BlockMetadata, tx CommitTx) (*FinalityEvent, error)
type ValidationFlags ¶
type ValidationFlags []uint8