driver

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2025 License: Apache-2.0 Imports: 10 Imported by: 10

Documentation

Index

Constants

View Source
const (
	// PeerForAnything defines the class of peers that can be used for any function
	PeerForAnything = iota
	// PeerForDelivery defines the class of peers to be used for delivery
	PeerForDelivery
	// PeerForDiscovery defines the class of peers to be used for discovery
	PeerForDiscovery
	// PeerForFinality defines the class of peers to be used for finality
	PeerForFinality
	// PeerForQuery defines the class of peers to be used for query
	PeerForQuery
)

Variables

Functions

This section is empty.

Types

type Block

type Block interface {
	// DataAt returns the data stored at the passed index
	DataAt(i int) []byte
	// ProcessedTransaction returns the ProcessedTransaction at passed index
	ProcessedTransaction(i int) (ProcessedTransaction, error)
}

Block models a block of the ledger

type BlockCallback added in v0.4.0

type BlockCallback func(context.Context, *common.Block) (bool, error)

BlockCallback is the callback function prototype to alert the rest of the stack about the availability of a new block. The function returns two argument a boolean to signal if delivery should be stopped, and an error to signal an issue during the processing of the block. In case of an error, the same block is re-processed after a delay.

type BlockNum added in v0.4.0

type BlockNum = driver.BlockNum

type Chaincode

type Chaincode interface {
	NewInvocation(function string, args ...interface{}) ChaincodeInvocation
	NewDiscover() ChaincodeDiscover
	IsAvailable() (bool, error)
	IsPrivate() bool
	// Version returns the version of this chaincode.
	// It returns an error if a failure happens during the computation.
	Version() (string, error)
}

Chaincode exposes chaincode-related functions

type ChaincodeConfig added in v0.4.0

type ChaincodeConfig interface {
	ID() string
	IsPrivate() bool
}

type ChaincodeDiscover

type ChaincodeDiscover interface {
	// Call invokes discovery service and returns the discovered peers
	Call() ([]DiscoveredPeer, error)
	WithFilterByMSPIDs(mspIDs ...string) ChaincodeDiscover
	WithImplicitCollections(mspIDs ...string) ChaincodeDiscover
}

ChaincodeDiscover models a client-side chaincode's endorsers discovery operation

type ChaincodeInvocation

type ChaincodeInvocation interface {
	Endorse() (Envelope, error)

	Query() ([]byte, error)

	Submit() (string, []byte, error)

	WithTransientEntry(k string, v interface{}) (ChaincodeInvocation, error)

	WithEndorsersByMSPIDs(mspIDs ...string) ChaincodeInvocation

	WithEndorsersFromMyOrg() ChaincodeInvocation

	WithSignerIdentity(id view.Identity) ChaincodeInvocation

	WithTxID(id TxIDComponents) ChaincodeInvocation

	WithEndorsersByConnConfig(ccs ...*grpc.ConnectionConfig) ChaincodeInvocation

	WithImplicitCollections(mspIDs ...string) ChaincodeInvocation

	// WithDiscoveredEndorsersByEndpoints sets the endpoints to be used to filter the result of
	// discovery. Discovery is used to identify the chaincode's endorsers, if not set otherwise.
	WithDiscoveredEndorsersByEndpoints(endpoints ...string) ChaincodeInvocation

	// WithMatchEndorsementPolicy enforces that the query is perfomed against a set of peers that satisfy the
	// endorsement policy of the chaincode
	WithMatchEndorsementPolicy() ChaincodeInvocation

	// WithNumRetries sets the number of times the chaincode operation should be retried before returning a failure
	WithNumRetries(numRetries uint) ChaincodeInvocation

	// WithRetrySleep sets the time interval between each retry
	WithRetrySleep(duration time.Duration) ChaincodeInvocation

	WithContext(context context.Context) ChaincodeInvocation
}

ChaincodeInvocation models a client-side chaincode invocation

