gateway

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2021 License: MIT Imports: 26 Imported by: 13

README

CCKit gateway

Documentation

Overview

Package gateway is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	CtxTransientKey = contextKey(`TransientMap`)
	CtxSignerKey    = contextKey(`SigningIdentity`)
	CtxTxWaiterKey  = contextKey(`TxWaiter`)
)

Variables

View Source
var (
	InvocationType_name = map[int32]string{
		0: "QUERY",
		1: "INVOKE",
	}
	InvocationType_value = map[string]int32{
		"QUERY":  0,
		"INVOKE": 1,
	}
)

Enum value maps for InvocationType.

View Source
var (
	ErrEventChannelClosed = errors.New(`event channel is closed`)

	// 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 File_chaincode_proto protoreflect.FileDescriptor

Functions

func ContextWithDefaultSigner added in v0.9.0

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

func ContextWithSigner added in v0.9.0

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

func ContextWithTransientMap

func ContextWithTransientMap(ctx context.Context, transient map[string][]byte) context.Context

func ContextWithTransientValue

func ContextWithTransientValue(ctx context.Context, key string, value []byte) context.Context

func ContextWithTxWaiter added in v0.9.0

func ContextWithTxWaiter(ctx context.Context, txWaiterType string) context.Context

func NewChaincode

func NewChaincode(service ChaincodeServiceServer, channelName, chaincodeName string, opts ...Opt) *chaincode

func NewChaincodeClient added in v0.6.0

func NewChaincodeClient(channelName, chaincodeName string, opts ...Opt) *chaincodeClient

func RegisterChaincodeEventsServiceHandler added in v0.9.0

func RegisterChaincodeEventsServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterChaincodeEventsServiceHandler registers the http handlers for service ChaincodeEventsService to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterChaincodeEventsServiceHandlerClient added in v0.9.0

func RegisterChaincodeEventsServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ChaincodeEventsServiceClient) error

RegisterChaincodeEventsServiceHandlerClient registers the http handlers for service ChaincodeEventsService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ChaincodeEventsServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ChaincodeEventsServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "ChaincodeEventsServiceClient" to call the correct interceptors.

func RegisterChaincodeEventsServiceHandlerFromEndpoint added in v0.9.0

func RegisterChaincodeEventsServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterChaincodeEventsServiceHandlerFromEndpoint is same as RegisterChaincodeEventsServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterChaincodeEventsServiceHandlerServer added in v0.9.0

func RegisterChaincodeEventsServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ChaincodeEventsServiceServer) error

RegisterChaincodeEventsServiceHandlerServer registers the http handlers for service ChaincodeEventsService to "mux". UnaryRPC :call ChaincodeEventsServiceServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.

func RegisterChaincodeEventsServiceServer added in v0.9.0

func RegisterChaincodeEventsServiceServer(s *grpc.Server, srv ChaincodeEventsServiceServer)

func RegisterChaincodeInstanceEventsServiceHandler added in v0.9.0

func RegisterChaincodeInstanceEventsServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterChaincodeInstanceEventsServiceHandler registers the http handlers for service ChaincodeInstanceEventsService to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterChaincodeInstanceEventsServiceHandlerClient added in v0.9.0

func RegisterChaincodeInstanceEventsServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ChaincodeInstanceEventsServiceClient) error

RegisterChaincodeInstanceEventsServiceHandlerClient registers the http handlers for service ChaincodeInstanceEventsService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ChaincodeInstanceEventsServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ChaincodeInstanceEventsServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "ChaincodeInstanceEventsServiceClient" to call the correct interceptors.

func RegisterChaincodeInstanceEventsServiceHandlerFromEndpoint added in v0.9.0

func RegisterChaincodeInstanceEventsServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterChaincodeInstanceEventsServiceHandlerFromEndpoint is same as RegisterChaincodeInstanceEventsServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterChaincodeInstanceEventsServiceHandlerServer added in v0.9.0

func RegisterChaincodeInstanceEventsServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ChaincodeInstanceEventsServiceServer) error

