Documentation ¶
Index ¶
- Constants
- Variables
- func ContextWithDefaultSigner(ctx context.Context, defaultSigner msp.SigningIdentity) context.Context
- func ContextWithSigner(ctx context.Context, signer msp.SigningIdentity) context.Context
- func ContextWithTxWaiter(ctx context.Context, txWaiterType string) context.Context
- func RegisterChaincodeServer(s *grpc.Server, srv ChaincodeServer)
- func SignerFromContext(ctx context.Context) (msp.SigningIdentity, error)
- func TxWaiterFromContext(ctx context.Context) string
- type Chaincode
- type ChaincodeClient
- type ChaincodeEventsServer
- type ChaincodeExec
- func (*ChaincodeExec) Descriptor() ([]byte, []int)deprecated
- func (x *ChaincodeExec) GetInput() *ChaincodeInput
- func (x *ChaincodeExec) GetType() InvocationType
- func (*ChaincodeExec) ProtoMessage()
- func (x *ChaincodeExec) ProtoReflect() protoreflect.Message
- func (x *ChaincodeExec) Reset()
- func (x *ChaincodeExec) String() string
- func (this *ChaincodeExec) Validate() error
- type ChaincodeInput
- func (*ChaincodeInput) Descriptor() ([]byte, []int)deprecated
- func (x *ChaincodeInput) GetArgs() [][]byte
- func (x *ChaincodeInput) GetChaincode() string
- func (x *ChaincodeInput) GetChannel() string
- func (x *ChaincodeInput) GetTransient() map[string][]byte
- func (*ChaincodeInput) ProtoMessage()
- func (x *ChaincodeInput) ProtoReflect() protoreflect.Message
- func (x *ChaincodeInput) Reset()
- func (x *ChaincodeInput) String() string
- func (this *ChaincodeInput) Validate() error
- type ChaincodeLocator
- func (*ChaincodeLocator) Descriptor() ([]byte, []int)deprecated
- func (x *ChaincodeLocator) GetChaincode() string
- func (x *ChaincodeLocator) GetChannel() string
- func (*ChaincodeLocator) ProtoMessage()
- func (x *ChaincodeLocator) ProtoReflect() protoreflect.Message
- func (x *ChaincodeLocator) Reset()
- func (x *ChaincodeLocator) String() string
- func (this *ChaincodeLocator) Validate() error
- type ChaincodeServer
- type ChaincodeService
- func (cs *ChaincodeService) Events(in *ChaincodeLocator, stream Chaincode_EventsServer) error
- func (cs *ChaincodeService) Exec(ctx context.Context, in *ChaincodeExec) (*peer.ProposalResponse, error)
- func (cs *ChaincodeService) Invoke(ctx context.Context, in *ChaincodeInput) (*peer.ProposalResponse, error)
- func (cs *ChaincodeService) Query(ctx context.Context, in *ChaincodeInput) (*peer.ProposalResponse, error)
- type Chaincode_EventsClient
- type Chaincode_EventsServer
- type InvocationType
- func (InvocationType) Descriptor() protoreflect.EnumDescriptor
- func (x InvocationType) Enum() *InvocationType
- func (InvocationType) EnumDescriptor() ([]byte, []int)deprecated
- func (x InvocationType) Number() protoreflect.EnumNumber
- func (x InvocationType) String() string
- func (InvocationType) Type() protoreflect.EnumType
- type Peer
- type UnimplementedChaincodeServer
- func (*UnimplementedChaincodeServer) Events(*ChaincodeLocator, Chaincode_EventsServer) error
- func (*UnimplementedChaincodeServer) Exec(context.Context, *ChaincodeExec) (*peer.ProposalResponse, error)
- func (*UnimplementedChaincodeServer) Invoke(context.Context, *ChaincodeInput) (*peer.ProposalResponse, error)
- func (*UnimplementedChaincodeServer) Query(context.Context, *ChaincodeInput) (*peer.ProposalResponse, error)
Constants ¶
const ( CtxSignerKey = contextKey(`SigningIdentity`) CtxTxWaiterKey = contextKey(`TxWaiter`) )
Variables ¶
var ( InvocationType_name = map[int32]string{ 0: "QUERY", 1: "INVOKE", } InvocationType_value = map[string]int32{ "QUERY": 0, "INVOKE": 1, } )
Enum value maps for InvocationType.
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`) )
var File_service_chaincode_proto protoreflect.FileDescriptor
Functions ¶
func ContextWithSigner ¶
func ContextWithTxWaiter ¶ added in v0.8.0
func RegisterChaincodeServer ¶
func RegisterChaincodeServer(s *grpc.Server, srv ChaincodeServer)
func SignerFromContext ¶
func SignerFromContext(ctx context.Context) (msp.SigningIdentity, error)
func TxWaiterFromContext ¶ added in v0.8.0
TxWaiterFromContext - fetch 'txWaiterType' param which identify transaction waiting policy what params you'll have depends on your implementation for example, in hlf-sdk: available: 'self'(wait for one peer of endorser org), 'all'(wait for each organizations from endorsement policy) default is 'self'(even if you pass empty string)
Types ¶
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.ClientConnInterface) ChaincodeClient
type ChaincodeEventsServer ¶
type ChaincodeEventsServer = chaincodeEventsServer
gateway/chaincode.go needds access to grpc stream
type ChaincodeExec ¶ added in v0.6.4
type ChaincodeExec struct { Type InvocationType `protobuf:"varint,1,opt,name=type,proto3,enum=s7techlab.gateway.service.InvocationType" json:"type,omitempty"` Input *ChaincodeInput `protobuf:"bytes,2,opt,name=input,proto3" json:"input,omitempty"` // contains filtered or unexported fields }
func (*ChaincodeExec) Descriptor
deprecated
added in
v0.6.4
func (*ChaincodeExec) Descriptor() ([]byte, []int)
Deprecated: Use ChaincodeExec.ProtoReflect.Descriptor instead.
func (*ChaincodeExec) GetInput ¶ added in v0.6.4
func (x *ChaincodeExec) GetInput() *ChaincodeInput
func (*ChaincodeExec) GetType ¶ added in v0.6.4
func (x *ChaincodeExec) GetType() InvocationType
func (*ChaincodeExec) ProtoMessage ¶ added in v0.6.4
func (*ChaincodeExec) ProtoMessage()
func (*ChaincodeExec) ProtoReflect ¶ added in v0.7.0
func (x *ChaincodeExec) ProtoReflect() protoreflect.Message
func (*ChaincodeExec) Reset ¶ added in v0.6.4
func (x *ChaincodeExec) Reset()
func (*ChaincodeExec) String ¶ added in v0.6.4
func (x *ChaincodeExec) String() string
func (*ChaincodeExec) Validate ¶ added in v0.6.4
func (this *ChaincodeExec) Validate() 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 */ // contains filtered or unexported fields }
func (*ChaincodeInput) Descriptor
deprecated
func (*ChaincodeInput) Descriptor() ([]byte, []int)
Deprecated: Use ChaincodeInput.ProtoReflect.Descriptor instead.
func (*ChaincodeInput) GetArgs ¶
func (x *ChaincodeInput) GetArgs() [][]byte
func (*ChaincodeInput) GetChaincode ¶
func (x *ChaincodeInput) GetChaincode() string
func (*ChaincodeInput) GetChannel ¶
func (x *ChaincodeInput) GetChannel() string
func (*ChaincodeInput) GetTransient ¶
func (x *ChaincodeInput) GetTransient() map[string][]byte
func (*ChaincodeInput) ProtoMessage ¶
func (*ChaincodeInput) ProtoMessage()
func (*ChaincodeInput) ProtoReflect ¶ added in v0.7.0
func (x *ChaincodeInput) ProtoReflect() protoreflect.Message
func (*ChaincodeInput) Reset ¶
func (x *ChaincodeInput) Reset()
func (*ChaincodeInput) String ¶
func (x *ChaincodeInput) String() string
func (*ChaincodeInput) Validate ¶
func (this *ChaincodeInput) Validate() 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"` // contains filtered or unexported fields }
func (*ChaincodeLocator) Descriptor
deprecated
func (*ChaincodeLocator) Descriptor() ([]byte, []int)
Deprecated: Use ChaincodeLocator.ProtoReflect.Descriptor instead.
func (*ChaincodeLocator) GetChaincode ¶
func (x *ChaincodeLocator) GetChaincode() string
func (*ChaincodeLocator) GetChannel ¶
func (x *ChaincodeLocator) GetChannel() string
func (*ChaincodeLocator) ProtoMessage ¶
func (*ChaincodeLocator) ProtoMessage()
func (*ChaincodeLocator) ProtoReflect ¶ added in v0.7.0
func (x *ChaincodeLocator) ProtoReflect() protoreflect.Message
func (*ChaincodeLocator) Reset ¶
func (x *ChaincodeLocator) Reset()
func (*ChaincodeLocator) String ¶
func (x *ChaincodeLocator) String() string
func (*ChaincodeLocator) Validate ¶
func (this *ChaincodeLocator) Validate() 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
}
func New ¶
func New(peerSDK Peer) *ChaincodeService
func (*ChaincodeService) Events ¶
func (cs *ChaincodeService) Events(in *ChaincodeLocator, stream Chaincode_EventsServer) error
func (*ChaincodeService) Exec ¶ added in v0.6.5
func (cs *ChaincodeService) Exec(ctx context.Context, in *ChaincodeExec) (*peer.ProposalResponse, error)
func (*ChaincodeService) Invoke ¶
func (cs *ChaincodeService) Invoke(ctx context.Context, in *ChaincodeInput) (*peer.ProposalResponse, error)
func (*ChaincodeService) Query ¶
func (cs *ChaincodeService) Query(ctx context.Context, in *ChaincodeInput) (*peer.ProposalResponse, error)
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) Descriptor ¶ added in v0.7.0
func (InvocationType) Descriptor() protoreflect.EnumDescriptor
func (InvocationType) Enum ¶ added in v0.7.0
func (x InvocationType) Enum() *InvocationType
func (InvocationType) EnumDescriptor
deprecated
added in
v0.6.4
func (InvocationType) EnumDescriptor() ([]byte, []int)
Deprecated: Use InvocationType.Descriptor instead.
func (InvocationType) Number ¶ added in v0.7.0
func (x InvocationType) Number() protoreflect.EnumNumber
func (InvocationType) String ¶ added in v0.6.4
func (x InvocationType) String() string
func (InvocationType) Type ¶ added in v0.7.0
func (InvocationType) Type() protoreflect.EnumType
type Peer ¶ added in v0.8.0
type Peer interface { Invoke( ctx context.Context, chanName string, ccName string, args [][]byte, identity msp.SigningIdentity, transient map[string][]byte, txWaiterType string, ) (res *peer.Response, chaincodeTx string, err error) Query( ctx context.Context, chanName string, ccName string, args [][]byte, identity msp.SigningIdentity, transient map[string][]byte, ) (*peer.ProposalResponse, error) Events( ctx context.Context, channelName string, ccName string, identity msp.SigningIdentity, eventCCSeekOption ...func() (*orderer.SeekPosition, *orderer.SeekPosition), ) (chan *peer.ChaincodeEvent, error) }
type UnimplementedChaincodeServer ¶ added in v0.7.0
type UnimplementedChaincodeServer struct { }
UnimplementedChaincodeServer can be embedded to have forward compatible implementations.
func (*UnimplementedChaincodeServer) Events ¶ added in v0.7.0
func (*UnimplementedChaincodeServer) Events(*ChaincodeLocator, Chaincode_EventsServer) error
func (*UnimplementedChaincodeServer) Exec ¶ added in v0.7.0
func (*UnimplementedChaincodeServer) Exec(context.Context, *ChaincodeExec) (*peer.ProposalResponse, error)
func (*UnimplementedChaincodeServer) Invoke ¶ added in v0.7.0
func (*UnimplementedChaincodeServer) Invoke(context.Context, *ChaincodeInput) (*peer.ProposalResponse, error)
func (*UnimplementedChaincodeServer) Query ¶ added in v0.7.0
func (*UnimplementedChaincodeServer) Query(context.Context, *ChaincodeInput) (*peer.ProposalResponse, error)