generic

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

Documentation

Index

Constants

View Source
const (
	GetBlockByNumber   string = "GetBlockByNumber"
	GetTransactionByID string = "GetTransactionByID"
	GetBlockByTxID     string = "GetBlockByTxID"
	DefaultNumRetries         = 3
	DefaultRetrySleep         = 1 * time.Second
)

These are function names from Invoke first parameter

Variables

View Source
var (
	WaitForEventTimeout = 300 * time.Second
	FinalityWaitTimeout = 20 * time.Second
)

Functions

func NewChannel added in v0.3.0

func NewChannel(nw driver.FabricNetworkService, name string, quiet bool) (driver.Channel, error)

func NewEndpointResolver

func NewEndpointResolver(resolver Resolver, es EndpointService) (*endpointResolver, error)

Types

type Block

type Block struct {
	*common.Block
}

Block wraps a Fabric block

func (*Block) DataAt

func (b *Block) DataAt(i int) []byte

DataAt returns the data stored at the passed index

func (*Block) ProcessedTransaction

func (b *Block) ProcessedTransaction(i int) (driver.ProcessedTransaction, error)

ProcessedTransaction returns the ProcessedTransaction at passed index

type Channel added in v0.3.0

type Channel struct {
	SP                view2.ServiceProvider
	ChannelConfig     *config2.Channel
	NetworkConfig     *config2.Config
	Network           *Network
	ChannelName       string
	Finality          driver.Finality
	Vault             *vault.Vault
	ProcessNamespaces []string
	ExternalCommitter *committer.ExternalCommitter
	ES                driver.EnvelopeService
	TS                driver.EndorserTransactionService
	MS                driver.MetadataService
	DeliveryService   Delivery
	driver.TXIDStore
	RWSetLoader driver.RWSetLoader

	// ResourcesApplyLock is used to serialize calls to CommitConfig and bundle update processing.
	ResourcesApplyLock sync.Mutex
	// ResourcesLock is used to serialize access to resources
	ResourcesLock sync.RWMutex
	// resources is used to acquire configuration bundle resources.
	ChannelResources channelconfig.Resources

	// chaincodes
	ChaincodesLock sync.RWMutex
	Chaincodes     map[string]driver.Chaincode

	// connection pool
	ConnCache common2.CachingEndorserPool

	// events
	Subscribers      *events.Subscribers
	EventsSubscriber events.Subscriber
	EventsPublisher  events.Publisher
}

func (*Channel) ApplyBundle added in v0.3.0

func (c *Channel) ApplyBundle(bundle *channelconfig.Bundle) error

func (*Channel) Chaincode added in v0.3.0

func (c *Channel) Chaincode(name string) driver.Chaincode

Chaincode returns a chaincode handler for the passed chaincode name

func (*Channel) Close added in v0.3.0

func (c *Channel) Close() error

func (*Channel) CommitConfig added in v0.3.0

func (c *Channel) CommitConfig(blockNumber uint64, raw []byte, env *common.Envelope) error

CommitConfig is used to validate and apply configuration transactions for a Channel.

func (*Channel) CommitTX added in v0.3.0

func (c *Channel) CommitTX(txid string, block uint64, indexInBlock int, envelope *common.Envelope) (err error)

func (*Channel) Config added in v0.3.0

func (c *Channel) Config() *config2.Channel

func (*Channel) DefaultSigner added in v0.3.0

func (c *Channel) DefaultSigner() discovery.Signer

func (*Channel) DiscardTx added in v0.3.0

func (c *Channel) DiscardTx(txid string) error

func (*Channel) EnvelopeService added in v0.3.0

func (c *Channel) EnvelopeService() driver.EnvelopeService

func (*Channel) FetchAndStoreEnvelope added in v0.3.0

func (c *Channel) FetchAndStoreEnvelope(txID string) error

FetchAndStoreEnvelope fetches from the ledger and stores the enveloped correspoding to the passed id

func (*Channel) GetBlockByNumber added in v0.3.0

func (c *Channel) GetBlockByNumber(number uint64) (driver.Block, error)

GetBlockByNumber fetches a block by number

func (*Channel) GetBlockNumberByTxID added in v0.3.0

func (c *Channel) GetBlockNumberByTxID(txID string) (uint64, error)

func (*Channel) GetClientConfig added in v0.3.0

func (c *Channel) GetClientConfig(tlsRootCerts [][]byte, UseTLS bool) (*grpc.ClientConfig, string, error)

func (*Channel) GetEphemeralRWSet added in v0.3.0

func (c *Channel) GetEphemeralRWSet(rwset []byte, namespaces ...string) (driver.RWSet, error)

GetEphemeralRWSet 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

func (*Channel) GetMSPIDs added in v0.3.0

func (c *Channel) GetMSPIDs() []string

GetMSPIDs retrieves the MSP IDs of the organizations in the current Channel configuration.

func (*Channel) GetProcessNamespace added in v0.3.0

func (c *Channel) GetProcessNamespace() []string

func (*Channel) GetRWSet added in v0.3.0