RegisterChaincodeInstanceEventsServiceHandlerServer registers the http handlers for service ChaincodeInstanceEventsService to "mux". UnaryRPC :call ChaincodeInstanceEventsServiceServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.

func RegisterChaincodeInstanceEventsServiceServer added in v0.9.0

func RegisterChaincodeInstanceEventsServiceServer(s *grpc.Server, srv ChaincodeInstanceEventsServiceServer)

func RegisterChaincodeInstanceServiceHandler added in v0.9.0

func RegisterChaincodeInstanceServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterChaincodeInstanceServiceHandler registers the http handlers for service ChaincodeInstanceService to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterChaincodeInstanceServiceHandlerClient added in v0.9.0

func RegisterChaincodeInstanceServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ChaincodeInstanceServiceClient) error

RegisterChaincodeInstanceServiceHandlerClient registers the http handlers for service ChaincodeInstanceService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ChaincodeInstanceServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ChaincodeInstanceServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "ChaincodeInstanceServiceClient" to call the correct interceptors.

func RegisterChaincodeInstanceServiceHandlerFromEndpoint added in v0.9.0

func RegisterChaincodeInstanceServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterChaincodeInstanceServiceHandlerFromEndpoint is same as RegisterChaincodeInstanceServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterChaincodeInstanceServiceHandlerServer added in v0.9.0

func RegisterChaincodeInstanceServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ChaincodeInstanceServiceServer) error

RegisterChaincodeInstanceServiceHandlerServer registers the http handlers for service ChaincodeInstanceService to "mux". UnaryRPC :call ChaincodeInstanceServiceServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.

func RegisterChaincodeInstanceServiceServer added in v0.9.0

func RegisterChaincodeInstanceServiceServer(s *grpc.Server, srv ChaincodeInstanceServiceServer)

func RegisterChaincodeServiceHandler added in v0.9.0

func RegisterChaincodeServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterChaincodeServiceHandler registers the http handlers for service ChaincodeService to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterChaincodeServiceHandlerClient added in v0.9.0

func RegisterChaincodeServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ChaincodeServiceClient) error

RegisterChaincodeServiceHandlerClient registers the http handlers for service ChaincodeService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ChaincodeServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ChaincodeServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "ChaincodeServiceClient" to call the correct interceptors.

func RegisterChaincodeServiceHandlerFromEndpoint added in v0.9.0

func RegisterChaincodeServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterChaincodeServiceHandlerFromEndpoint is same as RegisterChaincodeServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterChaincodeServiceHandlerServer added in v0.9.0

func RegisterChaincodeServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ChaincodeServiceServer) error

RegisterChaincodeServiceHandlerServer registers the http handlers for service ChaincodeService to "mux". UnaryRPC :call ChaincodeServiceServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.

func RegisterChaincodeServiceServer added in v0.9.0

func RegisterChaincodeServiceServer(s *grpc.Server, srv ChaincodeServiceServer)

func SignerFromContext added in v0.9.0

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

func TransientFromContext

func TransientFromContext(ctx context.Context) (map[string][]byte, error)

func TxWaiterFromContext added in v0.9.0

func TxWaiterFromContext(ctx context.Context) string

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 Action

type Action string
const (
	Query  Action = `query`
	Invoke Action = `invoke`
)

type BlockRange added in v0.9.0

type BlockRange struct {

	// from block
	From int64 `protobuf:"varint,3,opt,name=from,proto3" json:"from,omitempty"`
	// to block
	To int64 `protobuf:"varint,4,opt,name=to,proto3" json:"to,omitempty"`
	// contains filtered or unexported fields
}

Block range for event subscription. Values can be negative. If from is negative - subscription starts from x block from channel height

func (*BlockRange) Descriptor deprecated added in v0.9.0

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

Deprecated: Use BlockRange.ProtoReflect.Descriptor instead.

func (*BlockRange) GetFrom added in v0.9.0

func (x *BlockRange) GetFrom() int64

func (*BlockRange) GetTo added in v0.9.0

func (x *BlockRange) GetTo() int64

func (*BlockRange) ProtoMessage added in v0.9.0

