fab

package
v1.0.0-alpha3 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2018 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const EmptyTransactionID = TransactionID("")

EmptyTransactionID represents a non-existing transaction (usually due to error).

View Source
const SystemChannel = ""

SystemChannel is the Fabric channel for managaing resources.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockEvent

type BlockEvent struct {
	// Block is the block that was committed
	Block *cb.Block
}

BlockEvent contains the data for the block event

type BlockFilter

type BlockFilter func(block *cb.Block) bool

BlockFilter is a function that determines whether a Block event should be ignored

type BlockchainInfoResponse

type BlockchainInfoResponse struct {
	BCI      *common.BlockchainInfo
	Endorser string
	Status   int32
}

BlockchainInfoResponse wraps blockchain info with endorser info

type CCEvent

type CCEvent struct {
	// TxID is the ID of the transaction in which the event was set
	TxID string
	// ChaincodeID is the ID of the chaincode that set the event
	ChaincodeID string
	// EventName is the name of the chaincode event
	EventName string
	// Payload contains the payload of the chaincode event
	// NOTE: Payload will be nil for filtered events
	Payload []byte
}

CCEvent contains the data for a chaincode event

type ChaincodeInvokeRequest

type ChaincodeInvokeRequest struct {
	ChaincodeID  string
	TransientMap map[string][]byte
	Fcn          string
	Args         [][]byte
}

ChaincodeInvokeRequest contains the parameters for sending a transaction proposal.

type ChannelCfg

type ChannelCfg interface {
	ID() string
	MSPs() []*mspCfg.MSPConfig
	AnchorPeers() []*OrgAnchorPeer
	Orderers() []string
	Versions() *Versions
}

ChannelCfg contains channel configuration

type ChannelConfig

type ChannelConfig interface {

	// Query channel configuration
	Query(reqCtx reqContext.Context) (ChannelCfg, error)
}

ChannelConfig allows for interaction with peer regarding channel configuration

type ChannelMembership

type ChannelMembership interface {
	// Validate if the given ID was issued by the channel's members
	Validate(serializedID []byte) error
	// Verify the given signature
	Verify(serializedID []byte, msg []byte, sig []byte) error
}

ChannelMembership helps identify a channel's members

type ChannelProvider

type ChannelProvider interface {
	ChannelService(ctx ClientContext, channelID string) (ChannelService, error)
}

ChannelProvider supplies Channel related-objects for the named channel.

type ChannelService

type ChannelService interface {
	Config() (ChannelConfig, error)
	EventService() (EventService, error)
	Membership() (ChannelMembership, error)
	ChannelConfig() (ChannelCfg, error)
}

ChannelService supplies services related to a channel.

type ClientContext

type ClientContext interface {
	core.Providers
	msp.Providers
	Providers
	msp.SigningIdentity
}

ClientContext contains the client context TODO: This is a duplicate of context.Client since importing context.Client causes a circular import error. This problem should be addressed in a future patch.

type CommManager

type CommManager interface {
	DialContext(ctx reqContext.Context, target string, opts ...grpc.DialOption) (*grpc.ClientConn, error)
	ReleaseConn(conn *grpc.ClientConn)
}

CommManager enables network communication.

type ConnectionEvent

type ConnectionEvent struct {
	Connected bool
	Err       error
}

ConnectionEvent is sent when the client disconnects from or reconnects to the event server. Connected == true means that the client has connected, whereas Connected == false means that the client has disconnected. In the disconnected case, Err contains the disconnect error.

type DiscoveryProvider

type DiscoveryProvider interface {
	CreateDiscoveryService(channelID string) (DiscoveryService, error)
}

DiscoveryProvider is used to discover peers on the network

type DiscoveryService

type DiscoveryService interface {
	GetPeers() ([]Peer, error)
}

DiscoveryService is used to discover eligible peers on specific channel

type EventClient

type EventClient interface {
	EventService

	// Connect connects to the event server.
	Connect() error

	// Close closes the connection to the event server and releases all resources.
	// Once this function is invoked the client may no longer be used.
	Close()

	// CloseIfIdle closes the connection to the event server only if there are no outstanding
	// registrations.
	// Returns true if the client was closed. In this case the client may no longer be used.
	// A return value of false indicates that the client could not be closed since
	// there was at least one registration.
	CloseIfIdle() bool
}