func (c *Channel) GetRWSet(txid string, rwset []byte) (driver.RWSet, error)

GetRWSet returns a RWSet for this ledger whose content is unmarshalled from the passed bytes. A client may obtain more than one such simulator; they are made unique by way of the supplied txid

func (*Channel) GetRWSetFromETx added in v0.3.0

func (c *Channel) GetRWSetFromETx(txID string) (driver.RWSet, driver.ProcessTransaction, error)

func (*Channel) GetRWSetFromEvn added in v0.3.0

func (c *Channel) GetRWSetFromEvn(txID string) (driver.RWSet, driver.ProcessTransaction, error)

func (*Channel) GetTransactionByID added in v0.3.0

func (c *Channel) GetTransactionByID(txID string) (driver.ProcessedTransaction, error)

func (*Channel) GetVerifier added in v0.3.0

func (c *Channel) GetVerifier(identity view.Identity) (api2.Verifier, error)

func (*Channel) Init added in v0.3.0

func (c *Channel) Init() error

func (*Channel) IsFinal added in v0.3.0

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

func (*Channel) IsFinalForParties added in v0.3.0

func (c *Channel) IsFinalForParties(txID string, parties ...view.Identity) error

func (*Channel) IsValid added in v0.3.0

func (c *Channel) IsValid(identity view.Identity) error

func (*Channel) MSPManager added in v0.3.0

func (c *Channel) MSPManager() driver.MSPManager

MSPManager returns the msp.MSPManager that reflects the current Channel configuration. Users should not memoize references to this object.

func (*Channel) MetadataService added in v0.3.0

func (c *Channel) MetadataService() driver.MetadataService

func (*Channel) Name added in v0.3.0

func (c *Channel) Name() string

func (*Channel) NewPeerClientForAddress added in v0.3.0

func (c *Channel) NewPeerClientForAddress(cc grpc.ConnectionConfig) (peer2.Client, error)

func (*Channel) NewQueryExecutor added in v0.3.0

func (c *Channel) NewQueryExecutor() (driver.QueryExecutor, error)

NewQueryExecutor gives handle to a query executor. A client can obtain more than one 'QueryExecutor's for parallel execution. Any synchronization should be performed at the implementation level if required

func (*Channel) NewRWSet added in v0.3.0

func (c *Channel) NewRWSet(txid string) (driver.RWSet, error)

NewRWSet returns a RWSet for this ledger. A client may obtain more than one such simulator; they are made unique by way of the supplied txid

func (*Channel) ProcessNamespace added in v0.3.0

func (c *Channel) ProcessNamespace(nss ...string) error

func (*Channel) ReloadConfigTransactions added in v0.3.0

func (c *Channel) ReloadConfigTransactions() error

func (*Channel) Resources added in v0.3.0

func (c *Channel) Resources() channelconfig.Resources

Resources returns the active Channel configuration bundle.

func (*Channel) Scan added in v0.3.0

func (c *Channel) Scan(ctx context.Context, txID string, callback driver.DeliveryCallback) error

func (*Channel) StartDelivery added in v0.3.0

func (c *Channel) StartDelivery(ctx context.Context) error

func (*Channel) Status added in v0.3.0

func (c *Channel) Status(txid string) (driver.ValidationCode, []string, error)

func (*Channel) SubscribeTxStatusChanges added in v0.3.0

func (c *Channel) SubscribeTxStatusChanges(txID string, listener driver.TxStatusChangeListener) error

SubscribeTxStatusChanges registers a listener for transaction status changes for the passed transaction id. If the transaction id is empty, the listener will be called for all transactions.

func (*Channel) TransactionService added in v0.3.0

func (c *Channel) TransactionService() driver.EndorserTransactionService

func (*Channel) UnsubscribeTxStatusChanges added in v0.3.0

func (c *Channel) UnsubscribeTxStatusChanges(txID string, listener driver.TxStatusChangeListener) error

UnsubscribeTxStatusChanges unregisters a listener for transaction status changes for the passed transaction id. If the transaction id is empty, the listener will be called for all transactions.

type Delivery

type Delivery interface {
	Start(ctx context.Context)
	Stop()
}

type EndpointService

type EndpointService interface {
	GetIdentity(label string, pkiID []byte) (view.Identity, error)
}

type MSPManager

type MSPManager interface {
	DeserializeIdentity(serializedIdentity []byte) (msp.Identity, error)
}

type Network added in v0.3.0

type Network struct {
	SP view2.ServiceProvider

	ConsensusType string

	Metrics      *metrics.Metrics
	Ordering     driver.Ordering
	NewChannel   NewChannelFunc
	ChannelMap   map[string]driver.Channel
	ChannelMutex sync.RWMutex
	// contains filtered or unexported fields
}

func NewNetwork

func NewNetwork(
	sp view2.ServiceProvider,
	name string,
	config *config2.Config,
	idProvider driver.IdentityProvider,
	localMembership driver.LocalMembership,
	sigService driver.SignerService,
	metrics *metrics.Metrics,
	newChannel NewChannelFunc,
) (*Network, error)

