Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultCommitHandlers = &list{ None: nil, OrgAll: orgAll, OrgAny: orgAny, NetworkAll: networkAll, NetworkAny: networkAny, }
DefaultCommitHandlers provides the built-in commit handler implementations.
Functions ¶
This section is empty.
Types ¶
type CommitHandler ¶
type CommitHandler interface { StartListening() WaitForEvents(int64) CancelListening() }
CommitHandler is currently unimplemented
type CommitHandlerFactory ¶
type CommitHandlerFactory interface {
Create(string, Network) CommitHandler
}
CommitHandlerFactory is currently unimplemented
type ConfigOption ¶
ConfigOption specifies the gateway configuration source.
func WithConfig ¶
func WithConfig(config core.ConfigProvider) ConfigOption
WithConfig configures the gateway from a network config, such as a ccp file.
func WithSDK ¶
func WithSDK(sdk *fabsdk.FabricSDK) ConfigOption
WithSDK configures the gateway with the configuration from an existing FabricSDK instance
type Contract ¶
type Contract struct {
// contains filtered or unexported fields
}
A Contract object represents a smart contract instance in a network. Applications should get a Contract instance from a Network using the GetContract method
func (*Contract) CreateTransaction ¶
func (c *Contract) CreateTransaction(name string, args ...TransactionOption) (*Transaction, error)
CreateTransaction creates an object representing a specific invocation of a transaction function implemented by this contract, and provides more control over the transaction invocation using the optional arguments. A new transaction object must be created for each transaction invocation.
func (*Contract) EvaluateTransaction ¶
EvaluateTransaction will evaluate a transaction function and return its results. The transaction function 'name' will be evaluated on the endorsing peers but the responses will not be sent to the ordering service and hence will not be committed to the ledger. This can be used for querying the world state.
func (*Contract) SubmitTransaction ¶
SubmitTransaction will submit a transaction to the ledger. The transaction function 'name' will be evaluated on the endorsing peers and then submitted to the ordering service for committing to the ledger.
type Gateway ¶
type Gateway struct {
// contains filtered or unexported fields
}
Gateway is the entry point to a Fabric network
func Connect ¶
func Connect(config ConfigOption, identity IdentityOption, options ...Option) (*Gateway, error)
Connect to a gateway defined by a network config file. Must specify a config option, an identity option and zero or more strategy options.
type Identity ¶
type Identity interface {
// contains filtered or unexported methods
}
Identity represents a specific identity format
type IdentityOption ¶
IdentityOption specifies the user identity under which all transactions are performed for this gateway instance.
func WithIdentity ¶
func WithIdentity(wallet wallet, label string) IdentityOption
WithIdentity is an optional argument to the Connect method which specifies the identity that is to be used to connect to the network. All operations under this gateway connection will be performed using this identity.
func WithUser ¶
func WithUser(user string) IdentityOption
WithUser is an optional argument to the Connect method which specifies the identity that is to be used to connect to the network. All operations under this gateway connection will be performed using this identity.
type Network ¶
type Network struct {
// contains filtered or unexported fields
}
A Network object represents the set of peers in a Fabric network (channel). Applications should get a Network instance from a Gateway using the GetNetwork method.
func (*Network) GetContract ¶
GetContract returns instance of a smart contract on the current network.
type Option ¶
Option functional arguments can be supplied when connecting to the gateway.
func WithCommitHandler ¶
func WithCommitHandler(handler CommitHandlerFactory) Option
WithCommitHandler is an optional argument to the Connect method which allows an alternative commit handler to be specified. The commit handler defines how client code should wait to receive commit events from peers following submit of a transaction. Currently unimplemented.
func WithDiscovery ¶
WithDiscovery is an optional argument to the Connect method which enables or disables service discovery for all transaction submissions for this gateway.
type Transaction ¶
type Transaction struct {
// contains filtered or unexported fields
}
A Transaction represents a specific invocation of a transaction function, and provides flexibility over how that transaction is invoked. Applications should obtain instances of this class from a Contract using the Contract.CreateTransaction method.
Instances of this class are stateful. A new instance <strong>must</strong> be created for each transaction invocation.
func (*Transaction) Evaluate ¶
func (txn *Transaction) Evaluate(args ...string) ([]byte, error)
Evaluate a transaction function and return its results. The transaction function will be evaluated on the endorsing peers but the responses will not be sent to the ordering service and hence will not be committed to the ledger. This can be used for querying the world state.
type TransactionOption ¶
type TransactionOption = func(*Transaction) error
TransactionOption functional arguments can be supplied when creating a transaction object
func WithEndorsingPeers ¶
func WithEndorsingPeers(peers ...string) TransactionOption
WithEndorsingPeers is an optional argument to the CreateTransaction method which sets the peers that should be used for endorsement of transaction submitted to the ledger using Submit()
func WithTransient ¶
func WithTransient(data map[string][]byte) TransactionOption
WithTransient is an optional argument to the CreateTransaction method which sets the transient data that will be passed to the transaction function but will not be stored on the ledger. This can be used to pass private data to a transaction function.
type Wallet ¶
type Wallet struct {
// contains filtered or unexported fields
}
A Wallet stores identity information used to connect to a Hyperledger Fabric network. Instances are created using factory methods on the implementing objects.
func NewFileSystemWallet ¶
NewFileSystemWallet creates an instance of a wallet, held in memory. This implementation is not backed by a persistent store.
func NewInMemoryWallet ¶
func NewInMemoryWallet() *Wallet
NewInMemoryWallet creates an instance of a wallet, backed by files on the filesystem
func (*Wallet) Get ¶
Get an identity from the wallet. The implementation class of the identity object will vary depending on its type.
type WalletStore ¶
type WalletStore interface { Put(label string, stream []byte) error Get(label string) ([]byte, error) List() ([]string, error) Exists(label string) bool Remove(label string) error }
WalletStore is the interface for implementations that provide backing storage for identities in a wallet. To create create a new backing store, implement all the methods defined in this interface and provide a factory method that wraps an instance of this in a new Wallet object. E.g:
func NewMyWallet() *Wallet { store := &myWalletStore{ } return &Wallet{store} }
type X509Identity ¶
type X509Identity struct { Version int `json:"version"` MspID string `json:"mspId"` IDType string `json:"type"` Credentials credentials `json:"credentials"` }
X509Identity represents an X509 identity
func NewX509Identity ¶
func NewX509Identity(mspid string, cert string, key string) *X509Identity
NewX509Identity creates an X509 identity for storage in a wallet
func (*X509Identity) Certificate ¶
func (x *X509Identity) Certificate() string
Certificate returns the X509 certificate PEM