fabric

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: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DiscoveredIdentities

func DiscoveredIdentities(d []DiscoveredPeer) []view.Identity

DiscoveredIdentities extract the identities of the discovered peers

func GetFabricNetworkNames

func GetFabricNetworkNames(sp view2.ServiceProvider) []string

Types

type Block

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

Block models a Fabric block

func (*Block) DataAt

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

DataAt returns the data stored at the passed index

type Chaincode

type Chaincode struct {
	EventListener *EventListener
	// contains filtered or unexported fields
}

func (*Chaincode) Discover

func (c *Chaincode) Discover() *ChaincodeDiscover

func (*Chaincode) Endorse

func (c *Chaincode) Endorse(function string, args ...interface{}) *ChaincodeEndorse

func (*Chaincode) Invoke

func (c *Chaincode) Invoke(function string, args ...interface{}) *ChaincodeInvocation

Invoke returns a chaincode invocation proxy struct for the passed function and arguments

func (*Chaincode) IsAvailable

func (c *Chaincode) IsAvailable() (bool, error)

func (*Chaincode) IsPrivate

func (c *Chaincode) IsPrivate() bool

func (*Chaincode) Query

func (c *Chaincode) Query(function string, args ...interface{}) *ChaincodeQuery

func (*Chaincode) Version

func (c *Chaincode) Version() (string, error)

Version returns the version of this chaincode. It returns an error if a failure happens during the computation.

type ChaincodeDiscover

type ChaincodeDiscover struct {
	driver.ChaincodeDiscover
}

func (*ChaincodeDiscover) Call

func (i *ChaincodeDiscover) Call() ([]DiscoveredPeer, error)

Call invokes discovery service and returns the discovered peers

func (*ChaincodeDiscover) WithFilterByMSPIDs

func (i *ChaincodeDiscover) WithFilterByMSPIDs(mspIDs ...string) *ChaincodeDiscover

type ChaincodeEndorse

type ChaincodeEndorse struct {
	ChaincodeInvocation driver.ChaincodeInvocation
}

func (*ChaincodeEndorse) Call

func (i *ChaincodeEndorse) Call() (*Envelope, error)

func (*ChaincodeEndorse) WithContext added in v0.3.0

func (i *ChaincodeEndorse) WithContext(context context.Context) *ChaincodeEndorse

func (*ChaincodeEndorse) WithEndorsersByMSPIDs

func (i *ChaincodeEndorse) WithEndorsersByMSPIDs(mspIDs ...string) *ChaincodeEndorse

func (*ChaincodeEndorse) WithEndorsersFromMyOrg

func (i *ChaincodeEndorse) WithEndorsersFromMyOrg() *ChaincodeEndorse

func (*ChaincodeEndorse) WithImplicitCollections

func (i *ChaincodeEndorse) WithImplicitCollections(mspIDs ...string) *ChaincodeEndorse

func (*ChaincodeEndorse) WithInvokerIdentity

func (i *ChaincodeEndorse) WithInvokerIdentity(id view.Identity) *ChaincodeEndorse

func (*ChaincodeEndorse) WithNumRetries added in v0.2.0

func (i *ChaincodeEndorse) WithNumRetries(numRetries uint) *ChaincodeEndorse

WithNumRetries sets the number of times the chaincode operation should be retried before returning a failure

func (*ChaincodeEndorse) WithRetrySleep added in v0.2.0

func (i *ChaincodeEndorse) WithRetrySleep(duration time.Duration) *ChaincodeEndorse

WithRetrySleep sets the time interval between each retry

func (*ChaincodeEndorse) WithTransientEntry

func (i *ChaincodeEndorse) WithTransientEntry(k string, v interface{}) *ChaincodeEndorse

func (*ChaincodeEndorse) WithTxID

func (i *ChaincodeEndorse) WithTxID(id TxID) *ChaincodeEndorse

type ChaincodeInvocation

type ChaincodeInvocation struct {
	driver.ChaincodeInvocation
}

func (*ChaincodeInvocation) Call

func (i *ChaincodeInvocation) Call() (string, []byte, error)

Call invokes the chaincode function with the passed arguments, and any additional parameter set with the other functions on this struct. It no error occurs, it returns the transaction id and the response payload of the chaincode invocation.