EventClient is a client that connects to a peer and receives channel events such as block, filtered block, chaincode, and transaction status events.

type EventService

type EventService interface {
	// RegisterBlockEvent registers for block events. If the caller does not have permission
	// to register for block events then an error is returned.
	// Note that Unregister must be called when the registration is no longer needed.
	// - filter is an optional filter that filters out unwanted events. (Note: Only one filter may be specified.)
	// - Returns the registration and a channel that is used to receive events. The channel
	//   is closed when Unregister is called.
	RegisterBlockEvent(filter ...BlockFilter) (Registration, <-chan *BlockEvent, error)

	// RegisterFilteredBlockEvent registers for filtered block events.
	// Note that Unregister must be called when the registration is no longer needed.
	// - Returns the registration and a channel that is used to receive events. The channel
	//   is closed when Unregister is called.
	RegisterFilteredBlockEvent() (Registration, <-chan *FilteredBlockEvent, error)

	// RegisterChaincodeEvent registers for chaincode events.
	// Note that Unregister must be called when the registration is no longer needed.
	// - ccID is the chaincode ID for which events are to be received
	// - eventFilter is the chaincode event filter (regular expression) for which events are to be received
	// - Returns the registration and a channel that is used to receive events. The channel
	//   is closed when Unregister is called.
	RegisterChaincodeEvent(ccID, eventFilter string) (Registration, <-chan *CCEvent, error)

	// RegisterTxStatusEvent registers for transaction status events.
	// Note that Unregister must be called when the registration is no longer needed.
	// - txID is the transaction ID for which events are to be received
	// - Returns the registration and a channel that is used to receive events. The channel
	//   is closed when Unregister is called.
	RegisterTxStatusEvent(txID string) (Registration, <-chan *TxStatusEvent, error)

	// Unregister removes the given registration and closes the event channel.
	// - reg is the registration handle that was returned from one of the Register functions
	Unregister(reg Registration)
}

EventService is a service that receives events such as block, filtered block, chaincode, and transaction status events.

type FilteredBlockEvent

type FilteredBlockEvent struct {
	// FilteredBlock contains a filtered version of the block that was committed
	FilteredBlock *pb.FilteredBlock
}

FilteredBlockEvent contains the data for a filtered block event

type InfraProvider

type InfraProvider interface {
	CreateChannelConfig(name string) (ChannelConfig, error)
	CreateChannelCfg(ctx ClientContext, channelID string) (ChannelCfg, error)
	CreateChannelTransactor(reqCtx reqContext.Context, cfg ChannelCfg) (Transactor, error)
	CreateChannelMembership(ctx ClientContext, channelID string) (ChannelMembership, error)
	CreateEventService(ctx ClientContext, channelID string) (EventService, error)
	CreatePeerFromConfig(peerCfg *core.NetworkPeer) (Peer, error)
	CreateOrdererFromConfig(cfg *core.OrdererConfig) (Orderer, error)
	CommManager() CommManager
	Close()
}

InfraProvider enables access to fabric objects such as peer and user based on config or

type Orderer

type Orderer interface {
	URL() string
	SendBroadcast(ctx reqContext.Context, envelope *SignedEnvelope) (*common.Status, error)
	SendDeliver(ctx reqContext.Context, envelope *SignedEnvelope) (chan *common.Block, chan error)
}

Orderer The Orderer class represents a peer in the target blockchain network to which HFC sends a block of transactions of endorsed proposals requiring ordering.

type OrgAnchorPeer

type OrgAnchorPeer struct {
	Org  string
	Host string
	Port int32
}

OrgAnchorPeer contains information about an anchor peer on this channel

type Peer

type Peer interface {
	ProposalProcessor
	// MSPID gets the Peer mspID.
	MSPID() string

	//URL gets the peer address
	URL() string
}

The Peer class represents a peer in the target blockchain network to which HFC sends endorsement proposals or query requests.

type ProcessProposalRequest

type ProcessProposalRequest struct {
	SignedProposal *pb.SignedProposal
}

