cpaper_proxy

package
v0.10.3 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2022 License: MIT Imports: 27 Imported by: 0

README

Cross chaincode service calls example

Chaincode reads from Commercial Paper chaincode. Location of external Commercial Paper configured via crosscc extension

Documentation

Overview

Package cpaper_proxy contains

  • chaincode methods names {service_name}Chaincode_{method_name}
  • chaincode interface definition {service_name}Chaincode
  • chaincode gateway definition {service_name}}Gateway
  • chaincode service to cckit router registration func

Package cpaper_proxy is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (

	// CPaperProxyServiceChaincodeMethodPrefix allows to use multiple services with same method names in one chaincode
	CPaperProxyServiceChaincodeMethodPrefix = ""

	CPaperProxyServiceChaincode_GetFromCPaper = CPaperProxyServiceChaincodeMethodPrefix + "GetFromCPaper"
)

CPaperProxyServiceChaincode method names

Variables

View Source
var CPaperProxyServiceSwagger []byte
View Source
var File_cpaper_proxy_cpaper_proxy_proto protoreflect.FileDescriptor

Functions

func NewCCWithLocalCpaper

func NewCCWithLocalCpaper() (*router.Chaincode, error)

func NewCCWithRemoteCpaper

func NewCCWithRemoteCpaper() (*router.Chaincode, error)

func RegisterCPaperProxyServiceChaincode

func RegisterCPaperProxyServiceChaincode(r *cckit_router.Group, cc CPaperProxyServiceChaincode) error

RegisterCPaperProxyServiceChaincode registers service methods as chaincode router handlers

func RegisterCPaperProxyServiceHandler

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

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

func RegisterCPaperProxyServiceHandlerClient

func RegisterCPaperProxyServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client CPaperProxyServiceClient) error

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

func RegisterCPaperProxyServiceHandlerFromEndpoint

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

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

func RegisterCPaperProxyServiceHandlerServer

func RegisterCPaperProxyServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server CPaperProxyServiceServer) error

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

func RegisterCPaperProxyServiceServer

func RegisterCPaperProxyServiceServer(s *grpc.Server, srv CPaperProxyServiceServer)

Types

type CPaperProxyService

type CPaperProxyService struct {
	CPaperServiceResolver cpservice.CPaperServiceChaincodeResolver
}

func NewServiceWithLocalCPaperResolver

func NewServiceWithLocalCPaperResolver(cpaperService cpservice.CPaperServiceChaincode) *CPaperProxyService

NewServiceWithLocalCPaperResolver - crosscc service and cpaper service in one chaincode

func NewServiceWithRemoteCPaperResolver

func NewServiceWithRemoteCPaperResolver(setting crosscc.SettingServiceChaincode) *CPaperProxyService

func (*CPaperProxyService) GetFromCPaper

func (c *CPaperProxyService) GetFromCPaper(ctx router.Context, id *Id) (*InfoFromCPaper, error)

type CPaperProxyServiceChaincode

type CPaperProxyServiceChaincode interface {
	GetFromCPaper(cckit_router.Context, *Id) (*InfoFromCPaper, error)
}

CPaperProxyServiceChaincode chaincode methods interface

type CPaperProxyServiceChaincodeLocalResolver

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

CPaperProxyServiceChaincodeResolver interface for service resolver

func (*CPaperProxyServiceChaincodeLocalResolver) Resolve

type CPaperProxyServiceChaincodeLocatorResolver

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

CPaperProxyServiceChaincodeResolver interface for service resolver

func (*CPaperProxyServiceChaincodeLocatorResolver) Resolve

type CPaperProxyServiceChaincodeResolver

type CPaperProxyServiceChaincodeResolver interface {
	Resolve(ctx cckit_router.Context) (CPaperProxyServiceChaincode, error)
}

CPaperProxyServiceChaincodeResolver interface for service resolver

type CPaperProxyServiceChaincodeStubInvoker

type CPaperProxyServiceChaincodeStubInvoker struct {
	Invoker cckit_gateway.ChaincodeStubInvoker
}

func (*CPaperProxyServiceChaincodeStubInvoker) GetFromCPaper

type CPaperProxyServiceClient

