fabsdk

package
v1.0.0-beta32 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2020 License: Apache-2.0 Imports: 23 Imported by: 5

Documentation

Overview

Package fabsdk enables client usage of a Hyperledger Fabric network.

Package fabsdk enables client usage of a Hyperledger Fabric network.

Index

Constants

This section is empty.

Variables

View Source
var ErrAnonymousIdentity = errors.New("missing credentials")

ErrAnonymousIdentity is returned when options for identity creation don't include neither username nor identity

Functions

This section is empty.

Types

type ContextOption

type ContextOption func(s *identityOptions) error

ContextOption provides parameters for creating a session (primarily from a fabric identity/user)

func WithIdentity

func WithIdentity(signingIdentity msp.SigningIdentity) ContextOption

WithIdentity uses a pre-constructed identity object as the credential for the session

func WithOrg

func WithOrg(org string) ContextOption

WithOrg uses the named organization

func WithUser

func WithUser(username string) ContextOption

WithUser uses the named user to load the identity

type FabricSDK

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

FabricSDK provides access (and context) to clients being managed by the SDK.

func New

func New(configProvider core.ConfigProvider, opts ...Option) (*FabricSDK, error)

New initializes the SDK based on the set of options provided. ConfigOptions provides the application configuration.

func (*FabricSDK) ChannelContext

func (sdk *FabricSDK) ChannelContext(channelID string, options ...ContextOption) contextApi.ChannelProvider

ChannelContext creates and returns channel context

func (*FabricSDK) Close

func (sdk *FabricSDK) Close()

Close frees up caches and connections being maintained by the SDK

func (*FabricSDK) CloseContext

func (sdk *FabricSDK) CloseContext(ctxt fab.ClientContext)

CloseContext frees up caches being maintained by the SDK for the given context

func (*FabricSDK) Config

func (sdk *FabricSDK) Config() (core.ConfigBackend, error)

Config returns config backend used by all SDK config types

func (*FabricSDK) Context

func (sdk *FabricSDK) Context(options ...ContextOption) contextApi.ClientProvider

Context creates and returns context client which has all the necessary providers

type Option

type Option func(opts *options) error

Option configures the SDK.

func WithCorePkg

func WithCorePkg(core sdkApi.CoreProviderFactory) Option

WithCorePkg injects the core implementation into the SDK.

func WithCryptoSuiteConfig

func WithCryptoSuiteConfig(cryptoConfigs ...interface{}) Option

WithCryptoSuiteConfig injects a CryptoSuiteConfig interface to the SDK it accepts either a full interface of CryptoSuiteConfig or a list of sub interfaces each implementing one (or more) function(s) of CryptoSuiteConfig

func WithEndpointConfig

func WithEndpointConfig(endpointConfigs ...interface{}) Option

WithEndpointConfig injects a EndpointConfig interface to the SDK it accepts either a full interface of EndpointConfig or a list of sub interfaces each implementing one (or more) function(s) of EndpointConfig

func WithErrorHandler

func WithErrorHandler(value fab.ErrorHandler) Option

WithErrorHandler sets an error handler that will be invoked when a service error is experienced. This allows the client to take a decision of whether to ignore the error, shut down the client context, or shut down the entire SDK.

func WithIdentityConfig

func WithIdentityConfig(identityConfigs ...interface{}) Option

WithIdentityConfig injects a IdentityConfig interface to the SDK it accepts either a full interface of IdentityConfig or a list of sub interfaces each implementing one (or more) function(s) of IdentityConfig

func WithLoggerPkg

func WithLoggerPkg(logger api.LoggerProvider) Option

WithLoggerPkg injects the logger implementation into the SDK.

func WithMSPPkg

func WithMSPPkg(msp sdkApi.MSPProviderFactory) Option

WithMSPPkg injects the MSP implementation into the SDK.

func WithMetricsConfig

func WithMetricsConfig(metricsConfigs ...interface{}) Option

WithMetricsConfig injects a MetricsConfig interface to the SDK it accepts either a full interface of MetricsConfig or a list of sub interfaces each implementing one (or more) function(s) of MetricsConfig

func WithProviderOpts

func WithProviderOpts(sopts ...coptions.Opt) Option

WithProviderOpts adds options which are propagated to the various providers.

func WithServicePkg

func WithServicePkg(service sdkApi.ServiceProviderFactory) Option

WithServicePkg injects the service implementation into the SDK.

Directories

Path Synopsis
factory
cfg
provider
test
mocksdkapi
Package mocksdkapi is a generated GoMock package.
Package mocksdkapi is a generated GoMock package.

Jump to

Keyboard shortcuts

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