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
- 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 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 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 ¶
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 ¶
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 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.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 ¶
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 ¶
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 ¶
type CPaperImpl struct { }
func New ¶
func New() *CPaperImpl
func (*CPaperImpl) Buy ¶
func (cc *CPaperImpl) Buy(ctx router.Context, buy *schema.BuyCommercialPaper) (*schema.CommercialPaper, error)
func (*CPaperImpl) Delete ¶
func (cc *CPaperImpl) Delete(ctx router.Context, id *schema.CommercialPaperId) (*schema.CommercialPaper, error)
func (*CPaperImpl) Get ¶
func (cc *CPaperImpl) Get(ctx router.Context, id *schema.CommercialPaperId) (*schema.CommercialPaper, error)
func (*CPaperImpl) GetByExternalId ¶
func (cc *CPaperImpl) GetByExternalId(ctx router.Context, id *schema.ExternalId) (*schema.CommercialPaper, error)
func (*CPaperImpl) Issue ¶
func (cc *CPaperImpl) Issue(ctx router.Context, issue *schema.IssueCommercialPaper) (*schema.CommercialPaper, error)
func (*CPaperImpl) List ¶
func (cc *CPaperImpl) List(ctx router.Context, in *empty.Empty) (*schema.CommercialPaperList, error)
func (*CPaperImpl) Redeem ¶
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 ValidatorInterface ¶
type ValidatorInterface interface {
Validate() error
}