type ChaincodeManager

type ChaincodeManager interface {
	// Chaincode returns a chaincode handler for the passed chaincode name
	Chaincode(name string) Chaincode
}

ChaincodeManager manages chaincodes

type Channel

type Channel interface {
	// Name returns the name of the channel this instance is bound to
	Name() string

	Committer() Committer

	Vault() Vault

	VaultStore() VaultStore

	Delivery() Delivery

	Ledger() Ledger

	Finality() Finality

	ChannelMembership() ChannelMembership

	ChaincodeManager() ChaincodeManager

	RWSetLoader() RWSetLoader

	EnvelopeService() EnvelopeService

	TransactionService() EndorserTransactionService

	MetadataService() MetadataService

	Close() error
}

Channel gives access to Fabric channel related information

type ChannelConfig added in v0.4.0

type ChannelConfig interface {
	ID() string
	FinalityWaitTimeout() time.Duration
	FinalityForPartiesWaitTimeout() time.Duration
	FinalityEventQueueWorkers() int
	CommitterPollingTimeout() time.Duration
	CommitterFinalityNumRetries() int
	CommitterFinalityUnknownTXTimeout() time.Duration
	CommitterWaitForEventTimeout() time.Duration
	DeliveryBufferSize() int
	DeliverySleepAfterFailure() time.Duration
	CommitParallelism() int
	ChaincodeConfigs() []ChaincodeConfig
	GetNumRetries() uint
	GetRetrySleep() time.Duration
	DiscoveryDefaultTTLS() time.Duration
	DiscoveryTimeout() time.Duration
}

type ChannelConfigProvider added in v0.4.0

type ChannelConfigProvider interface {
	GetChannelConfig(network, channel string) (ChannelConfig, error)
}

type ChannelMembership

type ChannelMembership interface {
	GetMSPIDs() []string
	MSPManager() MSPManager
	IsValid(identity view.Identity) error
	GetVerifier(identity view.Identity) (Verifier, error)
}

type Committer

type Committer interface {
	Start(context context.Context) error

	// ProcessNamespace registers namespaces that will be committed even if the rwset is not known
	ProcessNamespace(nss ...driver.Namespace) error

	// AddTransactionFilter adds a new transaction filter to this commit pipeline.
	// The transaction filter is used to check if an unknown transaction needs to be processed anyway
	AddTransactionFilter(tf TransactionFilter) error

	// Status returns a validation code this committer bind to the passed transaction id, plus
	// a list of dependant transaction ids if they exist.
	Status(context context.Context, txID driver.TxID) (ValidationCode, string, error)

	// AddFinalityListener registers a listener for transaction status for the passed transaction id.
	// If the status is already valid or invalid, the listener is called immediately.
	// When the listener is invoked, then it is also removed.
	// The transaction id must not be empty.
	AddFinalityListener(txID string, listener FinalityListener) error

	// RemoveFinalityListener unregisters the passed listener.
	RemoveFinalityListener(txID string, listener FinalityListener) error

	DiscardTx(context context.Context, txID driver.TxID, message string) error

	CommitTX(ctx context.Context, txID driver.TxID, block driver.BlockNum, indexInBlock driver.TxNum, envelope *common.Envelope) error
}

Committer models the committer service

type ConfigService

