api

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2017 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CCDataProvider

type CCDataProvider interface {
	QueryChaincodeData(channelID string, chaincodeID string) (*ccprovider.ChaincodeData, error)
}

CCDataProvider retrieves Chaincode Data for the given chaincode ID on the given channel

type ChannelMembership

type ChannelMembership struct {
	// Peers on the channel
	Peers []sdkApi.Peer
	// PollingEnabled is polling for membership enabled for this channel
	PollingEnabled bool
	// QueryError Error from the last query/polling operation
	QueryError error
}

ChannelMembership defines membership for a channel

type Client

type Client interface {
	// NewChannel registers a channel object with the fabric client
	// this object represents a channel on the fabric network
	// @param {string} name of the channel
	// @returns {Channel} channel object
	// @returns {error} error, if any
	NewChannel(string) (sdkApi.Channel, error)

	// GetChannel returns a channel object that has been added to the fabric client
	// @param {string} name of the channel
	// @returns {Channel} channel that was requested
	// @returns {error} error, if any
	GetChannel(string) (sdkApi.Channel, error)

	// EndorseTransaction request endorsement from the peers on this channel
	// for a transaction with the given parameters
	// @param {Channel} channel on which we want to transact
	// @param {string} chaincodeID identifies the chaincode to invoke
	// @param {[]string} args to pass to the chaincode. Args[0] is the function name
	// @param {[]Peer} (optional) targets for transaction
	// @param {map[string][]byte} transientData map
	// @param {[]string} ccIDs For Endorsement selection
	// @returns {[]TransactionProposalResponse} responses from endorsers
	// @returns {error} error, if any
	EndorseTransaction(sdkApi.Channel, string, []string, map[string][]byte,
		[]sdkApi.Peer, []string) ([]*apitxn.TransactionProposalResponse, error)

	// CommitTransaction submits the given endorsements on the specified channel for
	// commit
	// @param {Channel} channel on which the transaction is taking place
	// @param {[]TransactionProposalResponse} responses from endorsers
	// @param {bool} register for Tx event
	// @param {time.Duration} register for Tx event timeout in seconds
	// @returns {error} error, if any
	CommitTransaction(sdkApi.Channel, []*apitxn.TransactionProposalResponse, bool, time.Duration) error

	// QueryChannels joined by the given peer
	// @param {Peer} The peer to query
	// @returns {[]string} list of channels
	// @returns {error} error, if any
	QueryChannels(PeerConfig) ([]string, error)

	// VerifyTxnProposalSignature verify TxnProposalSignature against msp
	// @param {Channel} channel on which the transaction is taking place
	// @param {[]byte} Txn Proposal
	// @returns {error} error, if any
	VerifyTxnProposalSignature(sdkApi.Channel, []byte) error

	// SetSelectionService is used to inject a selection service for testing
	// @param {SelectionService} SelectionService
	SetSelectionService(SelectionService)

	// GetSelectionService returns the SelectionService
	GetSelectionService() SelectionService

	// GetEventHub returns the GetEventHub
	// @returns {EventHub} EventHub
	// @returns {error} error, if any
	GetEventHub() (sdkApi.EventHub, error)

	// Hash message
	// @param {[]byte} message to hash
	// @returns {[[]byte} hash
	// @returns {error} error, if any
	Hash([]byte) ([]byte, error)

	// InitializeChannel initializes the given channel
	// @param {Channel} Channel that needs to be initialized
	// @returns {error} error, if any
	InitializeChannel(channel sdkApi.Channel) error

	// GetConfig get client config
	// @returns {Config} config
	GetConfig() sdkConfigApi.Config

	// GetUser returns the user from the client context
	// @retruns {User} user
	GetUser() sdkApi.User
}

Client is a wrapper interface around the fabric client It enables multithreaded access to the client

type ClientService

type ClientService interface {
	GetFabricClient(config Config) (Client, error)
	GetClientMembership(config Config) MembershipManager
}

ClientService interface

type Collapsable

type Collapsable interface {
	// Collapse converts a hierarchical group into a single-level group (if possible).
	// For example, say G = (A and (B and C) and (D and E) and (F or G))
	// then G.Collapse() = (A and B and C and D and E and (F or G))
	Collapse() Group
}

Collapsable is implemented by any group that can collapse into a simple (non-hierarchical) Group

type Config

type Config interface {
	GetLocalPeer() (*PeerConfig, error)
	GetMspID() string
	GetTLSRootCertPath() string
	GetTLSCertPath() string
	GetTLSKeyPath() string
	GetMembershipPollInterval() time.Duration
	GetGRPCProtocol() string
	GetConfigPath(path string) string
	GetPeerConfig() *viper.Viper
}