func (*BlockRange) ProtoMessage()

func (*BlockRange) ProtoReflect added in v0.9.0

func (x *BlockRange) ProtoReflect() protoreflect.Message

func (*BlockRange) Reset added in v0.9.0

func (x *BlockRange) Reset()

func (*BlockRange) String added in v0.9.0

func (x *BlockRange) String() string

func (*BlockRange) Validate added in v0.9.0

func (this *BlockRange) Validate() error

type Chaincode

type Chaincode interface {
	Query(ctx context.Context, fn string, args []interface{}, target interface{}) (interface{}, error)
	Invoke(ctx context.Context, fn string, args []interface{}, target interface{}) (interface{}, error)
	Events(ctx context.Context) (ChaincodeEventSub, error)
}

Chaincode interface for work with chaincode

type ChaincodeClient added in v0.6.0

type ChaincodeClient interface {
	Query(stub shim.ChaincodeStubInterface, fn string, args []interface{}, target interface{}) (interface{}, error)
}

ChaincodeClient for querying external chaincode from chaincodes

type ChaincodeEventServerStream

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

ChaincodeEventServerStream implements gRPC server stream interfaces

func NewChaincodeEventServerStream

func NewChaincodeEventServerStream(ctx context.Context, opts ...EventOpt) (stream *ChaincodeEventServerStream)

func (*ChaincodeEventServerStream) Close

func (s *ChaincodeEventServerStream) Close()

func (*ChaincodeEventServerStream) Context

func (*ChaincodeEventServerStream) Events

func (s *ChaincodeEventServerStream) Events() <-chan *peer.ChaincodeEvent

func (*ChaincodeEventServerStream) Recv

func (*ChaincodeEventServerStream) RecvMsg

func (s *ChaincodeEventServerStream) RecvMsg(m interface{}) error

func (*ChaincodeEventServerStream) SendHeader

func (*ChaincodeEventServerStream) SendMsg

func (s *ChaincodeEventServerStream) SendMsg(m interface{}) (err error)

func (*ChaincodeEventServerStream) SetHeader

func (*ChaincodeEventServerStream) SetTrailer

func (*ChaincodeEventServerStream) SetTrailer(metadata.MD)

type ChaincodeEventService added in v0.9.0

type ChaincodeEventService struct {
	EventDelivery EventDelivery
}

func NewChaincodeEventService added in v0.9.0

func NewChaincodeEventService(eventDelivery EventDelivery) *ChaincodeEventService

func (*ChaincodeEventService) Events added in v0.9.0

func (*ChaincodeEventService) ServiceDef added in v0.9.0

func (ce *ChaincodeEventService) ServiceDef() ServiceDef

ServiceDef returns service definition

type ChaincodeEventSub

type ChaincodeEventSub interface {
	Context() context.Context
	Events() <-chan *peer.ChaincodeEvent
	Recv(*peer.ChaincodeEvent) error
	Close()
}

type ChaincodeEventsRequest added in v0.9.0

type ChaincodeEventsRequest struct {
	Chaincode *ChaincodeLocator `protobuf:"bytes,1,opt,name=chaincode,proto3" json:"chaincode,omitempty"`
	Block     *BlockRange       `protobuf:"bytes,2,opt,name=block,proto3" json:"block,omitempty"`
	// contains filtered or unexported fields
}

Chaincode events request

func (*ChaincodeEventsRequest) Descriptor deprecated added in v0.9.0

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

Deprecated: Use ChaincodeEventsRequest.ProtoReflect.Descriptor instead.

func (*ChaincodeEventsRequest) GetBlock added in v0.9.0

func (x *ChaincodeEventsRequest) GetBlock() *BlockRange

func (*ChaincodeEventsRequest) GetChaincode added in v0.9.0

func (x *ChaincodeEventsRequest) GetChaincode() *ChaincodeLocator

func (*ChaincodeEventsRequest) ProtoMessage added in v0.9.0

func (*ChaincodeEventsRequest) ProtoMessage()

func (*ChaincodeEventsRequest) ProtoReflect added in v0.9.0

func (x *ChaincodeEventsRequest) ProtoReflect() protoreflect.Message