type ConfigService interface {
	Configuration
	NetworkName() string
	DriverName() string
	DefaultChannel() string
	Channel(name string) ChannelConfig
	ChannelIDs() []string
	Orderers() []*grpc.ConnectionConfig
	// OrderingTLSEnabled returns true, true if TLS is enabled because the key was set.
	// Default value is true.
	OrderingTLSEnabled() (bool, bool)
	// OrderingTLSClientAuthRequired returns true, true if TLS client-side authentication is enabled because the key was set.
	// Default value is false
	OrderingTLSClientAuthRequired() (bool, bool)
	SetConfigOrderers([]*grpc.ConnectionConfig) error
	PickOrderer() *grpc.ConnectionConfig
	BroadcastNumRetries() int
	BroadcastRetryInterval() time.Duration
	OrdererConnectionPoolSize() int
	PickPeer(funcType PeerFunctionType) *grpc.ConnectionConfig
	IsChannelQuiet(name string) bool
	VaultPersistenceName() driver2.PersistenceName
	VaultTXStoreCacheSize() int
	TLSServerHostOverride() string
	ClientConnTimeout() time.Duration
	TLSClientAuthRequired() bool
	TLSClientKeyFile() string
	TLSClientCertFile() string
	KeepAliveClientInterval() time.Duration
	KeepAliveClientTimeout() time.Duration
	NewDefaultChannelConfig(name string) ChannelConfig
	TLSEnabled() bool
}

type Configuration added in v0.4.0

type Configuration interface {
	// GetString returns the value associated with the key as a string
	GetString(key string) string
	// GetInt returns the value associated with the key as an integer
	GetInt(key string) int
	// GetDuration returns the value associated with the key as a duration
	GetDuration(key string) time.Duration
	// GetBool returns the value associated with the key asa boolean
	GetBool(key string) bool
	// GetStringSlice returns the value associated with the key as a slice of strings
	GetStringSlice(key string) []string
	// IsSet checks to see if the key has been set in any of the data locations
	IsSet(key string) bool
	// UnmarshalKey takes a single key and unmarshals it into a Struct
	UnmarshalKey(key string, rawVal interface{}) error
	// ConfigFileUsed returns the file used to populate the config registry
	ConfigFileUsed() string
	// GetPath allows configuration strings that specify a (config-file) relative path
	GetPath(key string) string
	// TranslatePath translates the passed path relative to the config path
	TranslatePath(path string) string
}

type Delivery

type Delivery interface {
	// Start starts the delivery process
	Start(ctx context.Context) error

	// ScanBlock iterates over all blocks.
	// On each block, the callback function is invoked.
	ScanBlock(ctx context.Context, callback BlockCallback) error

	// ScanBlockFrom iterates over all blocks starting from the block with the passed number.
	// On each block, the callback function is invoked.
	ScanBlockFrom(ctx context.Context, block BlockNum, callback BlockCallback) error

	// Scan iterates over all transactions in block starting from the block containing the passed transaction id.
	// If txID is empty, the iterations starts from the first block.
	// On each transaction, the callback function is invoked.
	Scan(ctx context.Context, txID TxID, callback DeliveryCallback) error

	// ScanFromBlock iterates over all transactions in block starting from the block with the passed number.
	// On each transaction, the callback function is invoked.
	ScanFromBlock(ctx context.Context, block BlockNum, callback DeliveryCallback) error
}

Delivery gives access to Fabric channel delivery

type DeliveryCallback

type DeliveryCallback func(tx ProcessedTransaction) (bool, error)

DeliveryCallback is a callback function used to process a transaction. Return true, if the scan should finish.

type DiscoveredPeer

type DiscoveredPeer struct {
	// Identity is the identity of the peer (MSP Identity)
	Identity view.Identity
	// MSPID is the MSP ID of the peer
	MSPID string
	// Endpoint is the endpoint of the peer
	Endpoint string
	// TLSRootCerts is the TLS root certs of the peer
	TLSRootCerts [][]byte
}

DiscoveredPeer contains the information of a discovered peer

type Driver added in v0.2.0

type Driver interface {
	// New returns a new network instance for the passed network and channel (if applicable)
	New(network string, defaultNetwork bool) (FabricNetworkService, error)
}

Driver models the network driver factory

type EndorseTxStore added in v0.4.1

type EndorseTxStore interface {
	driver.EndorseTxStore[Key]
}

type EndorserTransactionService

