service

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2021 License: MIT Imports: 26 Imported by: 0

Documentation

Overview

Package service contains

  • chaincode interface definition
  • chaincode gateway definition
  • chaincode service to cckit router registration func

Package service is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	CPaperChaincode_List = "List"

	CPaperChaincode_Get = "Get"

	CPaperChaincode_GetByExternalId = "GetByExternalId"

	CPaperChaincode_Issue = "Issue"

	CPaperChaincode_Buy = "Buy"

	CPaperChaincode_Redeem = "Redeem"

	CPaperChaincode_Delete = "Delete"
)

CPaperChaincode method names

Variables

View Source
var File_cpaper_asservice_service_service_proto protoreflect.FileDescriptor

Functions

func RegisterCPaperChaincode

func RegisterCPaperChaincode(r *cckit_router.Group, cc CPaperChaincode) error

RegisterCPaperChaincode registers service methods as chaincode router handlers

func RegisterCPaperHandler

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

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

func RegisterCPaperHandlerClient

func RegisterCPaperHandlerClient(ctx context.Context, mux *runtime.ServeMux, client CPaperClient) error

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

func RegisterCPaperHandlerFromEndpoint

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

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

func RegisterCPaperHandlerServer added in v0.7.0

func RegisterCPaperHandlerServer(ctx context.Context, mux *runtime.ServeMux, server CPaperServer) error

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

func RegisterCPaperServer

func RegisterCPaperServer(s *grpc.Server, srv CPaperServer)

Types

type CPaperClient

type CPaperClient interface {
	// List method returns all registered commercial papers
	List(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*schema.CommercialPaperList, error)
	// Get method returns commercial paper data by id
	Get(ctx context.Context, in *schema.CommercialPaperId, opts ...grpc.CallOption) (*schema.CommercialPaper, error)
	// GetByExternalId
	GetByExternalId(ctx context.Context, in *schema.ExternalId, opts ...grpc.CallOption) (*schema.CommercialPaper, error)
	// Issue commercial paper
	Issue(ctx context.Context, in *schema.IssueCommercialPaper, opts ...grpc.CallOption) (*schema.CommercialPaper, error)
	// Buy commercial paper
	Buy(ctx context.Context, in *schema.BuyCommercialPaper, opts ...grpc.CallOption) (*schema.CommercialPaper, error)
	// Redeem commercial paper
	Redeem(ctx context.Context, in *schema.RedeemCommercialPaper, opts ...grpc.CallOption) (*schema.CommercialPaper, error)
	// Delete commercial paper
	Delete(ctx context.Context, in *schema.CommercialPaperId, opts ...grpc.CallOption) (*schema.CommercialPaper, error)
}

CPaperClient is the client API for CPaper service.

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

func NewCPaperClient

func NewCPaperClient(cc grpc.ClientConnInterface) CPaperClient

type CPaperGateway

type CPaperGateway struct {
	Gateway cckit_gateway.Chaincode
}

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

func NewCPaperGateway

func NewCPaperGateway(ccService cckit_ccservice.Chaincode, channel, chaincode string, opts ...cckit_gateway.Opt) *CPaperGateway

NewCPaperGateway creates gateway to access chaincode method via chaincode service

func (*CPaperGateway) ApiDef added in v0.6.0

ApiDef returns service definition

func (*CPaperGateway) Buy

func (*CPaperGateway) Delete

func (*CPaperGateway) Events added in v0.6.0

Events returns events subscription

func (*CPaperGateway) Get

func (*CPaperGateway) GetByExternalId

func (c *CPaperGateway) GetByExternalId(ctx context.Context, in *schema.ExternalId) (*schema.CommercialPaper, error)

func (*CPaperGateway) Issue

func (*CPaperGateway) List

func (*CPaperGateway) Redeem

type CPaperImpl added in v0.6.1

type CPaperImpl struct {
}

func New added in v0.6.1

func New() *CPaperImpl

func (*CPaperImpl) Buy added in v0.6.1

func (*CPaperImpl) Delete added in v0.6.1

func (*CPaperImpl) Get added in v0.6.1

func (*CPaperImpl) GetByExternalId added in v0.6.1

func (cc *CPaperImpl) GetByExternalId(ctx router.Context, id *schema.ExternalId) (*schema.CommercialPaper, error)

func (*CPaperImpl) Issue added in v0.6.1

func (*CPaperImpl) List added in v0.6.1

func (*CPaperImpl) Redeem added in v0.6.1

type CPaperServer

type CPaperServer interface {
	// List method returns all registered commercial papers
	List(context.Context, *empty.Empty) (*schema.CommercialPaperList, error)
	// Get method returns commercial paper data by id
	Get(context.Context, *schema.CommercialPaperId) (*schema.CommercialPaper, error)
	// GetByExternalId
	GetByExternalId(context.Context, *schema.ExternalId) (*schema.CommercialPaper, error)
	// Issue commercial paper
	Issue(context.Context, *schema.IssueCommercialPaper) (*schema.CommercialPaper, error)
	// Buy commercial paper
	Buy(context.Context, *schema.BuyCommercialPaper) (*schema.CommercialPaper, error)
	// Redeem commercial paper
	Redeem(context.Context, *schema.RedeemCommercialPaper) (*schema.CommercialPaper, error)
	// Delete commercial paper
	Delete(context.Context, *schema.CommercialPaperId) (*schema.CommercialPaper, error)
}

CPaperServer is the server API for CPaper service.

type UnimplementedCPaperServer added in v0.7.0

type UnimplementedCPaperServer struct {
}

UnimplementedCPaperServer can be embedded to have forward compatible implementations.

func (*UnimplementedCPaperServer) Buy added in v0.7.0

func (*UnimplementedCPaperServer) Delete added in v0.7.0

func (*UnimplementedCPaperServer) Get added in v0.7.0

func (*UnimplementedCPaperServer) GetByExternalId added in v0.7.0

func (*UnimplementedCPaperServer) Issue added in v0.7.0

func (*UnimplementedCPaperServer) List added in v0.7.0

func (*UnimplementedCPaperServer) Redeem added in v0.7.0

type ValidatorInterface added in v0.6.0

type ValidatorInterface interface {
	Validate() error
}

Jump to

Keyboard shortcuts

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