func (*ChaincodeEventsRequest) Reset added in v0.9.0

func (x *ChaincodeEventsRequest) Reset()

func (*ChaincodeEventsRequest) String added in v0.9.0

func (x *ChaincodeEventsRequest) String() string

func (*ChaincodeEventsRequest) Validate added in v0.9.0

func (this *ChaincodeEventsRequest) Validate() error

type ChaincodeEventsServer added in v0.9.0

type ChaincodeEventsServer = chaincodeServiceEventsServer

ChaincodeEventsServer gateway/chaincode.go needs access to grpc stream

type ChaincodeEventsServiceClient added in v0.9.0

type ChaincodeEventsServiceClient interface {
	// Chaincode events stream
	Events(ctx context.Context, in *ChaincodeEventsRequest, opts ...grpc.CallOption) (ChaincodeEventsService_EventsClient, error)
}

ChaincodeEventsServiceClient is the client API for ChaincodeEventsService service.

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

func NewChaincodeEventsServiceClient added in v0.9.0

func NewChaincodeEventsServiceClient(cc grpc.ClientConnInterface) ChaincodeEventsServiceClient

type ChaincodeEventsServiceServer added in v0.9.0

type ChaincodeEventsServiceServer interface {
	// Chaincode events stream
	Events(*ChaincodeEventsRequest, ChaincodeEventsService_EventsServer) error
}

ChaincodeEventsServiceServer is the server API for ChaincodeEventsService service.

type ChaincodeEventsService_EventsClient added in v0.9.0

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

type ChaincodeEventsService_EventsServer added in v0.9.0

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

type ChaincodeExec added in v0.9.0

type ChaincodeExec struct {
	Type  InvocationType  `protobuf:"varint,1,opt,name=type,proto3,enum=cckit.gateway.InvocationType" json:"type,omitempty"`
	Input *ChaincodeInput `protobuf:"bytes,2,opt,name=input,proto3" json:"input,omitempty"`
	// contains filtered or unexported fields
}

Chaincode execution specification

func (*ChaincodeExec) Descriptor deprecated added in v0.9.0

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

Deprecated: Use ChaincodeExec.ProtoReflect.Descriptor instead.

func (*ChaincodeExec) GetInput added in v0.9.0

func (x *ChaincodeExec) GetInput() *ChaincodeInput

func (*ChaincodeExec) GetType added in v0.9.0

func (x *ChaincodeExec) GetType() InvocationType

func (*ChaincodeExec) ProtoMessage added in v0.9.0

func (*ChaincodeExec) ProtoMessage()

func (*ChaincodeExec) ProtoReflect added in v0.9.0

func (x *ChaincodeExec) ProtoReflect() protoreflect.Message

func (*ChaincodeExec) Reset added in v0.9.0

func (x *ChaincodeExec) Reset()

func (*ChaincodeExec) String added in v0.9.0

func (x *ChaincodeExec) String() string

func (*ChaincodeExec) Validate added in v0.9.0

func (this *ChaincodeExec) Validate() error

type ChaincodeInput added in v0.9.0