type EndorserTransactionService interface {
	Exists(ctx context.Context, txid string) bool
	StoreTransaction(ctx context.Context, txid string, raw []byte) error
	LoadTransaction(ctx context.Context, txid string) ([]byte, error)
}

type Envelope

type Envelope interface {
	TxID() string
	Nonce() []byte
	Creator() []byte
	Results() []byte
	Bytes() ([]byte, error)
	FromBytes(raw []byte) error
	String() string
}

type EnvelopeService

type EnvelopeService interface {
	Exists(ctx context.Context, txid string) bool
	StoreEnvelope(ctx context.Context, txid string, env interface{}) error
	LoadEnvelope(ctx context.Context, txid string) ([]byte, error)
}

type EnvelopeStore added in v0.4.1

type EnvelopeStore interface {
	driver.EnvelopeStore[Key]
}

type FabricNetworkService

type FabricNetworkService interface {
	Name() string

	OrderingService() Ordering

	TransactionManager() TransactionManager

	ProcessorManager() ProcessorManager

	LocalMembership() LocalMembership

	IdentityProvider() IdentityProvider

	// Channel returns the channel whose name is the passed one.
	// If the empty string is passed, the default channel is returned, if defined.
	Channel(name string) (Channel, error)

	// Ledger returns the ledger for the channel whose name is the passed one.
	Ledger(name string) (Ledger, error)

	// Committer returns the committer for the channel whose name is the passed one.
	Committer(name string) (Committer, error)

	SignerService() SignerService

	ConfigService() ConfigService
}

FabricNetworkService gives access to a Fabric network components

type FabricNetworkServiceProvider

type FabricNetworkServiceProvider interface {
	Names() []string
	DefaultName() string
	// FabricNetworkService returns a FabricNetworkService instance for the passed parameters
	FabricNetworkService(id string) (FabricNetworkService, error)
}

func GetFabricManagementService

func GetFabricManagementService(ctx services.Provider) FabricNetworkServiceProvider

type Finality

type Finality interface {
	// 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.
	IsFinal(ctx context.Context, txID string) error
}

type FinalityListener added in v0.4.0

type FinalityListener = driver.FinalityListener[ValidationCode]

FinalityListener is the interface that must be implemented to receive transaction status notifications

type GetIdentityFunc

type GetIdentityFunc func(opts *IdentityOptions) (view.Identity, []byte, error)

type GetStateOpt

type GetStateOpt = driver.GetStateOpt

type IdentityInfo

type IdentityInfo struct {
	ID           string
	EnrollmentID string
	GetIdentity  GetIdentityFunc
}

type IdentityOptions

type IdentityOptions struct {
	EIDExtension bool
	AuditInfo    []byte
}

type IdentityProvider

type IdentityProvider interface {
	// Identity returns the Fabric identity bound to the passed label.
	// If not Fabric identity is associated to the label, it returns the the SFC identity bound to that label.
	Identity(label string) (view.Identity, error)
}

IdentityProvider models the identity provider

type Key added in v0.4.1

type Key struct {
	Network driver.Network
	Channel driver.Channel
	TxID    driver.TxID
}

func (Key) UniqueKey added in v0.4.1

func (k Key) UniqueKey() string

type Ledger

type Ledger interface {
	// GetLedgerInfo returns the ledger info
	GetLedgerInfo() (*LedgerInfo, error)

	// GetTransactionByID retrieves a transaction by id
	GetTransactionByID(txID string) (ProcessedTransaction, error)

	// GetBlockNumberByTxID returns the number of the block where the passed transaction appears
	GetBlockNumberByTxID(txID string) (uint64, error)

	// GetBlockByNumber fetches a block by number
	GetBlockByNumber(number uint64) (Block, error)
}

Ledger gives access to the remote ledger

type LedgerInfo added in v0.4.1

type LedgerInfo struct {
	Height            uint64
	CurrentBlockHash  []byte
	PreviousBlockHash []byte
}

type ListenerManager added in v0.4.0

