cpaper_asservice

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2024 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Overview

Package cpaper_asservice 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_asservice is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (

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

	CPaperServiceChaincode_List = CPaperServiceChaincodeMethodPrefix + "List"

	CPaperServiceChaincode_Get = CPaperServiceChaincodeMethodPrefix + "Get"

	CPaperServiceChaincode_GetByExternalId = CPaperServiceChaincodeMethodPrefix + "GetByExternalId"

	CPaperServiceChaincode_Issue = CPaperServiceChaincodeMethodPrefix + "Issue"

	CPaperServiceChaincode_Buy = CPaperServiceChaincodeMethodPrefix + "Buy"

	CPaperServiceChaincode_Redeem = CPaperServiceChaincodeMethodPrefix + "Redeem"

	CPaperServiceChaincode_Delete = CPaperServiceChaincodeMethodPrefix + "Delete"
)

CPaperServiceChaincode method names

Variables

View Source
var (
	CommercialPaper_State_name = map[int32]string{
		0: "STATE_ISSUED",
		1: "STATE_TRADING",
		2: "STATE_REDEEMED",
	}
	CommercialPaper_State_value = map[string]int32{
		"STATE_ISSUED":   0,
		"STATE_TRADING":  1,
		"STATE_REDEEMED": 2,
	}
)

Enum value maps for CommercialPaper_State.

View Source
var (
	StateMappings = m.StateMappings{}.
					Add(&CommercialPaper{},
			m.PKeySchema(&CommercialPaperId{}),
			m.List(&CommercialPaperList{}),
			m.UniqKey("ExternalId"),
		)

	EventMappings = m.EventMappings{}.
					Add(&IssueCommercialPaper{}).
					Add(&BuyCommercialPaper{}).
					Add(&RedeemCommercialPaper{})
)
View Source
var CPaperServiceSwagger []byte
View Source
var File_cpaper_asservice_cpaper_proto protoreflect.FileDescriptor

Functions

func CCRouter

func CCRouter(name string) (*router.Group, error)

func Event

func Event(ctx router.Context) state.Event

Event with chaincode mappings

func NewCC

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

func NewCCEncrypted

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

func RegisterCPaperServiceChaincode

func RegisterCPaperServiceChaincode(r *cckit_router.Group, cc CPaperServiceChaincode) error

RegisterCPaperServiceChaincode registers service methods as chaincode router handlers

func RegisterCPaperServiceHandler

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

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

func RegisterCPaperServiceHandlerClient

func RegisterCPaperServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client CPaperServiceClient) error

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

func RegisterCPaperServiceHandlerFromEndpoint

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

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

func RegisterCPaperServiceHandlerServer

func RegisterCPaperServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server CPaperServiceServer) error

RegisterCPaperServiceHandlerServer registers the http handlers for service CPaperService to "mux". UnaryRPC :call CPaperServiceServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterCPaperServiceHandlerFromEndpoint instead.

func RegisterCPaperServiceServer

func RegisterCPaperServiceServer(s *grpc.Server, srv CPaperServiceServer)

func State

func State(ctx router.Context) m.MappedState

State with chaincode mappings

Types

type BuyCommercialPaper

type BuyCommercialPaper 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"`
	CurrentOwner string                 `protobuf:"bytes,3,opt,name=current_owner,json=currentOwner,proto3" json:"current_owner,omitempty"`
	NewOwner     string                 `protobuf:"bytes,4,opt,name=new_owner,json=newOwner,proto3" json:"new_owner,omitempty"`
	Price        int32                  `protobuf:"varint,5,opt,name=price,proto3" json:"price,omitempty"`
	PurchaseDate *timestamppb.Timestamp `protobuf:"bytes,6,opt,name=purchase_date,json=purchaseDate,proto3" json:"purchase_date,omitempty"`
	// contains filtered or unexported fields
}

BuyCommercialPaper event

func (*BuyCommercialPaper) Descriptor deprecated

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

Deprecated: Use BuyCommercialPaper.ProtoReflect.Descriptor instead.

func (*BuyCommercialPaper) GetCurrentOwner

func (x *BuyCommercialPaper) GetCurrentOwner() string

func (*BuyCommercialPaper) GetIssuer

func (x *BuyCommercialPaper) GetIssuer() string

func (*BuyCommercialPaper) GetNewOwner

func (x *BuyCommercialPaper) GetNewOwner() string

func (*BuyCommercialPaper) GetPaperNumber