Config configuration interface

type Group

type Group interface {
	// Items returns all of the items
	Items() []Item

	// Equals returns true if this Group contains the same items as the given Group
	Equals(other Group) bool

	// Reduce reduces the group (which may be a hierarchy of groups) into a simple, non-hierarchical set of groups.
	// For example, given the group, G=(A and (B or C or D))
	// then G.Reduce() = [(A and B) or (A and C) or (A and D)]
	Reduce() []Group
}

Group contains a group of Items

type GroupOfGroups

type GroupOfGroups interface {
	// GroupOfGroups is also a Group
	Group

	// Groups returns all of the groups in this container
	Groups() []Group

	// Nof returns a set of groups that includes all possible combinations for the given threshold.
	// For example, given the group-of-groups, G=(G1, G2, G3), where G1=(A or B), G2=(C or D), G3=(E or F),
	// then:
	// - G.Nof(1) = (G1 or G2 or G3)
	// - G.Nof(2) = ((G1 and G2) or (G1 and G3) or (G2 and G3)
	// - G.Nof(3) = (G1 and G2 and G3)
	Nof(threshold int32) (GroupOfGroups, error)
}

GroupOfGroups contains a set of groups.

type Item

type Item interface {
}

Item represents any item

type LoadBalancePolicy

type LoadBalancePolicy interface {
	// Choose returns one of the peer groups from the given set of peer groups.
	// This method should never return nil but may return a PeerGroup that contains no peers.
	Choose(peerGroups []PeerGroup) PeerGroup
}

LoadBalancePolicy is used to pick a peer group from a given set of peer groups

type MembershipManager

type MembershipManager interface {
	// GetPeersOfChannel returns the peers on the given channel. It returns
	// ChannelMembership.QueryError is there was an error querying or polling
	// peers on the channel. It also returns the last known membership list
	// in case there was a polling error
	// @param {string} name of the channel
	// @param {bool} enable membership polling for this channel
	// @returns {ChannelMembership} channel membership object
	GetPeersOfChannel(string, bool) ChannelMembership
}

MembershipManager maintains a peer membership lists on channels

type PeerConfig

type PeerConfig struct {
	Host      string
	Port      int
	EventHost string
	EventPort int
	MSPid     []byte
}

PeerConfig represents the server addresses of a fabric peer

type PeerGroup

type PeerGroup interface {
	Group
	Peers() []sdkApi.Peer
}

PeerGroup contains a group of Peers

type PeerGroupResolver

type PeerGroupResolver interface {
	// Resolve returns a PeerGroup ensuring that all of the peers in the group are
	// in the given set of available peers
	// This method should never return nil but may return a PeerGroup that contains no peers.
	Resolve() PeerGroup
}

PeerGroupResolver resolves a group of peers that would (exactly) satisfy a chaincode's endorsement policy.

type PeerRetriever

type PeerRetriever func(mspID string) []sdkApi.Peer

PeerRetriever is a function that retuens a set of peers for the given MSP ID

type SelectionService

type SelectionService interface {
	// GetEndorsersForChaincode returns a set of peers that should satisfy the endorsement
	// policies of all of the given chaincodes
	GetEndorsersForChaincode(channelID string, chaincodeIDs ...string) ([]sdkApi.Peer, error)
	GetPeerForEvents(channelID string) (*PeerConfig, error)
}

SelectionService selects peers for endorsement and commit events

type SignaturePolicyCompiler

type SignaturePolicyCompiler interface {
	Compile(sigPolicyEnv *common.SignaturePolicyEnvelope) (GroupOfGroups, error)
}

SignaturePolicyCompiler compiles a signature policy envelope and returns a peer group hierarchy

type SignaturePolicyFunc

type SignaturePolicyFunc func() (GroupOfGroups, error)

SignaturePolicyFunc is a function that evaluates a signature policy and returns a peer group hierarchy

type SnapTransactionRequest

type SnapTransactionRequest struct {
	ChannelID           string            // required channel ID
	ChaincodeID         string            // required chaincode ID
	TransientMap        map[string][]byte // optional transient Map
	EndorserArgs        [][]byte          // optional args for endorsement
	CCIDsForEndorsement []string          // optional ccIDs For endorsement selection
	RegisterTxEvent     bool              // optional args for register Tx event (default is false)
}

SnapTransactionRequest type will be passed as argument to a transaction snap ChannelID and ChaincodeID are mandatory fields

Directories

Path Synopsis
Package membership is a generated protocol buffer package.
Package membership is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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