type ListenerManager driver.ListenerManager[ValidationCode]

type ListenerManagerProvider added in v0.4.0

type ListenerManagerProvider driver.ListenerManagerProvider[ValidationCode]

type LocalMembership

type LocalMembership interface {
	DefaultIdentity() view.Identity
	AnonymousIdentity() (view.Identity, error)
	IsMe(ctx context.Context, id view.Identity) bool
	DefaultSigningIdentity() SigningIdentity
	RegisterX509MSP(id string, path string, mspID string) error
	RegisterIdemixMSP(id string, path string, mspID string) error
	GetIdentityByID(id string) (view.Identity, error)
	GetIdentityInfoByLabel(mspType string, label string) *IdentityInfo
	GetIdentityInfoByIdentity(mspType string, id view.Identity) *IdentityInfo
	Refresh() error
}

type MSP added in v0.4.0

type MSP interface {
	ID() string
	MSPType() string
	MSPID() string
	Path() string
	CacheSize() int
	Opts() map[interface{}]interface{}
}

type MSPIdentity

type MSPIdentity interface {
	GetMSPIdentifier() string
	Validate() error
	Verify(message, sigma []byte) error
}

type MSPManager

type MSPManager interface {
	DeserializeIdentity(serializedIdentity []byte) (MSPIdentity, error)
}

type MetadataService

type MetadataService interface {
	Exists(ctx context.Context, txid string) bool
	StoreTransient(ctx context.Context, txid string, transientMap TransientMap) error
	LoadTransient(ctx context.Context, txid string) (TransientMap, error)
}

type MetadataStore added in v0.4.1

type MetadataStore interface {
	driver.MetadataStore[Key, TransientMap]
}

type Ordering

type Ordering interface {
	// Broadcast sends the passed blob to the ordering service to be ordered
	Broadcast(context context.Context, blob interface{}) error

	// SetConsensusType sets the consensus type the ordering service should use
	SetConsensusType(consensusType string) error
}

Ordering models the ordering service

type PeerFunctionType added in v0.3.0

type PeerFunctionType int

PeerFunctionType defines classes of peers providing a specific functionality

type ProcessTransaction

type ProcessTransaction interface {
	Network() string
	Channel() string
	ID() string
	FunctionAndParameters() (string, []string)
}

type ProcessedTransaction

type ProcessedTransaction interface {
	// TxID returns the transaction's id
	TxID() string
	// Results returns the rwset marshaled
	Results() []byte
	// ValidationCode of this transaction
	ValidationCode() int32
	// IsValid returns true if the transaction is valid, false otherwise
	IsValid() bool
	// Envelope returns the Fabric envelope
	Envelope() []byte
}

ProcessedTransaction models a transaction that has been processed by Fabric

type Processor

type Processor interface {
	Process(req Request, tx ProcessTransaction, rws RWSet, ns string) error
}

type ProcessorManager

type ProcessorManager interface {
	AddProcessor(ns string, processor Processor) error
	SetDefaultProcessor(processor Processor) error
	AddChannelProcessor(channel string, ns string, processor Processor) error
	ProcessByID(ctx context.Context, channel string, txid driver.TxID) error
}

type Proposal

type Proposal interface {
	Header() []byte
	Payload() []byte
}

type ProposalResponse

type ProposalResponse interface {
	Endorser() []byte
	Payload() []byte
	EndorserSignature() []byte
	Results() []byte
	ResponseStatus() int32
	ResponseMessage() string
	Bytes() ([]byte, error)
	VerifyEndorsement(provider VerifierProvider) error
}

type QueryExecutor

type QueryExecutor = driver.QueryExecutor

type RWSExtractor

type RWSExtractor interface {
	Extract(tx []byte) (ProcessTransaction, RWSet, error)
}

type RWSet

type RWSet = driver.RWSet

type RWSetInspector added in v0.4.0