func (x *BuyCommercialPaper) GetPaperNumber() string

func (*BuyCommercialPaper) GetPrice

func (x *BuyCommercialPaper) GetPrice() int32

func (*BuyCommercialPaper) GetPurchaseDate

func (x *BuyCommercialPaper) GetPurchaseDate() *timestamppb.Timestamp

func (*BuyCommercialPaper) ProtoMessage

func (*BuyCommercialPaper) ProtoMessage()

func (*BuyCommercialPaper) ProtoReflect

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

func (*BuyCommercialPaper) Reset

func (x *BuyCommercialPaper) Reset()

func (*BuyCommercialPaper) String

func (x *BuyCommercialPaper) String() string

func (*BuyCommercialPaper) Validate

func (this *BuyCommercialPaper) Validate() error

type CPaperService

type CPaperService struct {
}

func NewService

func NewService() *CPaperService

func (*CPaperService) Buy

func (*CPaperService) Delete

func (*CPaperService) Get

func (*CPaperService) GetByExternalId

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

func (*CPaperService) Issue

func (*CPaperService) List

func (*CPaperService) Redeem

type CPaperServiceChaincodeLocalResolver

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

CPaperServiceChaincodeResolver interface for service resolver

func (*CPaperServiceChaincodeLocalResolver) Resolve

type CPaperServiceChaincodeLocatorResolver

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

CPaperServiceChaincodeResolver interface for service resolver

func (*CPaperServiceChaincodeLocatorResolver) Resolve

type CPaperServiceChaincodeResolver

type CPaperServiceChaincodeResolver interface {
	Resolve(ctx cckit_router.Context) (CPaperServiceChaincode, error)
}

CPaperServiceChaincodeResolver interface for service resolver

type CPaperServiceChaincodeStubInvoker

type CPaperServiceChaincodeStubInvoker struct {
	Invoker cckit_gateway.ChaincodeStubInvoker
}

func (*CPaperServiceChaincodeStubInvoker) Buy

func (*CPaperServiceChaincodeStubInvoker) Delete

func (*CPaperServiceChaincodeStubInvoker) Get

func (*CPaperServiceChaincodeStubInvoker) GetByExternalId

func (*CPaperServiceChaincodeStubInvoker) Issue

func (*CPaperServiceChaincodeStubInvoker) List

func (*CPaperServiceChaincodeStubInvoker) Redeem

type CPaperServiceClient

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

CPaperServiceClient is the client API for CPaperService service.

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

type CPaperServiceGateway

type CPaperServiceGateway 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 NewCPaperServiceGateway

func NewCPaperServiceGateway(sdk cckit_sdk.SDK, channel, chaincode string, opts ...cckit_gateway.Opt) *CPaperServiceGateway

NewCPaperServiceGateway creates gateway to access chaincode method via chaincode service

func NewCPaperServiceGatewayFromInstance

func NewCPaperServiceGatewayFromInstance(chaincodeInstance cckit_gateway.ChaincodeInstance) *CPaperServiceGateway

func (*CPaperServiceGateway) Buy

func (*CPaperServiceGateway) Delete

func (*CPaperServiceGateway) Get

func (*CPaperServiceGateway) GetByExternalId

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

func (*CPaperServiceGateway) Invoker

func (*CPaperServiceGateway) Issue

func (*CPaperServiceGateway) List

func (*CPaperServiceGateway) Redeem

func (*CPaperServiceGateway) ServiceDef

ServiceDef returns service definition

type CPaperServiceServer

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

CPaperServiceServer is the server API for CPaperService service.

type CommercialPaper

type CommercialPaper struct {

	// Issuer and Paper number comprises composite primary key of Commercial paper entry
	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"`
	IssueDate    *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=issue_date,json=issueDate,proto3" json:"issue_date,omitempty"`
	MaturityDate *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=maturity_date,json=maturityDate,proto3" json:"maturity_date,omitempty"`
	FaceValue    int32                  `protobuf:"varint,6,opt,name=face_value,json=faceValue,proto3" json:"face_value,omitempty"`
	State        CommercialPaper_State  `protobuf:"varint,7,opt,name=state,proto3,enum=examples.cpaper_asservice.CommercialPaper_State" json:"state,omitempty"`
	// Additional unique field for entry
	ExternalId string `protobuf:"bytes,8,opt,name=external_id,json=externalId,proto3" json:"external_id,omitempty"`
	// contains filtered or unexported fields
}

