fabsdk

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: 16 Imported by: 0

Documentation

Overview

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

func WithConfig

func WithConfig(config core.Config) core.ConfigProvider

WithConfig converts a Config interface to a ConfigProvider. This is a helper function for those who already loaded the config prior to instantiating the SDK.

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(cp core.ConfigProvider, opts ...Option) (*FabricSDK, error)

New initializes the SDK based on the set of options provided. configProvider 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) Config

func (sdk *FabricSDK) Config() core.Config

Config returns the SDK's configuration.

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 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 WithServicePkg

func WithServicePkg(service sdkApi.ServiceProviderFactory) Option

WithServicePkg injects the service implementation into the SDK.

Directories

Path Synopsis
factory
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