type ChaincodeInput struct {
	Chaincode *ChaincodeLocator `protobuf:"bytes,1,opt,name=chaincode,proto3" json:"chaincode,omitempty"`
	// Input contains the arguments for invocation.
	Args [][]byte `protobuf:"bytes,2,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
}

Chaincode invocation input

func (*ChaincodeInput) Descriptor deprecated added in v0.9.0

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

Deprecated: Use ChaincodeInput.ProtoReflect.Descriptor instead.

func (*ChaincodeInput) GetArgs added in v0.9.0

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

func (*ChaincodeInput) GetChaincode added in v0.9.0

func (x *ChaincodeInput) GetChaincode() *ChaincodeLocator

func (*ChaincodeInput) GetTransient added in v0.9.0

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

func (*ChaincodeInput) ProtoMessage added in v0.9.0

func (*ChaincodeInput) ProtoMessage()

func (*ChaincodeInput) ProtoReflect added in v0.9.0

func (x *ChaincodeInput) ProtoReflect() protoreflect.Message

func (*ChaincodeInput) Reset added in v0.9.0

func (x *ChaincodeInput) Reset()

func (*ChaincodeInput) String added in v0.9.0

func (x *ChaincodeInput) String() string

func (*ChaincodeInput) Validate added in v0.9.0

func (this *ChaincodeInput) Validate() error

type ChaincodeInstanceEventService added in v0.9.0

type ChaincodeInstanceEventService struct {
	EventService *ChaincodeEventService
	Locator      *ChaincodeLocator
}

func NewChaincodeInstanceEventService added in v0.9.0

func NewChaincodeInstanceEventService(delivery EventDelivery, channel, chaincode string) *ChaincodeInstanceEventService

func (*ChaincodeInstanceEventService) Events added in v0.9.0

func (*ChaincodeInstanceEventService) ServiceDef added in v0.9.0

func (ces *ChaincodeInstanceEventService) ServiceDef() ServiceDef

type ChaincodeInstanceEventsRequest added in v0.9.0

type ChaincodeInstanceEventsRequest struct {
	Block *BlockRange `protobuf:"bytes,1,opt,name=block,proto3" json:"block,omitempty"`
	// contains filtered or unexported fields
}

func (*ChaincodeInstanceEventsRequest) Descriptor deprecated added in v0.9.0

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

Deprecated: Use ChaincodeInstanceEventsRequest.ProtoReflect.Descriptor instead.

func (*ChaincodeInstanceEventsRequest) GetBlock added in v0.9.0

func (*ChaincodeInstanceEventsRequest) ProtoMessage added in v0.9.0

func (*ChaincodeInstanceEventsRequest) ProtoMessage()

func (*ChaincodeInstanceEventsRequest) ProtoReflect added in v0.9.0

func (*ChaincodeInstanceEventsRequest) Reset added in v0.9.0

func (x *ChaincodeInstanceEventsRequest) Reset()

func (*ChaincodeInstanceEventsRequest) String added in v0.9.0

func (*ChaincodeInstanceEventsRequest) Validate added in v0.9.0

func (this *ChaincodeInstanceEventsRequest) Validate() error

type ChaincodeInstanceEventsServiceClient added in v0.9.0

type ChaincodeInstanceEventsServiceClient interface {
	// Chaincode events stream
	Events(ctx context.Context, in *ChaincodeInstanceEventsRequest, opts ...grpc.CallOption) (ChaincodeInstanceEventsService_EventsClient, error)
}

ChaincodeInstanceEventsServiceClient is the client API for ChaincodeInstanceEventsService service.

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

func NewChaincodeInstanceEventsServiceClient added in v0.9.0

func NewChaincodeInstanceEventsServiceClient(cc grpc.ClientConnInterface) ChaincodeInstanceEventsServiceClient

type ChaincodeInstanceEventsServiceServer added in v0.9.0

type ChaincodeInstanceEventsServiceServer interface {
	// Chaincode events stream
	Events(*ChaincodeInstanceEventsRequest, ChaincodeInstanceEventsService_EventsServer) error
}

ChaincodeInstanceEventsServiceServer is the server API for ChaincodeInstanceEventsService service.

type ChaincodeInstanceEventsService_EventsClient added in v0.9.0

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

type ChaincodeInstanceEventsService_EventsServer added in v0.9.0

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

type ChaincodeInstanceExec added in v0.9.0

type ChaincodeInstanceExec struct {
	Type  InvocationType          `protobuf:"varint,1,opt,name=type,proto3,enum=cckit.gateway.InvocationType" json:"type,omitempty"`
	Input *ChaincodeInstanceInput `protobuf:"bytes,2,opt,name=input,proto3" json:"input,omitempty"`
	// contains filtered or unexported fields
}

func (*ChaincodeInstanceExec) Descriptor deprecated added in v0.9.0

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

Deprecated: Use ChaincodeInstanceExec.ProtoReflect.Descriptor instead.

func (*ChaincodeInstanceExec) GetInput added in v0.9.0

func (*ChaincodeInstanceExec) GetType added in v0.9.0

func (*ChaincodeInstanceExec) ProtoMessage added in v0.9.0

func (*ChaincodeInstanceExec) ProtoMessage()

func (*ChaincodeInstanceExec) ProtoReflect added in v0.9.0

func (x *ChaincodeInstanceExec) ProtoReflect() protoreflect.Message

func (*ChaincodeInstanceExec) Reset added in v0.9.0

func (x *ChaincodeInstanceExec) Reset()

func (*ChaincodeInstanceExec) String added in v0.9.0

func (x *ChaincodeInstanceExec) String() string

func (*ChaincodeInstanceExec) Validate added in v0.9.0

func (this *ChaincodeInstanceExec) Validate() error

type ChaincodeInstanceInput added in v0.9.0

type ChaincodeInstanceInput struct {

	// Input contains the arguments for invocation.
	Args [][]byte `protobuf:"bytes,1,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
}