Commercial Paper state entry

func (*CommercialPaper) Descriptor deprecated

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

Deprecated: Use CommercialPaper.ProtoReflect.Descriptor instead.

func (*CommercialPaper) GetExternalId

func (x *CommercialPaper) GetExternalId() string

func (*CommercialPaper) GetFaceValue

func (x *CommercialPaper) GetFaceValue() int32

func (*CommercialPaper) GetIssueDate

func (x *CommercialPaper) GetIssueDate() *timestamppb.Timestamp

func (*CommercialPaper) GetIssuer

func (x *CommercialPaper) GetIssuer() string

func (*CommercialPaper) GetMaturityDate

func (x *CommercialPaper) GetMaturityDate() *timestamppb.Timestamp

func (*CommercialPaper) GetOwner

func (x *CommercialPaper) GetOwner() string

func (*CommercialPaper) GetPaperNumber

func (x *CommercialPaper) GetPaperNumber() string

func (*CommercialPaper) GetState

func (x *CommercialPaper) GetState() CommercialPaper_State

func (*CommercialPaper) ProtoMessage

func (*CommercialPaper) ProtoMessage()

func (*CommercialPaper) ProtoReflect

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

func (*CommercialPaper) Reset

func (x *CommercialPaper) Reset()

func (*CommercialPaper) String

func (x *CommercialPaper) String() string

func (*CommercialPaper) Validate

func (this *CommercialPaper) Validate() error

type CommercialPaperId

type CommercialPaperId 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
}

CommercialPaperId identifier part

func (*CommercialPaperId) Descriptor deprecated

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

Deprecated: Use CommercialPaperId.ProtoReflect.Descriptor instead.

func (*CommercialPaperId) GetIssuer

func (x *CommercialPaperId) GetIssuer() string

func (*CommercialPaperId) GetPaperNumber

func (x *CommercialPaperId) GetPaperNumber() string

func (*CommercialPaperId) ProtoMessage

func (*CommercialPaperId) ProtoMessage()

func (*CommercialPaperId) ProtoReflect

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

func (*CommercialPaperId) Reset

func (x *CommercialPaperId) Reset()

func (*CommercialPaperId) String

func (x *CommercialPaperId) String() string

func (*CommercialPaperId) Validate

func (this *CommercialPaperId) Validate() error

type CommercialPaperList

type CommercialPaperList struct {
	Items []*CommercialPaper `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"`
	// contains filtered or unexported fields
}

Container for returning multiple entities

func (*CommercialPaperList) Descriptor deprecated

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

Deprecated: Use CommercialPaperList.ProtoReflect.Descriptor instead.

func (*CommercialPaperList) GetItems

func (x *CommercialPaperList) GetItems() []*CommercialPaper

func (*CommercialPaperList) ProtoMessage

func (*CommercialPaperList) ProtoMessage()

func (*CommercialPaperList) ProtoReflect

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

func (*CommercialPaperList) Reset

func (x *CommercialPaperList) Reset()

func (*CommercialPaperList) String

func (x *CommercialPaperList) String() string

func (*CommercialPaperList) Validate

func (this *CommercialPaperList) Validate() error

type CommercialPaper_State

type CommercialPaper_State int32
const (
	CommercialPaper_STATE_ISSUED   CommercialPaper_State = 0
	CommercialPaper_STATE_TRADING  CommercialPaper_State = 1
	CommercialPaper_STATE_REDEEMED CommercialPaper_State = 2
)

func (CommercialPaper_State) Descriptor

func (CommercialPaper_State) Enum

func (CommercialPaper_State) EnumDescriptor deprecated

func (CommercialPaper_State) EnumDescriptor() ([]byte, []int)

Deprecated: Use CommercialPaper_State.Descriptor instead.

func (CommercialPaper_State) Number

func (CommercialPaper_State) String

func (x CommercialPaper_State) String() string

func (CommercialPaper_State) Type

type ExternalId

type ExternalId struct {
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// contains filtered or unexported fields
}

ExternalId

func (*ExternalId) Descriptor deprecated

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

Deprecated: Use ExternalId.ProtoReflect.Descriptor instead.

func (*ExternalId) GetId

func (x *ExternalId) GetId() string

func (*ExternalId) ProtoMessage

func (*ExternalId) ProtoMessage()

func (*ExternalId) ProtoReflect

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

func (*ExternalId) Reset

func (x *ExternalId) Reset()

func (*ExternalId) String

