service

package
v0.6.3-kompitech1 Latest Latest
Warning

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

Go to latest
Published: May 13, 2020 License: MIT Imports: 23 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

This section is empty.

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 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.ClientConn) 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

ApiDef returns service definition

func (*CPaperGateway) Buy

func (*CPaperGateway) Delete

func (*CPaperGateway) Events

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

type CPaperImpl struct {
}

func New

func New() *CPaperImpl

func (*CPaperImpl) Buy

func (*CPaperImpl) Delete

func (*CPaperImpl) Get

func (*CPaperImpl) GetByExternalId

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

func (*CPaperImpl) Issue

func (*CPaperImpl) List

func (*CPaperImpl) Redeem

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 ValidatorInterface

type ValidatorInterface interface {
	Validate() error
}

Jump to

Keyboard shortcuts

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