func (*ChaincodeInvocation) WithContext added in v0.3.0

func (i *ChaincodeInvocation) WithContext(context context.Context) *ChaincodeInvocation

func (*ChaincodeInvocation) WithEndorsersByMSPIDs

func (i *ChaincodeInvocation) WithEndorsersByMSPIDs(mspIDs ...string) *ChaincodeInvocation

func (*ChaincodeInvocation) WithEndorsersFromMyOrg

func (i *ChaincodeInvocation) WithEndorsersFromMyOrg() *ChaincodeInvocation

func (*ChaincodeInvocation) WithInvokerIdentity

func (i *ChaincodeInvocation) WithInvokerIdentity(id view.Identity) *ChaincodeInvocation

func (*ChaincodeInvocation) WithNumRetries added in v0.2.0

func (i *ChaincodeInvocation) WithNumRetries(numRetries uint) *ChaincodeInvocation

WithNumRetries sets the number of times the chaincode operation should be retried before returning a failure

func (*ChaincodeInvocation) WithRetrySleep added in v0.2.0

func (i *ChaincodeInvocation) WithRetrySleep(duration time.Duration) *ChaincodeInvocation

WithRetrySleep sets the time interval between each retry

func (*ChaincodeInvocation) WithTransientEntry

func (i *ChaincodeInvocation) WithTransientEntry(k string, v interface{}) *ChaincodeInvocation

type ChaincodeQuery

type ChaincodeQuery struct {
	driver.ChaincodeInvocation
}

func (*ChaincodeQuery) Call

func (i *ChaincodeQuery) Call() ([]byte, error)

func (*ChaincodeQuery) WithContext added in v0.3.0

func (i *ChaincodeQuery) WithContext(context context.Context) *ChaincodeQuery

func (*ChaincodeQuery) WithDiscoveredEndorsersByEndpoints

func (i *ChaincodeQuery) WithDiscoveredEndorsersByEndpoints(endpoints ...string) *ChaincodeQuery

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.

func (*ChaincodeQuery) WithEndorsersByMSPIDs

func (i *ChaincodeQuery) WithEndorsersByMSPIDs(mspIDs ...string) *ChaincodeQuery

func (*ChaincodeQuery) WithEndorsersFromMyOrg

func (i *ChaincodeQuery) WithEndorsersFromMyOrg() *ChaincodeQuery

func (*ChaincodeQuery) WithInvokerIdentity

func (i *ChaincodeQuery) WithInvokerIdentity(id view.Identity) *ChaincodeQuery

func (*ChaincodeQuery) WithMatchEndorsementPolicy added in v0.2.0

func (i *ChaincodeQuery) WithMatchEndorsementPolicy() *ChaincodeQuery

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

func (*ChaincodeQuery) WithNumRetries added in v0.2.0

func (i *ChaincodeQuery) WithNumRetries(numRetries uint) *ChaincodeQuery

WithNumRetries sets the number of times the chaincode operation should be retried before returning a failure

func (*ChaincodeQuery) WithRetrySleep added in v0.2.0

func (i *ChaincodeQuery) WithRetrySleep(duration time.Duration) *ChaincodeQuery

WithRetrySleep sets the time interval between each retry

func (*ChaincodeQuery) WithTransientEntry

func (i *ChaincodeQuery) WithTransientEntry(k string, v interface{}) *ChaincodeQuery

func (*ChaincodeQuery) WithTxID

func (i *ChaincodeQuery) WithTxID(id TxID) *ChaincodeQuery

type Channel

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

func GetChannel

func GetChannel(sp view2.ServiceProvider, network, channel string) *Channel

GetChannel returns the requested channel for the passed network

func GetDefaultChannel

func GetDefaultChannel(sp view2.ServiceProvider) *Channel

GetDefaultChannel returns the default channel of the default fns

func (*Channel) Chaincode

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

func (*Channel) Committer

func (c *Channel) Committer() *Committer

func (*Channel) Delivery

func (c *Channel) Delivery() *Delivery

func (*Channel) EnvelopeService

func (c *Channel) EnvelopeService() *EnvelopeService

func (*Channel) Finality