ProcessProposalRequest requests simulation of a proposed transaction from transaction processors.

type ProposalProcessor

type ProposalProcessor interface {
	ProcessTransactionProposal(reqContext.Context, ProcessProposalRequest) (*TransactionProposalResponse, error)
}

ProposalProcessor simulates transaction proposal, so that a client can submit the result for ordering.

type ProposalSender

type ProposalSender interface {
	CreateTransactionHeader() (TransactionHeader, error)
	SendTransactionProposal(*TransactionProposal, []ProposalProcessor) ([]*TransactionProposalResponse, error)
}

ProposalSender provides the ability for a transaction proposal to be created and sent.

type Providers

type Providers interface {
	DiscoveryProvider() DiscoveryProvider
	SelectionProvider() SelectionProvider
	ChannelProvider() ChannelProvider
	InfraProvider() InfraProvider
}

Providers represents the SDK configured service providers context.

type Registration

type Registration interface{}

Registration is a handle that is returned from a successful RegisterXXXEvent. This handle should be used in Unregister in order to unregister the event.

type SelectionProvider

type SelectionProvider interface {
	CreateSelectionService(channelID string) (SelectionService, error)
}

SelectionProvider is used to select peers for endorsement

type SelectionService

type SelectionService interface {
	// GetEndorsersForChaincode returns a set of peers that should satisfy the endorsement
	// policies of all of the given chaincodes.
	// A set of options may be provided to the selection service. Note that the type of options
	// may vary depending on the specific selection service implementation.
	GetEndorsersForChaincode(chaincodeIDs []string, opts ...options.Opt) ([]Peer, error)
}

SelectionService selects peers for endorsement and commit events

type Sender

type Sender interface {
	CreateTransaction(request TransactionRequest) (*Transaction, error)
	SendTransaction(tx *Transaction) (*TransactionResponse, error)
}

Sender provides the ability for a transaction to be created and sent.

TODO: CreateTransaction should be refactored as it is actually a factory method.

type SignedEnvelope

type SignedEnvelope struct {
	Payload   []byte
	Signature []byte
}

A SignedEnvelope can can be sent to an orderer for broadcasting

type TargetFilter

type TargetFilter interface {
	// Accept returns true if peer should be included in the list of target peers
	Accept(peer Peer) bool
}

TargetFilter allows for filtering target peers

type Transaction

type Transaction struct {
	Proposal    *TransactionProposal
	Transaction *pb.Transaction
}

The Transaction object created from an endorsed proposal.

type TransactionHeader

type TransactionHeader interface {
	TransactionID() TransactionID
	Creator() []byte
	Nonce() []byte
	ChannelID() string
}

TransactionHeader provides a handle to transaction metadata.

type TransactionID

type TransactionID string

TransactionID provides the identifier of a Fabric transaction proposal.

type TransactionProposal

type TransactionProposal struct {
	TxnID TransactionID
	*pb.Proposal
}

TransactionProposal contains a marashalled transaction proposal.

type TransactionProposalResponse

type TransactionProposalResponse struct {
	Endorser string
	Status   int32
	*pb.ProposalResponse
}

TransactionProposalResponse respresents the result of transaction proposal processing.

type TransactionRequest

type TransactionRequest struct {
	Proposal          *TransactionProposal
	ProposalResponses []*TransactionProposalResponse
}

TransactionRequest holds endorsed Transaction Proposals.

type TransactionResponse

type TransactionResponse struct {
	Orderer string
}

TransactionResponse contains information returned by the orderer.

type Transactor

type Transactor interface {
	Sender
	ProposalSender
}

Transactor supplies methods for sending transaction proposals and transactions.

type TxStatusEvent

type TxStatusEvent struct {
	// TxID is the ID of the transaction in which the event was set
	TxID string
	// TxValidationCode is the status code of the commit
	TxValidationCode pb.TxValidationCode
}

TxStatusEvent contains the data for a transaction status event

type Versions

type Versions struct {
	ReadSet  *common.ConfigGroup
	WriteSet *common.ConfigGroup
	Channel  *common.ConfigGroup
}

Versions ...

Jump to

Keyboard shortcuts

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