type RWSetInspector interface {
	NewRWSetFromBytes(ctx context.Context, txID driver.TxID, rwset []byte) (RWSet, error)
	InspectRWSet(ctx context.Context, rwsetBytes []byte, namespaces ...driver.Namespace) (RWSet, error)
}

type RWSetLoader

type RWSetLoader interface {
	AddHandlerProvider(headerType common.HeaderType, handlerProvider RWSetPayloadHandlerProvider) error
	GetRWSetFromEvn(ctx context.Context, txID driver.TxID) (RWSet, ProcessTransaction, error)
	GetRWSetFromETx(ctx context.Context, txID driver.TxID) (RWSet, ProcessTransaction, error)
	GetInspectingRWSetFromEvn(ctx context.Context, id driver.TxID, envelopeRaw []byte) (RWSet, ProcessTransaction, error)
}

type RWSetPayloadHandler added in v0.4.0

type RWSetPayloadHandler interface {
	Load(payl *common.Payload, header *common.ChannelHeader) (RWSet, ProcessTransaction, error)
}

type RWSetPayloadHandlerProvider added in v0.4.0

type RWSetPayloadHandlerProvider = func(network, channel string, v RWSetInspector) RWSetPayloadHandler

type Request

type Request interface {
	ID() string
}

type Resolver added in v0.4.0

type Resolver interface {
	// Name of the resolver
	Name() string
	// Domain is option
	Domain() string
	// Identity specifies an MSP Identity
	Identity() MSP
	// Addresses where to reach this identity
	Addresses() map[string]string
	// Aliases is a list of alias for this resolver
	Aliases() []string
}

type SignedProposal

type SignedProposal interface {
	ProposalBytes() []byte
	Signature() []byte
	ProposalHash() []byte
	ChaincodeName() string
	ChaincodeVersion() string
}

type Signer

type Signer = driver.Signer

type SignerService

type SignerService = driver.SigService

SignerService models a signer service

type SigningIdentity

type SigningIdentity interface {
	Serialize() ([]byte, error)
	Sign(msg []byte) ([]byte, error)
}

type Transaction

type Transaction interface {
	Creator() view.Identity
	Nonce() []byte
	ID() string
	Network() string
	Channel() string
	Function() string
	Parameters() [][]byte
	FunctionAndParameters() (string, []string)
	Chaincode() string
	ChaincodeVersion() string
	Results() ([]byte, error)
	From(payload Transaction) (err error)
	SetFromBytes(raw []byte) error
	SetFromEnvelopeBytes(raw []byte) error
	Proposal() Proposal
	SignedProposal() SignedProposal
	SetProposal(chaincode string, version string, function string, params ...string)
	AppendParameter(p []byte)
	SetParameterAt(i int, p []byte) error
	Transient() TransientMap
	ResetTransient()
	SetRWSet() error
	RWS() RWSet
	Done() error
	Close()
	Raw() ([]byte, error)
	GetRWSet() (RWSet, error)
	Bytes() ([]byte, error)
	Endorse() error
	EndorseWithIdentity(identity view.Identity) error
	EndorseWithSigner(identity view.Identity, s Signer) error
	EndorseProposal() error
	EndorseProposalWithIdentity(identity view.Identity) error
	EndorseProposalResponse() error
	EndorseProposalResponseWithIdentity(identity view.Identity) error
	AppendProposalResponse(response ProposalResponse) error
	ProposalHasBeenEndorsedBy(party view.Identity) error
	StoreTransient() error
	ProposalResponses() ([]ProposalResponse, error)
	ProposalResponse() ([]byte, error)
	BytesNoTransient() ([]byte, error)
	Envelope() (Envelope, error)
}

type TransactionFactory added in v0.4.0

type TransactionFactory interface {
	NewTransaction(ctx context.Context, channel string, nonce []byte, creator []byte, txid string, rawRequest []byte) (Transaction, error)
}