func (c *Channel) Finality() *Finality

func (*Channel) Ledger

func (c *Channel) Ledger() *Ledger

func (*Channel) MSPManager

func (c *Channel) MSPManager() *MSPManager

func (*Channel) MetadataService

func (c *Channel) MetadataService() *MetadataService

func (*Channel) Name

func (c *Channel) Name() string

func (*Channel) Vault

func (c *Channel) Vault() *Vault

type Committer

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

func NewCommitter

func NewCommitter(ch driver.Channel) *Committer

func (*Committer) ProcessNamespace

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

ProcessNamespace registers namespaces that will be committed even if the rwset is not known

func (*Committer) Status

func (c *Committer) Status(txid string) (ValidationCode, []string, error)

Status returns a validation code this committer bind to the passed transaction id, plus a list of dependant transaction ids if they exist.

func (*Committer) SubscribeTxStatusChanges

func (c *Committer) SubscribeTxStatusChanges(txID string, listener 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 (*Committer) UnsubscribeTxStatusChanges

func (c *Committer) UnsubscribeTxStatusChanges(txID string, listener 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 ConfigService

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

func (*ConfigService) GetString

func (s *ConfigService) GetString(key string) string

type Delivery

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

Delivery models the Fabric's delivery service

func (*Delivery) Scan

func (d *Delivery) Scan(ctx context.Context, txID string, callback DeliveryCallback) 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.

type DeliveryCallback

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

type DiscoveredPeer

type DiscoveredPeer = driver.DiscoveredPeer

DiscoveredPeer contains the information of a discovered peer

type Envelope

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

func (*Envelope) Bytes

func (e *Envelope) Bytes() ([]byte, error)

func (*Envelope) Creator

func (e *Envelope) Creator() []byte

func (*Envelope) FromBytes

func (e *Envelope) FromBytes(raw []byte) error

func (*Envelope) MarshalJSON

func (e *Envelope) MarshalJSON() ([]byte, error)

func (*Envelope) Nonce

func (e *Envelope) Nonce() []byte

func (*Envelope) Results

func (e *Envelope) Results() []byte

func (*Envelope) String

func (e *Envelope) String() string

func (*Envelope) TxID

func (e *Envelope) TxID() string

func (*Envelope) UnmarshalJSON

func (e *Envelope) UnmarshalJSON(raw []byte) error

type EnvelopeService

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

func (*EnvelopeService) Exists

func (m *EnvelopeService) Exists(txid string) bool

type EventListener

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

EventListener models the parameters to use for chaincode listening.

func (*EventListener) ChaincodeEvents

func (e *EventListener) ChaincodeEvents() (chan *committer.ChaincodeEvent, error)

ChaincodeEvents returns a channel from which chaincode events emitted by transaction functions in the specified chaincode can be read.

func (*EventListener) CloseChaincodeEvents

func (e *EventListener) CloseChaincodeEvents() error

CloseChaincodeEvents closes the channel from which chaincode events are read.

func (*EventListener) OnReceive

func (e *EventListener) OnReceive(event events.Event)

type Finality

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

func (*Finality) IsFinal

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

func (*Finality) IsFinalForParties

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

type GetIdentityFunc

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

type GetStateOpt

type GetStateOpt int
const (
	FromStorage GetStateOpt = iota
	FromIntermediate
	FromBoth
)

type IdentityInfo

type IdentityInfo struct {
	ID           string
	EnrollmentID string
	GetIdentity  GetIdentityFunc
}

type IdentityOption

type IdentityOption func(*IdentityOptions) error

func WithAuditInfo

func WithAuditInfo(ai []byte) IdentityOption

func WithIdemixEIDExtension

func WithIdemixEIDExtension() IdentityOption

type IdentityOptions

type IdentityOptions struct {
	IdemixEIDExtension bool
	AuditInfo          []byte
}

func CompileIdentityOptions

func CompileIdentityOptions(opts ...IdentityOption) (*IdentityOptions, error)

type IdentityProvider

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

func GetDefaultIdentityProvider

func GetDefaultIdentityProvider(sp view2.ServiceProvider) *IdentityProvider

GetDefaultIdentityProvider returns the identity provider of the default fabric network service

func GetIdentityProvider

func GetIdentityProvider(sp view2.ServiceProvider, network string) *IdentityProvider

GetIdentityProvider returns the identity provider for the passed network

func (*IdentityProvider) DefaultIdentity

func (i *IdentityProvider) DefaultIdentity() view.Identity

func (*IdentityProvider) Identity

func (i *IdentityProvider) Identity(label string) view.Identity

type Ledger

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

Ledger models the ledger stored at a remote Fabric peer

func (*Ledger) GetBlockByNumber

func (l *Ledger) GetBlockByNumber(number uint64) (*Block, error)

GetBlockByNumber fetches a block by number

func (*Ledger) GetBlockNumberByTxID

func (l *Ledger) GetBlockNumberByTxID(txID string) (uint64, error)

GetBlockNumberByTxID returns the number of the block where the passed transaction appears

func (*Ledger) GetTransactionByID

func (l *Ledger) GetTransactionByID(txID string) (*ProcessedTransaction, error)

GetTransactionByID retrieves a transaction by id

type LocalMembership

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

func GetDefaultLocalMembership

func GetDefaultLocalMembership(sp view2.ServiceProvider) *LocalMembership

GetDefaultLocalMembership returns the local membership of the default fabric network service

func GetLocalMembership

func GetLocalMembership(sp view2.ServiceProvider, network string) *LocalMembership

GetLocalMembership returns the local membership for the passed network

func (*LocalMembership) AnonymousIdentity

func (s *LocalMembership) AnonymousIdentity() view.Identity

func (*LocalMembership) DefaultIdentity

func (s *LocalMembership) DefaultIdentity() view.Identity

func (*LocalMembership) DefaultSigningIdentity

func (s *LocalMembership) DefaultSigningIdentity() SigningIdentity

func (*LocalMembership) GetIdentityByID

func (s *LocalMembership) GetIdentityByID(id string) (view.Identity, error)

func (*LocalMembership) GetIdentityInfoByIdentity

func (s *LocalMembership) GetIdentityInfoByIdentity(mspType string, id view.Identity) *IdentityInfo

func (*LocalMembership) GetIdentityInfoByLabel

func (s *LocalMembership) GetIdentityInfoByLabel(mspType string, label string) *IdentityInfo

func (*LocalMembership) IsMe

func (s *LocalMembership) IsMe(id view.Identity) bool

func (*LocalMembership) Refresh

func (s *LocalMembership) Refresh() error

func (*LocalMembership) RegisterIdemixMSP

func (s *LocalMembership) RegisterIdemixMSP(id string, path string, mspID string) error

func (*LocalMembership) RegisterX509MSP

func (s *LocalMembership) RegisterX509MSP(id string, path string, mspID string) error

type MSPManager

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

func (*MSPManager) GetMSPIDs

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

func (*MSPManager) GetMSPIdentifier

func (c *MSPManager) GetMSPIdentifier(sid []byte) (string, error)

func (*MSPManager) GetVerifier

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

func (*MSPManager) IsValid

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

type MetadataService

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

func (*MetadataService) Exists

func (m *MetadataService) Exists(txid string) bool

func (*MetadataService) LoadTransient

func (m *MetadataService) LoadTransient(txid string) (TransientMap, error)

func (*MetadataService) StoreTransient

func (m *MetadataService) StoreTransient(txid string, transientMap TransientMap) error

type NetworkService

type NetworkService struct {
	SP view2.ServiceProvider
	// contains filtered or unexported fields
}

NetworkService models a Fabric Network

func GetDefaultFNS

func GetDefaultFNS(sp view2.ServiceProvider) *NetworkService

GetDefaultFNS returns the default Fabric Network Service

func GetFabricNetworkService

func GetFabricNetworkService(sp view2.ServiceProvider, id string) *NetworkService

GetFabricNetworkService returns the Fabric Network Service for the passed id, nil if not found

func (*NetworkService) Channel

func (n *NetworkService) Channel(id string) (*Channel, error)

Channel returns the channel service for the passed id

func (*NetworkService) Channels

func (n *NetworkService) Channels() []string

Channels returns the channel names

func (*NetworkService) ConfigService

func (n *NetworkService) ConfigService() *ConfigService

func (*NetworkService) DefaultChannel

func (n *NetworkService) DefaultChannel() string

DefaultChannel returns the name of the default channel

func (*NetworkService) IdentityProvider

func (n *NetworkService) IdentityProvider() *IdentityProvider

IdentityProvider returns the identity provider of this network

func (*NetworkService) LocalMembership

func (n *NetworkService) LocalMembership() *LocalMembership

LocalMembership returns the local membership of this network

func (*NetworkService) Name

func (n *NetworkService) Name() string

Name of this network

func (*NetworkService) Ordering

func (n *NetworkService) Ordering() *Ordering

Ordering returns the list of known Orderer nodes

func (*NetworkService) Peers

func (n *NetworkService) Peers() []*grpc.ConnectionConfig

Peers returns the list of known Peer nodes

func (*NetworkService) ProcessorManager

func (n *NetworkService) ProcessorManager() *ProcessorManager

ProcessorManager returns the processor manager of this network

func (*NetworkService) SignerService

func (n *NetworkService) SignerService() *SignerService

SignerService returns the signature service of this network

func (*NetworkService) TransactionManager

func (n *NetworkService) TransactionManager() *TransactionManager

TransactionManager returns the transaction manager of this network

type NetworkServiceProvider

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

func GetNetworkServiceProvider

func GetNetworkServiceProvider(sp view2.ServiceProvider) *NetworkServiceProvider

func NewNetworkServiceProvider

func NewNetworkServiceProvider(sp view2.ServiceProvider) *NetworkServiceProvider

func (*NetworkServiceProvider) FabricNetworkService

func (nsp *NetworkServiceProvider) FabricNetworkService(id string) (*NetworkService, error)

type Ordering

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

func (*Ordering) Broadcast

func (n *Ordering) Broadcast(context context.Context, blob interface{}) error

func (*Ordering) Orderers

func (n *Ordering) Orderers() []*grpc.ConnectionConfig

Orderers returns the list of known Orderer nodes

type ProcessTransaction

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

type ProcessedTransaction

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

ProcessedTransaction models a transaction that has been processed by Fabric

func (*ProcessedTransaction) Results

func (pt *ProcessedTransaction) Results() []byte

Results returns the rwset marshaled

func (*ProcessedTransaction) TxID

func (pt *ProcessedTransaction) TxID() string

TxID returns the transaction's id

func (*ProcessedTransaction) ValidationCode

func (pt *ProcessedTransaction) ValidationCode() int32

ValidationCode of this transaction

type Processor

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

type ProcessorManager

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

func (*ProcessorManager) AddChannelProcessor

func (pm *ProcessorManager) AddChannelProcessor(channel, ns string, p Processor) error

func (*ProcessorManager) AddProcessor

func (pm *ProcessorManager) AddProcessor(ns string, p Processor) error

func (*ProcessorManager) SetDefaultProcessor

func (pm *ProcessorManager) SetDefaultProcessor(p Processor) error

type Proposal

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

func (*Proposal) Header

func (p *Proposal) Header() []byte

func (*Proposal) Payload

func (p *Proposal) Payload() []byte

type ProposalResponse

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

func (*ProposalResponse) Bytes added in v0.2.0

func (r *ProposalResponse) Bytes() ([]byte, error)

func (*ProposalResponse) Endorser

func (r *ProposalResponse) Endorser() []byte

func (*ProposalResponse) EndorserSignature

func (r *ProposalResponse) EndorserSignature() []byte

func (*ProposalResponse) Payload

func (r *ProposalResponse) Payload() []byte

func (*ProposalResponse) ResponseMessage

func (r *ProposalResponse) ResponseMessage() string

func (*ProposalResponse) ResponseStatus

func (r *ProposalResponse) ResponseStatus() int32

func (*ProposalResponse) Results

func (r *ProposalResponse) Results() []byte

type QueryExecutor

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

func (*QueryExecutor) Done

func (qe *QueryExecutor) Done()

func (*QueryExecutor) GetState

func (qe *QueryExecutor) GetState(namespace string, key string) ([]byte, error)

func (*QueryExecutor) GetStateMetadata

func (qe *QueryExecutor) GetStateMetadata(namespace, key string) (map[string][]byte, uint64, uint64, error)

func (*QueryExecutor) GetStateRangeScanIterator

func (qe *QueryExecutor) GetStateRangeScanIterator(namespace string, startKey string, endKey string) (*ResultsIterator, error)

type RWSet

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

func (*RWSet) AppendRWSet

func (r *RWSet) AppendRWSet(raw []byte, nss ...string) error

func (*RWSet) Bytes

func (r *RWSet) Bytes() ([]byte, error)

func (*RWSet) Clear

func (r *RWSet) Clear(ns string) error

func (*RWSet) DeleteState

func (r *RWSet) DeleteState(namespace string, key string) error

DeleteState deletes the given namespace and key

func (*RWSet) Done

func (r *RWSet) Done()

func (*RWSet) Equals

func (r *RWSet) Equals(rws interface{}, nss ...string) error

func (*RWSet) GetReadAt

func (r *RWSet) GetReadAt(ns string, i int) (string, []byte, error)

GetReadAt returns the i-th read (key, value) in the namespace ns of this rwset. The value is loaded from the ledger, if present. If the key's version in the ledger does not match the key's version in the read, then it returns an error.

func (*RWSet) GetReadKeyAt

func (r *RWSet) GetReadKeyAt(ns string, i int) (string, error)

func (*RWSet) GetState

func (r *RWSet) GetState(namespace string, key string, opts ...GetStateOpt) ([]byte, error)

func (*RWSet) GetStateMetadata

func (r *RWSet) GetStateMetadata(namespace, key string, opts ...GetStateOpt) (map[string][]byte, error)

func (*RWSet) GetWriteAt

func (r *RWSet) GetWriteAt(ns string, i int) (string, []byte, error)

GetWriteAt returns the i-th write (key, value) in the namespace ns of this rwset.

func (*RWSet) IsValid

func (r *RWSet) IsValid() error

func (*RWSet) KeyExist

func (r *RWSet) KeyExist(key string, ns string) (bool, error)

KeyExist returns true if a key exist in the rwset otherwise false.

func (*RWSet) Namespaces

func (r *RWSet) Namespaces() []string

Namespaces returns the namespace labels in this rwset.

func (*RWSet) NumReads

func (r *RWSet) NumReads(ns string) int

NumReads returns the number of reads in the namespace ns of this rwset.

func (*RWSet) NumWrites

func (r *RWSet) NumWrites(ns string) int

NumWrites returns the number of writes in the namespace ns of this rwset.

func (*RWSet) RWS

func (r *RWSet) RWS() fdriver.RWSet

func (*RWSet) SetState

func (r *RWSet) SetState(namespace string, key string, value []byte) error

SetState sets the given value for the given namespace and key.

func (*RWSet) SetStateMetadata

func (r *RWSet) SetStateMetadata(namespace, key string, metadata map[string][]byte) error

SetStateMetadata sets the metadata associated with an existing key-tuple <namespace, key>

type Read

type Read driver.VersionedRead

func (*Read) K

func (v *Read) K() string

func (*Read) V

func (v *Read) V() []byte

type Request

type Request interface {
	ID() string
}

type ResultsIterator

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

ResultsIterator models an query result iterator

func (*ResultsIterator) Close

func (r *ResultsIterator) Close()

Close releases resources occupied by the iterator

func (*ResultsIterator) Next

func (r *ResultsIterator) Next() (*Read, error)

Next returns the next item in the result set. The `QueryResult` is expected to be nil when the iterator gets exhausted

type SeekEnd

type SeekEnd struct{}

type SeekPos

type SeekPos struct {
	Txid string
}

type SeekStart

type SeekStart struct{}

type SignedProposal

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

func (*SignedProposal) ChaincodeName

func (p *SignedProposal) ChaincodeName() string

func (*SignedProposal) ChaincodeVersion

func (p *SignedProposal) ChaincodeVersion() string

func (*SignedProposal) ProposalBytes

func (p *SignedProposal) ProposalBytes() []byte

func (*SignedProposal) ProposalHash

func (p *SignedProposal) ProposalHash() []byte

func (*SignedProposal) Signature

func (p *SignedProposal) Signature() []byte

type Signer

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

type SignerService

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

func (*SignerService) GetSigner

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

type SigningIdentity

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

type Transaction

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

func (*Transaction) AppendParameter

func (t *Transaction) AppendParameter(p []byte)

func (*Transaction) AppendProposalResponse

func (t *Transaction) AppendProposalResponse(response *ProposalResponse) error

func (*Transaction) Bytes

func (t *Transaction) Bytes() ([]byte, error)

func (*Transaction) BytesNoTransient

func (t *Transaction) BytesNoTransient() ([]byte, error)

func (*Transaction) Chaincode

func (t *Transaction) Chaincode() string

func (*Transaction) ChaincodeVersion

func (t *Transaction) ChaincodeVersion() string

func (*Transaction) Channel

func (t *Transaction) Channel() string

func (*Transaction) Close

func (t *Transaction) Close()

func (*Transaction) Creator

func (t *Transaction) Creator() view.Identity

func (*Transaction) Done

func (t *Transaction) Done() error

func (*Transaction) Endorse

func (t *Transaction) Endorse() error

func (*Transaction) EndorseProposal

func (t *Transaction) EndorseProposal() error

func (*Transaction) EndorseProposalResponse

func (t *Transaction) EndorseProposalResponse() error

func (*Transaction) EndorseProposalResponseWithIdentity

func (t *Transaction) EndorseProposalResponseWithIdentity(identity view.Identity) error

func (*Transaction) EndorseProposalWithIdentity

func (t *Transaction) EndorseProposalWithIdentity(identity view.Identity) error

func (*Transaction) EndorseWithIdentity

func (t *Transaction) EndorseWithIdentity(identity view.Identity) error

func (*Transaction) EndorseWithSigner

func (t *Transaction) EndorseWithSigner(identity view.Identity, s Signer) error

func (*Transaction) Envelope added in v0.2.0

func (t *Transaction) Envelope() (*Envelope, error)

func (*Transaction) FabricNetworkService

func (t *Transaction) FabricNetworkService() *NetworkService

func (*Transaction) From

func (t *Transaction) From(payload *Transaction) (err error)

func (*Transaction) Function

func (t *Transaction) Function() string

func (*Transaction) GetRWSet

func (t *Transaction) GetRWSet() (*RWSet, error)

func (*Transaction) ID

func (t *Transaction) ID() string

func (*Transaction) Network

func (t *Transaction) Network() string

func (*Transaction) Nonce

func (t *Transaction) Nonce() []byte

func (*Transaction) Parameters

func (t *Transaction) Parameters() [][]byte

func (*Transaction) Proposal

func (t *Transaction) Proposal() *Proposal

func (*Transaction) ProposalHasBeenEndorsedBy

func (t *Transaction) ProposalHasBeenEndorsedBy(party view.Identity) error

func (*Transaction) ProposalResponse

func (t *Transaction) ProposalResponse() ([]byte, error)

func (*Transaction) ProposalResponses

func (t *Transaction) ProposalResponses() []*ProposalResponse

func (*Transaction) RWS

func (t *Transaction) RWS() *RWSet

func (*Transaction) Raw

func (t *Transaction) Raw() ([]byte, error)

func (*Transaction) ResetTransient

func (t *Transaction) ResetTransient()

func (*Transaction) Results

func (t *Transaction) Results() ([]byte, error)

func (*Transaction) SetFromBytes

func (t *Transaction) SetFromBytes(raw []byte) error

func (*Transaction) SetFromEnvelopeBytes

func (t *Transaction) SetFromEnvelopeBytes(raw []byte) error

func (*Transaction) SetParameterAt

func (t *Transaction) SetParameterAt(i int, p []byte) error

func (*Transaction) SetProposal

func (t *Transaction) SetProposal(chaincode string, version string, function string, params ...string)

func (*Transaction) SetRWSet

func (t *Transaction) SetRWSet() error

func (*Transaction) SignedProposal

func (t *Transaction) SignedProposal() *SignedProposal

func (*Transaction) StoreTransient

func (t *Transaction) StoreTransient() error

func (*Transaction) Transient

func (t *Transaction) Transient() TransientMap

type TransactionManager

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

func (*TransactionManager) ComputeTxID

func (t *TransactionManager) ComputeTxID(id *TxID) string

func (*TransactionManager) NewEnvelope

func (t *TransactionManager) NewEnvelope() *Envelope

func (*TransactionManager) NewProposalResponseFromBytes

func (t *TransactionManager) NewProposalResponseFromBytes(raw []byte) (*ProposalResponse, error)

func (*TransactionManager) NewTransaction

func (t *TransactionManager) NewTransaction(opts ...TransactionOption) (*Transaction, error)

func (*TransactionManager) NewTransactionFromBytes

func (t *TransactionManager) NewTransactionFromBytes(raw []byte, opts ...TransactionOption) (*Transaction, error)

type TransactionOption

type TransactionOption func(*TransactionOptions) error

func WithChannel

func WithChannel(channel string) TransactionOption

func WithCreator

func WithCreator(creator view.Identity) TransactionOption

func WithNonce

func WithNonce(nonce []byte) TransactionOption

func WithTxID

func WithTxID(txid string) TransactionOption

type TransactionOptions

type TransactionOptions struct {
	Creator view.Identity
	Nonce   []byte
	TxID    string
	Channel string
}

func CompileTransactionOptions added in v0.2.0

func CompileTransactionOptions(opts ...TransactionOption) (*TransactionOptions, error)

type TransientMap

type TransientMap map[string][]byte

func (TransientMap) Exists

func (m TransientMap) Exists(key string) bool

func (TransientMap) Get

func (m TransientMap) Get(id string) []byte

func (TransientMap) GetState

func (m TransientMap) GetState(key string, state interface{}) error

func (TransientMap) IsEmpty

func (m TransientMap) IsEmpty() bool

func (TransientMap) Set

func (m TransientMap) Set(key string, raw []byte) error

func (TransientMap) SetState

func (m TransientMap) SetState(key string, state interface{}) error

type TxID

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

func (*TxID) String

func (t *TxID) String() string

type TxIDEntry

type TxIDEntry struct {
	Txid string
	Code ValidationCode
}

type TxIDIterator

type TxIDIterator struct {
	fdriver.TxidIterator
}

func (*TxIDIterator) Close

func (t *TxIDIterator) Close()

func (*TxIDIterator) Next

func (t *TxIDIterator) Next() (*TxIDEntry, error)

type TxStatusChangeListener

type TxStatusChangeListener interface {
	// OnStatusChange is called when the status of a transaction changes
	OnStatusChange(txID string, status int) error
}

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

type ValidationCode

type ValidationCode int
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
	HasDependencies                // Transaction is unknown but has known dependencies
)

type Vault

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

Vault models a key-value store that can be updated by committing rwsets

func GetVault

func GetVault(sp view2.ServiceProvider, network, channel string) *Vault

GetVault returns the vualt for the requested channel for the passed network

func (*Vault) CommitTX

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

func (*Vault) DiscardTx

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

func (*Vault) GetEphemeralRWSet

func (c *Vault) GetEphemeralRWSet(rwset []byte, namespaces ...string) (*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 (*Vault) GetLastTxID

func (c *Vault) GetLastTxID() (string, error)

GetLastTxID returns the last transaction id committed

func (*Vault) GetRWSet

func (c *Vault) GetRWSet(txid string, rwset []byte) (*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 (*Vault) NewQueryExecutor

func (c *Vault) NewQueryExecutor() (*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 (*Vault) NewRWSet

func (c *Vault) NewRWSet(txid string) (*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 (*Vault) Status

func (c *Vault) Status(txid string) (ValidationCode, []string, error)

func (*Vault) StoreEnvelope

func (c *Vault) StoreEnvelope(id string, env []byte) error

func (*Vault) StoreTransaction

func (c *Vault) StoreTransaction(id string, raw []byte) error

func (*Vault) StoreTransient

func (c *Vault) StoreTransient(id string, tm TransientMap) error

func (*Vault) TxIDIterator

func (c *Vault) TxIDIterator(pos interface{}) (*TxIDIterator, error)

type Verifier

type Verifier interface {
	// Verify verifies the signature over the passed message.
	Verify(message, sigma []byte) error
}

Verifier is an interface which wraps the Verify method.

Jump to

Keyboard shortcuts

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