committer

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConfigTXPrefix = "configtx_"
)

Variables

This section is empty.

Functions

func Drivers

func Drivers() []string

Drivers returns a sorted list of the names of the registered drivers.

func Register

func Register(name string, driver driver.Driver)

Register makes a kvs driver available by the provided name. If Register is called twice with the same name or if driver is nil, it panics.

Types

type ChaincodeEvent

type ChaincodeEvent struct {
	BlockNumber   uint64
	TransactionID string
	ChaincodeID   string
	EventName     string
	Payload       []byte
}

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 {
	Channel             string
	Network             Network
	Finality            Finality
	WaitForEventTimeout time.Duration
	Tracer              tracing.Tracer
	Handlers            map[common.HeaderType]TransactionHandler
	QuietNotifier       bool
	// contains filtered or unexported fields
}

func New

func New(channel string, network Network, finality Finality, waitForEventTimeout time.Duration, quiet bool, metrics tracing.Tracer, publisher events.Publisher) (*Committer, error)

func (*Committer) Commit added in v0.2.0

func (c *Committer) Commit(block *common.Block) error

Commit commits the transactions in the block passed as argument

func (*Committer) CommitEndorserTransaction added in v0.2.0

func (c *Committer) CommitEndorserTransaction(txID string, block *common.Block, indexInBlock int, env *common.Envelope, event *TxEvent) (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(txID string, block *common.Block, event *TxEvent, validationCode pb.TxValidationCode) error

DiscardEndorserTransaction discards the transaction from the vault

func (*Committer) GetChaincodeEvents added in v0.3.0

func (c *Committer) GetChaincodeEvents(env *common.Envelope, block *common.Block) error

GetChaincodeEvents reads the chaincode events and notifies the listeners registered to the specific chaincode.

func (*Committer) HandleConfig added in v0.3.0

func (c *Committer) HandleConfig(block *common.Block, i int, event *TxEvent, env *common.Envelope, chHdr *common.ChannelHeader) error

func (*Committer) HandleEndorserTransaction added in v0.3.0

func (c *Committer) HandleEndorserTransaction(block *common.Block, i int, event *TxEvent, env *common.Envelope, chHdr *common.ChannelHeader) error

func (*Committer) IsFinal added in v0.2.0

func (c *Committer) IsFinal(ctx context.Context, txID string) error

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) Notify added in v0.3.0

func (c *Committer) Notify(event TxEvent)

type ExternalCommitter

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

func GetExternalCommitter

func GetExternalCommitter(name string, sp view2.ServiceProvider, vault driver.Vault) (*ExternalCommitter, error)

func (*ExternalCommitter) CommitTX

func (c *ExternalCommitter) CommitTX(txid string, block uint64, indexInBloc int) error

func (*ExternalCommitter) DiscardTX

func (c *ExternalCommitter) DiscardTX(txid string) error

func (*ExternalCommitter) Status

func (*ExternalCommitter) Validate

func (c *ExternalCommitter) Validate(txid string) (fdriver.ValidationCode, error)

type Finality

type Finality interface {
	IsFinal(txID string, address string) error
}

type Network

type Network interface {
	Committer(channel string) (driver.Committer, error)
	Channel(channel string) (driver.Channel, error)
	PickPeer(funcType driver.PeerFunctionType) *grpc.ConnectionConfig
	Ledger(channel string) (driver.Ledger, error)
}

type TransactionHandler added in v0.3.0

type TransactionHandler = func(block *common.Block, i int, event *TxEvent, env *common.Envelope, chHdr *common.ChannelHeader) error

type TxEvent

type TxEvent struct {
	Txid           string
	DependantTxIDs []string
	Committed      bool
	Block          uint64
	IndexInBlock   int
	CommitPeer     string
	Err            error
}

TxEvent contains information for token transaction commit

type ValidationFlags

type ValidationFlags []uint8

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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