service

package
v0.6.5 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2019 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const CtxSignerKey = `SigningIdentity`

Variables

View Source
var (
	// ErrChaincodeNotExists occurs when attempting to invoke a nonexostent external chaincode
	ErrChaincodeNotExists = errors.New(`chaincode not exists`)

	// ErrSignerNotDefinedInContext msp.SigningIdentity is not defined in context
	ErrSignerNotDefinedInContext = errors.New(`signer is not defined in context`)

	// ErrUnknownInvocationType query or invoke
	ErrUnknownInvocationType = errors.New(`unknown invocation type`)
)
View Source
var InvocationType_name = map[int32]string{
	0: "QUERY",
	1: "INVOKE",
}
View Source
var InvocationType_value = map[string]int32{
	"QUERY":  0,
	"INVOKE": 1,
}

Functions

func ContextWithDefaultSigner

func ContextWithDefaultSigner(ctx context.Context, defaultSigner msp.SigningIdentity) context.Context

func ContextWithSigner

func ContextWithSigner(ctx context.Context, signer msp.SigningIdentity) context.Context

func RegisterChaincodeServer

func RegisterChaincodeServer(s *grpc.Server, srv ChaincodeServer)

func SignerFromContext

func SignerFromContext(ctx context.Context) (msp.SigningIdentity, error)

Types

type Chaincode

type Chaincode = ChaincodeServer

Chaincode service interface

type ChaincodeClient

type ChaincodeClient interface {
	// Exec: Query or Invoke
	Exec(ctx context.Context, in *ChaincodeExec, opts ...grpc.CallOption) (*peer.ProposalResponse, error)
	// Query chaincode on home peer. Do NOT send to orderer.
	Query(ctx context.Context, in *ChaincodeInput, opts ...grpc.CallOption) (*peer.ProposalResponse, error)
	// Invoke chaincode on peers, according to endorsement policy and the SEND to orderer
	Invoke(ctx context.Context, in *ChaincodeInput, opts ...grpc.CallOption) (*peer.ProposalResponse, error)
	// Chaincode events stream
	Events(ctx context.Context, in *ChaincodeLocator, opts ...grpc.CallOption) (Chaincode_EventsClient, error)
}

ChaincodeClient is the client API for Chaincode service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewChaincodeClient

func NewChaincodeClient(cc *grpc.ClientConn) ChaincodeClient

type ChaincodeEventsServer

type ChaincodeEventsServer = chaincodeEventsServer

type ChaincodeExec added in v0.6.4

type ChaincodeExec struct {
	Type                 InvocationType  `protobuf:"varint,1,opt,name=type,proto3,enum=service.InvocationType" json:"type,omitempty"`
	Input                *ChaincodeInput `protobuf:"bytes,2,opt,name=input,proto3" json:"input,omitempty"`
	XXX_NoUnkeyedLiteral struct{}        `json:"-"`
	XXX_unrecognized     []byte          `json:"-"`
	XXX_sizecache        int32           `json:"-"`
}

func (*ChaincodeExec) Descriptor added in v0.6.4

func (*ChaincodeExec) Descriptor() ([]byte, []int)

func (*ChaincodeExec) GetInput added in v0.6.4

func (m *ChaincodeExec) GetInput() *ChaincodeInput

func (*ChaincodeExec) GetType added in v0.6.4

func (m *ChaincodeExec) GetType() InvocationType

func (*ChaincodeExec) ProtoMessage added in v0.6.4

func (*ChaincodeExec) ProtoMessage()

func (*ChaincodeExec) Reset added in v0.6.4

func (m *ChaincodeExec) Reset()

func (*ChaincodeExec) String added in v0.6.4

func (m *ChaincodeExec) String() string

func (*ChaincodeExec) Validate added in v0.6.4

func (this *ChaincodeExec) Validate() error

func (*ChaincodeExec) XXX_DiscardUnknown added in v0.6.4

func (m *ChaincodeExec) XXX_DiscardUnknown()

func (*ChaincodeExec) XXX_Marshal added in v0.6.4

func (m *ChaincodeExec) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ChaincodeExec) XXX_Merge added in v0.6.4

func (m *ChaincodeExec) XXX_Merge(src proto.Message)

func (*ChaincodeExec) XXX_Size added in v0.6.4

func (m *ChaincodeExec) XXX_Size() int

func (*ChaincodeExec) XXX_Unmarshal added in v0.6.4

func (m *ChaincodeExec) XXX_Unmarshal(b []byte) error

type ChaincodeInput

type ChaincodeInput struct {
	// Chaincode name
	Chaincode string `protobuf:"bytes,1,opt,name=chaincode,proto3" json:"chaincode,omitempty"`
	// Channel name
	Channel string `protobuf:"bytes,2,opt,name=channel,proto3" json:"channel,omitempty"`
	// Input contains the arguments for invocation.
	Args [][]byte `protobuf:"bytes,3,rep,name=args,proto3" json:"args,omitempty"`
	// TransientMap contains data (e.g. cryptographic material) that might be used
	// to implement some form of application-level confidentiality. The contents
	// of this field are supposed to always be omitted from the transaction and
	// excluded from the ledger.
	Transient            map[string][]byte `` /* 159-byte string literal not displayed */
	XXX_NoUnkeyedLiteral struct{}          `json:"-"`
	XXX_unrecognized     []byte            `json:"-"`
	XXX_sizecache        int32             `json:"-"`
}