func (*Network) Broadcast added in v0.3.0

func (f *Network) Broadcast(context context.Context, blob interface{}) error

func (*Network) Channel added in v0.3.0

func (f *Network) Channel(name string) (driver.Channel, error)

func (*Network) Channels added in v0.3.0

func (f *Network) Channels() []string

func (*Network) Committer added in v0.3.0

func (f *Network) Committer(name string) (driver.Committer, error)

func (*Network) Config added in v0.3.0

func (f *Network) Config() *config2.Config

func (*Network) ConfigService added in v0.3.0

func (f *Network) ConfigService() driver.ConfigService

func (*Network) DefaultChannel added in v0.3.0

func (f *Network) DefaultChannel() string

func (*Network) IdentityProvider added in v0.3.0

func (f *Network) IdentityProvider() driver.IdentityProvider

func (*Network) Init added in v0.3.0

func (f *Network) Init() error

func (*Network) Ledger added in v0.3.0

func (f *Network) Ledger(name string) (driver.Ledger, error)

func (*Network) LocalMembership added in v0.3.0

func (f *Network) LocalMembership() driver.LocalMembership

func (*Network) Name added in v0.3.0

func (f *Network) Name() string

func (*Network) Orderers added in v0.3.0

func (f *Network) Orderers() []*grpc.ConnectionConfig

func (*Network) Peers added in v0.3.0

func (f *Network) Peers() []*grpc.ConnectionConfig

func (*Network) PickOrderer added in v0.3.0

func (f *Network) PickOrderer() *grpc.ConnectionConfig

func (*Network) PickPeer added in v0.3.0

func (*Network) ProcessorManager added in v0.3.0

func (f *Network) ProcessorManager() driver.ProcessorManager

func (*Network) SetConfigOrderers added in v0.3.0

func (f *Network) SetConfigOrderers(o channelconfig.Orderer, orderers []*grpc.ConnectionConfig) error

func (*Network) SetConsensusType added in v0.3.0

func (f *Network) SetConsensusType(consensusType string) error

SetConsensusType sets the consensus type the ordering service should use

func (*Network) SignerService added in v0.3.0

func (f *Network) SignerService() driver.SignerService

func (*Network) TransactionManager added in v0.3.0

func (f *Network) TransactionManager() driver.TransactionManager

type NewChannelFunc added in v0.3.0

type NewChannelFunc = func(network driver.FabricNetworkService, name string, quiet bool) (driver.Channel, error)

type RWSetLoader added in v0.3.0

type RWSetLoader struct {
	Network            string
	Channel            string
	EnvelopeService    driver.EnvelopeService
	TransactionService driver.EndorserTransactionService
	TransactionManager driver.TransactionManager

	Vault *vault.Vault
}

func NewRWSetLoader added in v0.3.0

func NewRWSetLoader(network string, channel string, envelopeService driver.EnvelopeService, transactionService driver.EndorserTransactionService, transactionManager driver.TransactionManager, vault *vault.Vault) *RWSetLoader

func (*RWSetLoader) GetRWSetFromETx added in v0.3.0

func (c *RWSetLoader) GetRWSetFromETx(txID string) (driver.RWSet, driver.ProcessTransaction, error)

func (*RWSetLoader) GetRWSetFromEvn added in v0.3.0

func (c *RWSetLoader) GetRWSetFromEvn(txID string) (driver.RWSet, driver.ProcessTransaction, error)

type Resolver

type Resolver interface {
	// GetIdentity returns the identity associated to the passed label
	GetIdentity(label string) view.Identity
}

type SerializableSigner

type SerializableSigner interface {
	Sign(message []byte) ([]byte, error)

	Serialize() ([]byte, error)
}

type SigService

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

func NewSigService

func NewSigService(sp view2.ServiceProvider) *SigService

func (*SigService) GetSigner

func (s *SigService) GetSigner(id view.Identity) (driver.Signer, error)

func (*SigService) GetSigningIdentity

func (s *SigService) GetSigningIdentity(id view.Identity) (driver.SigningIdentity, error)

func (*SigService) GetVerifier

func (s *SigService) GetVerifier(id view.Identity) (driver.Verifier, error)

func (*SigService) RegisterSigner

func (s *SigService) RegisterSigner(identity view.Identity, signer driver.Signer, verifier driver.Verifier) error

type TXIDStore

type TXIDStore interface {
	fdriver.TXIDStore
	Get(txid string) (fdriver.ValidationCode, error)
	Set(txid string, code fdriver.ValidationCode) error
}

func NewVault

func NewVault(sp view2.ServiceProvider, config *config.Config, channel string) (*vault.Vault, TXIDStore, error)

type TxEventsListener

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

func (*TxEventsListener) OnReceive

func (l *TxEventsListener) OnReceive(event events.Event)

type ValidationFlags

type ValidationFlags []uint8

Directories

Path Synopsis
msp
mock
Code generated by counterfeiter.
Code generated by counterfeiter.
mocks
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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