Chaincode instance chaincode input spec

func (*ChaincodeInstanceInput) Descriptor deprecated added in v0.9.0

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

Deprecated: Use ChaincodeInstanceInput.ProtoReflect.Descriptor instead.

func (*ChaincodeInstanceInput) GetArgs added in v0.9.0

func (x *ChaincodeInstanceInput) GetArgs() [][]byte

func (*ChaincodeInstanceInput) GetTransient added in v0.9.0

func (x *ChaincodeInstanceInput) GetTransient() map[string][]byte

func (*ChaincodeInstanceInput) ProtoMessage added in v0.9.0

func (*ChaincodeInstanceInput) ProtoMessage()

func (*ChaincodeInstanceInput) ProtoReflect added in v0.9.0

func (x *ChaincodeInstanceInput) ProtoReflect() protoreflect.Message

func (*ChaincodeInstanceInput) Reset added in v0.9.0

func (x *ChaincodeInstanceInput) Reset()

func (*ChaincodeInstanceInput) String added in v0.9.0

func (x *ChaincodeInstanceInput) String() string

func (*ChaincodeInstanceInput) Validate added in v0.9.0

func (this *ChaincodeInstanceInput) Validate() error

type ChaincodeInstanceService added in v0.9.0

type ChaincodeInstanceService struct {
	ChaincodeService *ChaincodeService
	Locator          *ChaincodeLocator
}

func NewChaincodeInstanceService added in v0.9.0

func NewChaincodeInstanceService(peer Peer, channel, chaincode string) *ChaincodeInstanceService

func (*ChaincodeInstanceService) EventService added in v0.9.0

func (*ChaincodeInstanceService) Events added in v0.9.0

func (*ChaincodeInstanceService) Exec added in v0.9.0

func (*ChaincodeInstanceService) Invoke added in v0.9.0

func (*ChaincodeInstanceService) Query added in v0.9.0

func (*ChaincodeInstanceService) ServiceDef added in v0.9.0

func (cis *ChaincodeInstanceService) ServiceDef() ServiceDef

type ChaincodeInstanceServiceClient added in v0.9.0

type ChaincodeInstanceServiceClient interface {
	// Exec: Query or Invoke
	Exec(ctx context.Context, in *ChaincodeInstanceExec, opts ...grpc.CallOption) (*peer.Response, error)
	// Query chaincode on home peer. Do NOT send to orderer.
	Query(ctx context.Context, in *ChaincodeInstanceInput, opts ...grpc.CallOption) (*peer.Response, error)
	// Invoke chaincode on peers, according to endorsement policy and the SEND to orderer
	Invoke(ctx context.Context, in *ChaincodeInstanceInput, opts ...grpc.CallOption) (*peer.Response, error)
	// Chaincode events stream
	Events(ctx context.Context, in *ChaincodeInstanceEventsRequest, opts ...grpc.CallOption) (ChaincodeInstanceService_EventsClient, error)
}

ChaincodeInstanceServiceClient is the client API for ChaincodeInstanceService service.

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

func NewChaincodeInstanceServiceClient added in v0.9.0

func NewChaincodeInstanceServiceClient(cc grpc.ClientConnInterface) ChaincodeInstanceServiceClient

type ChaincodeInstanceServiceServer added in v0.9.0

