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
- Variables
- func RegisterCPaperChaincode(r *cckit_router.Group, cc CPaperChaincode) error
- func RegisterCPaperHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterCPaperHandlerClient(ctx context.Context, mux *runtime.ServeMux, client CPaperClient) error
- func RegisterCPaperHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterCPaperHandlerServer(ctx context.Context, mux *runtime.ServeMux, server CPaperServer) error
- func RegisterCPaperServer(s *grpc.Server, srv CPaperServer)
- type CPaperChaincode
- type CPaperClient
- type CPaperGateway
- func (c *CPaperGateway) ApiDef() cckit_gateway.ServiceDef
- func (c *CPaperGateway) Buy(ctx context.Context, in *schema.BuyCommercialPaper) (*schema.CommercialPaper, error)
- func (c *CPaperGateway) Delete(ctx context.Context, in *schema.CommercialPaperId) (*schema.CommercialPaper, error)
- func (c *CPaperGateway) Events(ctx context.Context) (cckit_gateway.ChaincodeEventSub, error)
- func (c *CPaperGateway) Get(ctx context.Context, in *schema.CommercialPaperId) (*schema.CommercialPaper, error)
- func (c *CPaperGateway) GetByExternalId(ctx context.Context, in *schema.ExternalId) (*schema.CommercialPaper, error)
- func (c *CPaperGateway) Issue(ctx context.Context, in *schema.IssueCommercialPaper) (*schema.CommercialPaper, error)
- func (c *CPaperGateway) List(ctx context.Context, in *empty.Empty) (*schema.CommercialPaperList, error)
- func (c *CPaperGateway) Redeem(ctx context.Context, in *schema.RedeemCommercialPaper) (*schema.CommercialPaper, error)
- type CPaperImpl
- func (cc *CPaperImpl) Buy(ctx router.Context, buy *schema.BuyCommercialPaper) (*schema.CommercialPaper, error)
- func (cc *CPaperImpl) Delete(ctx router.Context, id *schema.CommercialPaperId) (*schema.CommercialPaper, error)
- func (cc *CPaperImpl) Get(ctx router.Context, id *schema.CommercialPaperId) (*schema.CommercialPaper, error)
- func (cc *CPaperImpl) GetByExternalId(ctx router.Context, id *schema.ExternalId) (*schema.CommercialPaper, error)
- func (cc *CPaperImpl) Issue(ctx router.Context, issue *schema.IssueCommercialPaper) (*schema.CommercialPaper, error)
- func (cc *CPaperImpl) List(ctx router.Context, in *empty.Empty) (*schema.CommercialPaperList, error)
- func (cc *CPaperImpl) Redeem(ctx router.Context, redeem *schema.RedeemCommercialPaper) (*schema.CommercialPaper, error)
- type CPaperServer
- type UnimplementedCPaperServer
- func (*UnimplementedCPaperServer) Buy(context.Context, *schema.BuyCommercialPaper) (*schema.CommercialPaper, error)
- func (*UnimplementedCPaperServer) Delete(context.Context, *schema.CommercialPaperId) (*schema.CommercialPaper, error)
- func (*UnimplementedCPaperServer) Get(context.Context, *schema.CommercialPaperId) (*schema.CommercialPaper, error)
- func (*UnimplementedCPaperServer) GetByExternalId(context.Context, *schema.ExternalId) (*schema.CommercialPaper, error)
- func (*UnimplementedCPaperServer) Issue(context.Context, *schema.IssueCommercialPaper) (*schema.CommercialPaper, error)
- func (*UnimplementedCPaperServer) List(context.Context, *empty.Empty) (*schema.CommercialPaperList, error)
- func (*UnimplementedCPaperServer) Redeem(context.Context, *schema.RedeemCommercialPaper) (*schema.CommercialPaper, error)
- type ValidatorInterface
Constants ¶
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 ¶
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 ¶
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 CPaperChaincode ¶
type CPaperChaincode interface { List(cckit_router.Context, *empty.Empty) (*schema.CommercialPaperList, error) Get(cckit_router.Context, *schema.CommercialPaperId) (*schema.CommercialPaper, error) GetByExternalId(cckit_router.Context, *schema.ExternalId) (*schema.CommercialPaper, error) Issue(cckit_router.Context, *schema.IssueCommercialPaper) (*schema.CommercialPaper, error) Buy(cckit_router.Context, *schema.BuyCommercialPaper) (*schema.CommercialPaper, error) Redeem(cckit_router.Context, *schema.RedeemCommercialPaper) (*schema.CommercialPaper, error) Delete(cckit_router.Context, *schema.CommercialPaperId) (*schema.CommercialPaper, error) }
CPaperChaincode chaincode methods interface
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
func (c *CPaperGateway) ApiDef() cckit_gateway.ServiceDef
ApiDef returns service definition
func (*CPaperGateway) Buy ¶
func (c *CPaperGateway) Buy(ctx context.Context, in *schema.BuyCommercialPaper) (*schema.CommercialPaper, error)
func (*CPaperGateway) Delete ¶
func (c *CPaperGateway) Delete(ctx context.Context, in *schema.CommercialPaperId) (*schema.CommercialPaper, error)
func (*CPaperGateway) Events ¶ added in v0.6.0
func (c *CPaperGateway) Events(ctx context.Context) (cckit_gateway.ChaincodeEventSub, error)
Events returns events subscription
func (*CPaperGateway) Get ¶
func (c *CPaperGateway) Get(ctx context.Context, in *schema.CommercialPaperId) (*schema.CommercialPaper, error)
func (*CPaperGateway) GetByExternalId ¶
func (c *CPaperGateway) GetByExternalId(ctx context.Context, in *schema.ExternalId) (*schema.CommercialPaper, error)
func (*CPaperGateway) Issue ¶
func (c *CPaperGateway) Issue(ctx context.Context, in *schema.IssueCommercialPaper) (*schema.CommercialPaper, error)
func (*CPaperGateway) List ¶
func (c *CPaperGateway) List(ctx context.Context, in *empty.Empty) (*schema.CommercialPaperList, error)
func (*CPaperGateway) Redeem ¶
func (c *CPaperGateway) Redeem(ctx context.Context, in *schema.RedeemCommercialPaper) (*schema.CommercialPaper, error)
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 (cc *CPaperImpl) Buy(ctx router.Context, buy *schema.BuyCommercialPaper) (*schema.CommercialPaper, error)
func (*CPaperImpl) Delete ¶ added in v0.6.1
func (cc *CPaperImpl) Delete(ctx router.Context, id *schema.CommercialPaperId) (*schema.CommercialPaper, error)
func (*CPaperImpl) Get ¶ added in v0.6.1
func (cc *CPaperImpl) Get(ctx router.Context, id *schema.CommercialPaperId) (*schema.CommercialPaper, error)
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 (cc *CPaperImpl) Issue(ctx router.Context, issue *schema.IssueCommercialPaper) (*schema.CommercialPaper, error)
func (*CPaperImpl) List ¶ added in v0.6.1
func (cc *CPaperImpl) List(ctx router.Context, in *empty.Empty) (*schema.CommercialPaperList, error)
func (*CPaperImpl) Redeem ¶ added in v0.6.1
func (cc *CPaperImpl) Redeem(ctx router.Context, redeem *schema.RedeemCommercialPaper) (*schema.CommercialPaper, error)
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) Buy(context.Context, *schema.BuyCommercialPaper) (*schema.CommercialPaper, error)
func (*UnimplementedCPaperServer) Delete ¶ added in v0.7.0
func (*UnimplementedCPaperServer) Delete(context.Context, *schema.CommercialPaperId) (*schema.CommercialPaper, error)
func (*UnimplementedCPaperServer) Get ¶ added in v0.7.0
func (*UnimplementedCPaperServer) Get(context.Context, *schema.CommercialPaperId) (*schema.CommercialPaper, error)
func (*UnimplementedCPaperServer) GetByExternalId ¶ added in v0.7.0
func (*UnimplementedCPaperServer) GetByExternalId(context.Context, *schema.ExternalId) (*schema.CommercialPaper, error)
func (*UnimplementedCPaperServer) Issue ¶ added in v0.7.0
func (*UnimplementedCPaperServer) Issue(context.Context, *schema.IssueCommercialPaper) (*schema.CommercialPaper, error)
func (*UnimplementedCPaperServer) List ¶ added in v0.7.0
func (*UnimplementedCPaperServer) List(context.Context, *empty.Empty) (*schema.CommercialPaperList, error)
func (*UnimplementedCPaperServer) Redeem ¶ added in v0.7.0
func (*UnimplementedCPaperServer) Redeem(context.Context, *schema.RedeemCommercialPaper) (*schema.CommercialPaper, error)
type ValidatorInterface ¶ added in v0.6.0
type ValidatorInterface interface {
Validate() error
}