type TransactionFilter added in v0.4.0

type TransactionFilter = driver.TransactionFilter

TransactionFilter is used to filter unknown transactions. If the filter accepts, the transaction is processed by the commit pipeline anyway.

type TransactionManager

type TransactionManager interface {
	ComputeTxID(id *TxIDComponents) string
	NewEnvelope() Envelope
	NewProposalResponseFromBytes(raw []byte) (ProposalResponse, error)
	NewTransaction(ctx context.Context, transactionType TransactionType, creator view.Identity, nonce []byte, txid string, channel string, rawRequest []byte) (Transaction, error)
	NewTransactionFromBytes(ctx context.Context, channel string, raw []byte) (Transaction, error)
	NewTransactionFromEnvelopeBytes(ctx context.Context, channel string, raw []byte) (Transaction, error)
	AddTransactionFactory(tt TransactionType, factory TransactionFactory)
	NewProcessedTransactionFromEnvelopePayload(envelopePayload []byte) (ProcessedTransaction, int32, error)
	NewProcessedTransactionFromEnvelopeRaw(envelope []byte) (ProcessedTransaction, error)
	NewProcessedTransaction(pt []byte) (ProcessedTransaction, error)
}

type TransactionStatusChanged

type TransactionStatusChanged struct {
	ThisTopic         string
	TxID              string
	VC                ValidationCode
	ValidationMessage string
}

TransactionStatusChanged is sent when the status of a transaction changes

func (*TransactionStatusChanged) Message

func (t *TransactionStatusChanged) Message() interface{}

Message returns the message for the transaction status change

func (*TransactionStatusChanged) Topic

func (t *TransactionStatusChanged) Topic() string

Topic returns the topic for the transaction status change

type TransactionType added in v0.4.0

type TransactionType int32

type TransientMap

type TransientMap map[string][]byte

type TxID

type TxID = driver.TxID

type TxIDComponents added in v0.4.1

type TxIDComponents struct {
	Nonce   []byte
	Creator []byte
}

type TxNum added in v0.4.0

type TxNum = driver.TxNum

type TxStatus added in v0.4.1

type TxStatus = driver.TxStatus

type TxValidationStatus added in v0.4.0

type TxValidationStatus = driver.TxValidationStatus[ValidationCode]

type ValidationCode

type ValidationCode = int

ValidationCode of transaction

const (
	Valid   ValidationCode // Transaction is valid and committed
	Invalid                // Transaction is invalid and has been discarded
	Busy                   // Transaction does not yet have a validity state
	Unknown                // Transaction is unknown
)

type Vault

type Vault interface {
	driver.Vault[ValidationCode]

	// InspectRWSet returns an ephemeral RWSet for this ledger whose content is unmarshalled
	// from the passed bytes.
	// If namespaces is not empty, the returned RWSet will be filtered by the passed namespaces
	InspectRWSet(ctx context.Context, rwset []byte, namespaces ...driver.Namespace) (RWSet, error)
	RWSExists(ctx context.Context, id driver.TxID) bool
	Match(ctx context.Context, id driver.TxID, results []byte) error
	Close() error
}

type VaultStore added in v0.4.1

type VaultStore interface {
	GetState(ctx context.Context, namespace driver.Namespace, key driver.PKey) (*driver.VaultRead, error)
	GetStateRange(ctx context.Context, namespace driver.Namespace, startKey, endKey driver.PKey) (driver.TxStateIterator, error)
	GetLast(ctx context.Context) (*TxStatus, error)
}

type Verifier

type Verifier = driver.Verifier

Verifier is an interface which wraps the Verify method.

type VerifierProvider added in v0.4.0

type VerifierProvider interface {
	// GetVerifier returns a Verifier for the passed identity
	GetVerifier(identity view.Identity) (Verifier, error)
}

VerifierProvider returns a Verifier for the passed identity

Jump to

Keyboard shortcuts

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