type ChaincodeInstanceServiceServer interface {
	// Exec: Query or Invoke
	Exec(context.Context, *ChaincodeInstanceExec) (*peer.Response, error)
	// Query chaincode on home peer. Do NOT send to orderer.
	Query(context.Context, *ChaincodeInstanceInput) (*peer.Response, error)
	// Invoke chaincode on peers, according to endorsement policy and the SEND to orderer
	Invoke(context.Context, *ChaincodeInstanceInput) (*peer.Response, error)
	// Chaincode events stream
	Events(*ChaincodeInstanceEventsRequest, ChaincodeInstanceService_EventsServer) error
}

ChaincodeInstanceServiceServer is the server API for ChaincodeInstanceService service.

type ChaincodeInstanceService_EventsClient added in v0.9.0

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

type ChaincodeInstanceService_EventsServer added in v0.9.0

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

type ChaincodeInvoker added in v0.9.0

type ChaincodeInvoker 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)
}

type ChaincodeLocator added in v0.9.0

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
}

Chaincode locator - channel name and chaincode name

func (*ChaincodeLocator) Descriptor deprecated added in v0.9.0

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

Deprecated: Use ChaincodeLocator.ProtoReflect.Descriptor instead.

func (*ChaincodeLocator) GetChaincode added in v0.9.0

func (x *ChaincodeLocator) GetChaincode() string

func (*ChaincodeLocator) GetChannel added in v0.9.0

func (x *ChaincodeLocator) GetChannel() string

func (*ChaincodeLocator) ProtoMessage added in v0.9.0

func (*ChaincodeLocator) ProtoMessage()

func (*ChaincodeLocator) ProtoReflect added in v0.9.0

func (x *ChaincodeLocator) ProtoReflect() protoreflect.Message

func (*ChaincodeLocator) Reset added in v0.9.0

func (x *ChaincodeLocator) Reset()

func (*ChaincodeLocator) String added in v0.9.0

func (x *ChaincodeLocator) String() string

func (*ChaincodeLocator) Validate added in v0.9.0

func (this *ChaincodeLocator) Validate() error

type ChaincodeQuerier added in v0.9.0

type ChaincodeQuerier interface {
	Query(
		ctx context.Context,
		chanName string,
		ccName string,
		args [][]byte,
		identity msp.SigningIdentity,
		transient map[string][]byte,
	) (*peer.Response, error)
}

type ChaincodeService added in v0.9.0

type ChaincodeService struct {
	Peer         Peer
	EventService *ChaincodeEventService
}

func New deprecated added in v0.9.0

func New(peer Peer) *ChaincodeService

Deprecated: use NewChaincodeService instead

func NewChaincodeService added in v0.9.0

func NewChaincodeService(peer Peer) *ChaincodeService

func (*ChaincodeService) Events added in v0.9.0

func (*ChaincodeService) Exec added in v0.9.0

func (*ChaincodeService) InstanceService added in v0.9.0

func (cs *ChaincodeService) InstanceService(channel, chaincode string) *ChaincodeInstanceService

InstanceService returns ChaincodeInstanceService for current Peer interface and provided channel and chaincode name

func (*ChaincodeService) Invoke added in v0.9.0

func (*ChaincodeService) Query added in v0.9.0

func (*ChaincodeService) ServiceDef added in v0.9.0

func (cs *ChaincodeService) ServiceDef() ServiceDef

ServiceDef returns service definition

type ChaincodeServiceClient added in v0.9.0

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

ChaincodeServiceClient is the client API for ChaincodeService service.

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

func NewChaincodeServiceClient added in v0.9.0

func NewChaincodeServiceClient(cc grpc.ClientConnInterface) ChaincodeServiceClient

type ChaincodeServiceServer added in v0.9.0

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

ChaincodeServiceServer is the server API for ChaincodeService service.

type ChaincodeService_EventsClient added in v0.9.0

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

type ChaincodeService_EventsServer added in v0.9.0

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

type ClientOpt added in v0.6.0

type ClientOpt func(*chaincodeClient)

type ContextOpt

type ContextOpt func(ctx context.Context) context.Context