func (*ChaincodeInput) Descriptor

func (*ChaincodeInput) Descriptor() ([]byte, []int)

func (*ChaincodeInput) GetArgs

func (m *ChaincodeInput) GetArgs() [][]byte

func (*ChaincodeInput) GetChaincode

func (m *ChaincodeInput) GetChaincode() string

func (*ChaincodeInput) GetChannel

func (m *ChaincodeInput) GetChannel() string

func (*ChaincodeInput) GetTransient

func (m *ChaincodeInput) GetTransient() map[string][]byte

func (*ChaincodeInput) ProtoMessage

func (*ChaincodeInput) ProtoMessage()

func (*ChaincodeInput) Reset

func (m *ChaincodeInput) Reset()

func (*ChaincodeInput) String

func (m *ChaincodeInput) String() string

func (*ChaincodeInput) Validate

func (this *ChaincodeInput) Validate() error

func (*ChaincodeInput) XXX_DiscardUnknown added in v0.6.1

func (m *ChaincodeInput) XXX_DiscardUnknown()

func (*ChaincodeInput) XXX_Marshal added in v0.6.1

func (m *ChaincodeInput) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ChaincodeInput) XXX_Merge added in v0.6.1

func (m *ChaincodeInput) XXX_Merge(src proto.Message)

func (*ChaincodeInput) XXX_Size added in v0.6.1

func (m *ChaincodeInput) XXX_Size() int

func (*ChaincodeInput) XXX_Unmarshal added in v0.6.1

func (m *ChaincodeInput) XXX_Unmarshal(b []byte) error

type ChaincodeLocator

type ChaincodeLocator struct {
	// Chaincode name
	Chaincode string `protobuf:"bytes,1,opt,name=chaincode,proto3" json:"chaincode,omitempty"`
	// Channel name
	Channel              string   `protobuf:"bytes,2,opt,name=channel,proto3" json:"channel,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*ChaincodeLocator) Descriptor

func (*ChaincodeLocator) Descriptor() ([]byte, []int)

func (*ChaincodeLocator) GetChaincode

func (m *ChaincodeLocator) GetChaincode() string

func (*ChaincodeLocator) GetChannel

func (m *ChaincodeLocator) GetChannel() string

func (*ChaincodeLocator) ProtoMessage

func (*ChaincodeLocator) ProtoMessage()

func (*ChaincodeLocator) Reset

func (m *ChaincodeLocator) Reset()

func (*ChaincodeLocator) String

func (m *ChaincodeLocator) String() string

func (*ChaincodeLocator) Validate

func (this *ChaincodeLocator) Validate() error

func (*ChaincodeLocator) XXX_DiscardUnknown added in v0.6.1

func (m *ChaincodeLocator) XXX_DiscardUnknown()

func (*ChaincodeLocator) XXX_Marshal added in v0.6.1

func (m *ChaincodeLocator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ChaincodeLocator) XXX_Merge added in v0.6.1

func (m *ChaincodeLocator) XXX_Merge(src proto.Message)

func (*ChaincodeLocator) XXX_Size added in v0.6.1

func (m *ChaincodeLocator) XXX_Size() int

func (*ChaincodeLocator) XXX_Unmarshal added in v0.6.1

func (m *ChaincodeLocator) XXX_Unmarshal(b []byte) error

type ChaincodeServer

type ChaincodeServer interface {
	// Exec: Query or Invoke
	Exec(context.Context, *ChaincodeExec) (*peer.ProposalResponse, error)
	// Query chaincode on home peer. Do NOT send to orderer.
	Query(context.Context, *ChaincodeInput) (*peer.ProposalResponse, error)
	// Invoke chaincode on peers, according to endorsement policy and the SEND to orderer
	Invoke(context.Context, *ChaincodeInput) (*peer.ProposalResponse, error)
	// Chaincode events stream
	Events(*ChaincodeLocator, Chaincode_EventsServer) error
}

ChaincodeServer is the server API for Chaincode service.

type ChaincodeService

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

ChaincodeService implementation based of hlf-sdk-go

func New

func New(sdk api.Core) *ChaincodeService

func (*ChaincodeService) Events

func (*ChaincodeService) Exec added in v0.6.5

func (*ChaincodeService) Invoke

func (*ChaincodeService) Query

type Chaincode_EventsClient

type Chaincode_EventsClient interface {
	Recv() (*peer.ChaincodeEvent, error)
	grpc.ClientStream
}

type Chaincode_EventsServer

type Chaincode_EventsServer interface {
	Send(*peer.ChaincodeEvent) error
	grpc.ServerStream
}

type InvocationType added in v0.6.4

type InvocationType int32
const (
	InvocationType_QUERY  InvocationType = 0
	InvocationType_INVOKE InvocationType = 1
)

func (InvocationType) EnumDescriptor added in v0.6.4

func (InvocationType) EnumDescriptor() ([]byte, []int)

func (InvocationType) String added in v0.6.4

func (x InvocationType) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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