type CPaperProxyServiceClient interface {
	// List method returns all registered commercial papers
	GetFromCPaper(ctx context.Context, in *Id, opts ...grpc.CallOption) (*InfoFromCPaper, error)
}

CPaperProxyServiceClient is the client API for CPaperProxyService service.

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

type CPaperProxyServiceGateway

type CPaperProxyServiceGateway struct {
	ChaincodeInstance cckit_gateway.ChaincodeInstance
}

gateway implementation gateway can be used as kind of SDK, GRPC or REST server ( via grpc-gateway or clay )

func NewCPaperProxyServiceGateway

func NewCPaperProxyServiceGateway(sdk cckit_sdk.SDK, channel, chaincode string, opts ...cckit_gateway.Opt) *CPaperProxyServiceGateway

NewCPaperProxyServiceGateway creates gateway to access chaincode method via chaincode service

func NewCPaperProxyServiceGatewayFromInstance

func NewCPaperProxyServiceGatewayFromInstance(chaincodeInstance cckit_gateway.ChaincodeInstance) *CPaperProxyServiceGateway

func (*CPaperProxyServiceGateway) GetFromCPaper

func (c *CPaperProxyServiceGateway) GetFromCPaper(ctx context.Context, in *Id) (*InfoFromCPaper, error)

func (*CPaperProxyServiceGateway) Invoker

func (*CPaperProxyServiceGateway) ServiceDef

ServiceDef returns service definition

type CPaperProxyServiceServer

type CPaperProxyServiceServer interface {
	// List method returns all registered commercial papers
	GetFromCPaper(context.Context, *Id) (*InfoFromCPaper, error)
}

CPaperProxyServiceServer is the server API for CPaperProxyService service.

type Id

type Id struct {
	Issuer      string `protobuf:"bytes,1,opt,name=issuer,proto3" json:"issuer,omitempty"`
	PaperNumber string `protobuf:"bytes,2,opt,name=paper_number,json=paperNumber,proto3" json:"paper_number,omitempty"`
	// contains filtered or unexported fields
}

func (*Id) Descriptor deprecated

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

Deprecated: Use Id.ProtoReflect.Descriptor instead.

func (*Id) GetIssuer

func (x *Id) GetIssuer() string

func (*Id) GetPaperNumber

func (x *Id) GetPaperNumber() string

func (*Id) ProtoMessage

func (*Id) ProtoMessage()

func (*Id) ProtoReflect

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

func (*Id) Reset

func (x *Id) Reset()

func (*Id) String

func (x *Id) String() string

func (*Id) Validate

func (this *Id) Validate() error

type InfoFromCPaper

type InfoFromCPaper struct {
	Issuer      string `protobuf:"bytes,1,opt,name=issuer,proto3" json:"issuer,omitempty"`
	PaperNumber string `protobuf:"bytes,2,opt,name=paper_number,json=paperNumber,proto3" json:"paper_number,omitempty"`
	Owner       string `protobuf:"bytes,3,opt,name=owner,proto3" json:"owner,omitempty"`
	// contains filtered or unexported fields
}

func (*InfoFromCPaper) Descriptor deprecated

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

Deprecated: Use InfoFromCPaper.ProtoReflect.Descriptor instead.

func (*InfoFromCPaper) GetIssuer

func (x *InfoFromCPaper) GetIssuer() string

func (*InfoFromCPaper) GetOwner

func (x *InfoFromCPaper) GetOwner() string

func (*InfoFromCPaper) GetPaperNumber

func (x *InfoFromCPaper) GetPaperNumber() string

func (*InfoFromCPaper) ProtoMessage

func (*InfoFromCPaper) ProtoMessage()

func (*InfoFromCPaper) ProtoReflect

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

func (*InfoFromCPaper) Reset

func (x *InfoFromCPaper) Reset()

func (*InfoFromCPaper) String

func (x *InfoFromCPaper) String() string

func (*InfoFromCPaper) Validate

func (this *InfoFromCPaper) Validate() error

type UnimplementedCPaperProxyServiceServer

type UnimplementedCPaperProxyServiceServer struct {
}

UnimplementedCPaperProxyServiceServer can be embedded to have forward compatible implementations.

func (*UnimplementedCPaperProxyServiceServer) GetFromCPaper

Jump to

Keyboard shortcuts

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