type EventDelivery added in v0.9.0

type EventDelivery interface {
	Events(
		ctx context.Context,
		channelName string,
		ccName string,
		identity msp.SigningIdentity,
		blockRange ...int64,
	) (chan *peer.ChaincodeEvent, error)
}

type EventOpt

type EventOpt func(event *peer.ChaincodeEvent) error

type InputOpt

type InputOpt func(action Action, input *ChaincodeInput) error

type InvocationType added in v0.9.0

type InvocationType int32

Chaincode invocation type

const (
	// Simulation
	InvocationType_QUERY InvocationType = 0
	// Simulation and applying to ledger
	InvocationType_INVOKE InvocationType = 1
)

func (InvocationType) Descriptor added in v0.9.0

func (InvocationType) Enum added in v0.9.0

func (x InvocationType) Enum() *InvocationType

func (InvocationType) EnumDescriptor deprecated added in v0.9.0

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

Deprecated: Use InvocationType.Descriptor instead.

func (InvocationType) Number added in v0.9.0

func (InvocationType) String added in v0.9.0

func (x InvocationType) String() string

func (InvocationType) Type added in v0.9.0

type Opt

type Opt func(*chaincode)

func WithArgsEncryption

func WithArgsEncryption(encKey []byte) Opt

func WithDefaultSigner

func WithDefaultSigner(defaultSigner msp.SigningIdentity) Opt

func WithEncryption

func WithEncryption(encKey []byte) Opt

func WithEventDecryption

func WithEventDecryption(encKey []byte) Opt

func WithInvokePayloadDecryption

func WithInvokePayloadDecryption(encKey []byte) Opt

func WithTransientValue

func WithTransientValue(key string, value []byte) Opt

type OutputOpt

type OutputOpt func(action Action, response *peer.Response) error

type Peer added in v0.9.0

type Peer interface {
	PeerReader
	ChaincodeInvoker
}

type PeerReader added in v0.9.0

type PeerReader interface {
	ChaincodeQuerier
	EventDelivery
}

type RegisterHandlerFromEndpoint

type RegisterHandlerFromEndpoint func(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

type ServiceDef

type ServiceDef struct {
	Desc                        *grpc.ServiceDesc
	Service                     interface{}
	HandlerFromEndpointRegister RegisterHandlerFromEndpoint
}

type UnimplementedChaincodeEventsServiceServer added in v0.9.0

type UnimplementedChaincodeEventsServiceServer struct {
}

UnimplementedChaincodeEventsServiceServer can be embedded to have forward compatible implementations.

func (*UnimplementedChaincodeEventsServiceServer) Events added in v0.9.0

type UnimplementedChaincodeInstanceEventsServiceServer added in v0.9.0

type UnimplementedChaincodeInstanceEventsServiceServer struct {
}

UnimplementedChaincodeInstanceEventsServiceServer can be embedded to have forward compatible implementations.

func (*UnimplementedChaincodeInstanceEventsServiceServer) Events added in v0.9.0

type UnimplementedChaincodeInstanceServiceServer added in v0.9.0

type UnimplementedChaincodeInstanceServiceServer struct {
}

UnimplementedChaincodeInstanceServiceServer can be embedded to have forward compatible implementations.

func (*UnimplementedChaincodeInstanceServiceServer) Events added in v0.9.0

func (*UnimplementedChaincodeInstanceServiceServer) Exec added in v0.9.0

func (*UnimplementedChaincodeInstanceServiceServer) Invoke added in v0.9.0

func (*UnimplementedChaincodeInstanceServiceServer) Query added in v0.9.0

type UnimplementedChaincodeServiceServer added in v0.9.0

type UnimplementedChaincodeServiceServer struct {
}

UnimplementedChaincodeServiceServer can be embedded to have forward compatible implementations.

func (*UnimplementedChaincodeServiceServer) Events added in v0.9.0

func (*UnimplementedChaincodeServiceServer) Exec added in v0.9.0

func (*UnimplementedChaincodeServiceServer) Invoke added in v0.9.0

func (*UnimplementedChaincodeServiceServer) Query added in v0.9.0

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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