func (x *ExternalId) String() string

func (*ExternalId) Validate

func (this *ExternalId) Validate() error

type IssueCommercialPaper

type IssueCommercialPaper 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"`
	IssueDate    *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=issue_date,json=issueDate,proto3" json:"issue_date,omitempty"`
	MaturityDate *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=maturity_date,json=maturityDate,proto3" json:"maturity_date,omitempty"`
	FaceValue    int32                  `protobuf:"varint,5,opt,name=face_value,json=faceValue,proto3" json:"face_value,omitempty"`
	// external_id  - once more uniq id of state entry
	ExternalId string `protobuf:"bytes,6,opt,name=external_id,json=externalId,proto3" json:"external_id,omitempty"`
	// contains filtered or unexported fields
}

IssueCommercialPaper event

func (*IssueCommercialPaper) Descriptor deprecated

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

Deprecated: Use IssueCommercialPaper.ProtoReflect.Descriptor instead.

func (*IssueCommercialPaper) GetExternalId

func (x *IssueCommercialPaper) GetExternalId() string

func (*IssueCommercialPaper) GetFaceValue

func (x *IssueCommercialPaper) GetFaceValue() int32

func (*IssueCommercialPaper) GetIssueDate

func (x *IssueCommercialPaper) GetIssueDate() *timestamppb.Timestamp

func (*IssueCommercialPaper) GetIssuer

func (x *IssueCommercialPaper) GetIssuer() string

func (*IssueCommercialPaper) GetMaturityDate

func (x *IssueCommercialPaper) GetMaturityDate() *timestamppb.Timestamp

func (*IssueCommercialPaper) GetPaperNumber

func (x *IssueCommercialPaper) GetPaperNumber() string

func (*IssueCommercialPaper) ProtoMessage

func (*IssueCommercialPaper) ProtoMessage()

func (*IssueCommercialPaper) ProtoReflect

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

func (*IssueCommercialPaper) Reset

func (x *IssueCommercialPaper) Reset()

func (*IssueCommercialPaper) String

func (x *IssueCommercialPaper) String() string

func (*IssueCommercialPaper) Validate

func (this *IssueCommercialPaper) Validate() error

type RedeemCommercialPaper

type RedeemCommercialPaper 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"`
	RedeemingOwner string                 `protobuf:"bytes,3,opt,name=redeeming_owner,json=redeemingOwner,proto3" json:"redeeming_owner,omitempty"`
	RedeemDate     *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=redeem_date,json=redeemDate,proto3" json:"redeem_date,omitempty"`
	// contains filtered or unexported fields
}

RedeemCommercialPaper event

func (*RedeemCommercialPaper) Descriptor deprecated

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

Deprecated: Use RedeemCommercialPaper.ProtoReflect.Descriptor instead.

func (*RedeemCommercialPaper) GetIssuer

func (x *RedeemCommercialPaper) GetIssuer() string

func (*RedeemCommercialPaper) GetPaperNumber

func (x *RedeemCommercialPaper) GetPaperNumber() string

func (*RedeemCommercialPaper) GetRedeemDate

func (x *RedeemCommercialPaper) GetRedeemDate() *timestamppb.Timestamp

func (*RedeemCommercialPaper) GetRedeemingOwner

func (x *RedeemCommercialPaper) GetRedeemingOwner() string

func (*RedeemCommercialPaper) ProtoMessage

func (*RedeemCommercialPaper) ProtoMessage()

func (*RedeemCommercialPaper) ProtoReflect

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

func (*RedeemCommercialPaper) Reset

func (x *RedeemCommercialPaper) Reset()

func (*RedeemCommercialPaper) String

func (x *RedeemCommercialPaper) String() string

func (*RedeemCommercialPaper) Validate

func (this *RedeemCommercialPaper) Validate() error

type UnimplementedCPaperServiceServer

type UnimplementedCPaperServiceServer struct {
}

UnimplementedCPaperServiceServer can be embedded to have forward compatible implementations.

func (*UnimplementedCPaperServiceServer) Buy

func (*UnimplementedCPaperServiceServer) Delete

func (*UnimplementedCPaperServiceServer) Get

func (*UnimplementedCPaperServiceServer) GetByExternalId

func (*UnimplementedCPaperServiceServer) Issue

func (*UnimplementedCPaperServiceServer) List

func (*UnimplementedCPaperServiceServer) Redeem

Directories

Path Synopsis
bin

Jump to

Keyboard shortcuts

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