config

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: 29 Imported by: 0

Documentation

Overview

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

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (

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

	ConfigServiceChaincode_GetName = ConfigServiceChaincodeMethodPrefix + "GetName"

	ConfigServiceChaincode_GetSymbol = ConfigServiceChaincodeMethodPrefix + "GetSymbol"

	ConfigServiceChaincode_GetDecimals = ConfigServiceChaincodeMethodPrefix + "GetDecimals"

	ConfigServiceChaincode_GetTotalSupply = ConfigServiceChaincodeMethodPrefix + "GetTotalSupply"
)

ConfigServiceChaincode method names

Variables

View Source
var ConfigServiceSwagger []byte
View Source
var File_erc20_utxo_service_config_config_proto protoreflect.FileDescriptor

Functions

func RegisterConfigServiceChaincode

func RegisterConfigServiceChaincode(r *cckit_router.Group, cc ConfigServiceChaincode) error

RegisterConfigServiceChaincode registers service methods as chaincode router handlers

func RegisterConfigServiceHandler

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

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

func RegisterConfigServiceHandlerClient

func RegisterConfigServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ConfigServiceClient) error

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

func RegisterConfigServiceHandlerFromEndpoint

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

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

func RegisterConfigServiceHandlerServer

func RegisterConfigServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ConfigServiceServer) error

RegisterConfigServiceHandlerServer registers the http handlers for service ConfigService to "mux". UnaryRPC :call ConfigServiceServer 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 RegisterConfigServiceHandlerFromEndpoint instead.

func RegisterConfigServiceServer

func RegisterConfigServiceServer(s *grpc.Server, srv ConfigServiceServer)

Types

type ConfigServiceChaincode

type ConfigServiceChaincode interface {
	GetName(cckit_router.Context, *emptypb.Empty) (*NameResponse, error)

	GetSymbol(cckit_router.Context, *emptypb.Empty) (*SymbolResponse, error)

	GetDecimals(cckit_router.Context, *emptypb.Empty) (*DecimalsResponse, error)

	GetTotalSupply(cckit_router.Context, *emptypb.Empty) (*TotalSupplyResponse, error)
}

ConfigServiceChaincode chaincode methods interface

type ConfigServiceChaincodeLocalResolver

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

ConfigServiceChaincodeResolver interface for service resolver

func (*ConfigServiceChaincodeLocalResolver) Resolve

type ConfigServiceChaincodeLocatorResolver

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

ConfigServiceChaincodeResolver interface for service resolver

func (*ConfigServiceChaincodeLocatorResolver) Resolve

type ConfigServiceChaincodeResolver

type ConfigServiceChaincodeResolver interface {
	Resolve(ctx cckit_router.Context) (ConfigServiceChaincode, error)
}

ConfigServiceChaincodeResolver interface for service resolver

type ConfigServiceChaincodeStubInvoker

type ConfigServiceChaincodeStubInvoker struct {
	Invoker cckit_gateway.ChaincodeStubInvoker
}

func (*ConfigServiceChaincodeStubInvoker) GetDecimals

func (*ConfigServiceChaincodeStubInvoker) GetName

func (*ConfigServiceChaincodeStubInvoker) GetSymbol

func (*ConfigServiceChaincodeStubInvoker) GetTotalSupply

type ConfigServiceClient

type ConfigServiceClient interface {
	// Returns the name of the token.
	GetName(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*NameResponse, error)
	// Returns the symbol of the token, usually a shorter version of the name.
	GetSymbol(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*SymbolResponse, error)
	// Returns the number of decimals used to get its user representation.
	// For example, if decimals equals 2, a balance of 505 tokens should be displayed to a user as 5,05 (505 / 10 ** 2).
	GetDecimals(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*DecimalsResponse, error)
	// Returns the amount of tokens in existence.
	GetTotalSupply(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*TotalSupplyResponse, error)
}

ConfigServiceClient is the client API for ConfigService service.

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

type ConfigServiceGateway

type ConfigServiceGateway 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 NewConfigServiceGateway

func NewConfigServiceGateway(sdk cckit_sdk.SDK, channel, chaincode string, opts ...cckit_gateway.Opt) *ConfigServiceGateway

NewConfigServiceGateway creates gateway to access chaincode method via chaincode service

func NewConfigServiceGatewayFromInstance

func NewConfigServiceGatewayFromInstance(chaincodeInstance cckit_gateway.ChaincodeInstance) *ConfigServiceGateway

func (*ConfigServiceGateway) GetDecimals

func (*ConfigServiceGateway) GetName

func (*ConfigServiceGateway) GetSymbol

func (*ConfigServiceGateway) GetTotalSupply

func (c *ConfigServiceGateway) GetTotalSupply(ctx context.Context, in *emptypb.Empty) (*TotalSupplyResponse, error)

func (*ConfigServiceGateway) Invoker

func (*ConfigServiceGateway) ServiceDef

ServiceDef returns service definition

type ConfigServiceServer

type ConfigServiceServer interface {
	// Returns the name of the token.
	GetName(context.Context, *emptypb.Empty) (*NameResponse, error)
	// Returns the symbol of the token, usually a shorter version of the name.
	GetSymbol(context.Context, *emptypb.Empty) (*SymbolResponse, error)
	// Returns the number of decimals used to get its user representation.
	// For example, if decimals equals 2, a balance of 505 tokens should be displayed to a user as 5,05 (505 / 10 ** 2).
	GetDecimals(context.Context, *emptypb.Empty) (*DecimalsResponse, error)
	// Returns the amount of tokens in existence.
	GetTotalSupply(context.Context, *emptypb.Empty) (*TotalSupplyResponse, error)
}

ConfigServiceServer is the server API for ConfigService service.

type DecimalsResponse

type DecimalsResponse struct {
	Decimals uint32 `protobuf:"varint,1,opt,name=decimals,proto3" json:"decimals,omitempty"`
	// contains filtered or unexported fields
}

func (*DecimalsResponse) Descriptor deprecated

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

Deprecated: Use DecimalsResponse.ProtoReflect.Descriptor instead.

func (*DecimalsResponse) GetDecimals

func (x *DecimalsResponse) GetDecimals() uint32

func (*DecimalsResponse) ProtoMessage

func (*DecimalsResponse) ProtoMessage()

func (*DecimalsResponse) ProtoReflect

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

func (*DecimalsResponse) Reset

func (x *DecimalsResponse) Reset()

func (*DecimalsResponse) String

func (x *DecimalsResponse) String() string

func (*DecimalsResponse) Validate

func (this *DecimalsResponse) Validate() error

type NameResponse

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

func (*NameResponse) Descriptor deprecated

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

Deprecated: Use NameResponse.ProtoReflect.Descriptor instead.

func (*NameResponse) GetName

func (x *NameResponse) GetName() string

func (*NameResponse) ProtoMessage

func (*NameResponse) ProtoMessage()

func (*NameResponse) ProtoReflect

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

func (*NameResponse) Reset

func (x *NameResponse) Reset()

func (*NameResponse) String

func (x *NameResponse) String() string

func (*NameResponse) Validate

func (this *NameResponse) Validate() error

type Service

type Service struct {
	Token token.TokenGetter
}

func NewService

func NewService(tokenGetter token.TokenGetter) *Service

func (*Service) GetDecimals

func (s *Service) GetDecimals(ctx router.Context, e *emptypb.Empty) (*DecimalsResponse, error)

func (*Service) GetName

func (s *Service) GetName(ctx router.Context, e *emptypb.Empty) (*NameResponse, error)

func (*Service) GetSymbol

func (s *Service) GetSymbol(ctx router.Context, e *emptypb.Empty) (*SymbolResponse, error)

func (*Service) GetTotalSupply

func (s *Service) GetTotalSupply(ctx router.Context, e *emptypb.Empty) (*TotalSupplyResponse, error)

type SymbolResponse

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

func (*SymbolResponse) Descriptor deprecated

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

Deprecated: Use SymbolResponse.ProtoReflect.Descriptor instead.

func (*SymbolResponse) GetSymbol

func (x *SymbolResponse) GetSymbol() string

func (*SymbolResponse) ProtoMessage

func (*SymbolResponse) ProtoMessage()

func (*SymbolResponse) ProtoReflect

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

func (*SymbolResponse) Reset

func (x *SymbolResponse) Reset()

func (*SymbolResponse) String

func (x *SymbolResponse) String() string

func (*SymbolResponse) Validate

func (this *SymbolResponse) Validate() error

type TotalSupplyResponse

type TotalSupplyResponse struct {
	TotalSupply *decimal.Decimal `protobuf:"bytes,1,opt,name=total_supply,json=totalSupply,proto3" json:"total_supply,omitempty"`
	// contains filtered or unexported fields
}

func (*TotalSupplyResponse) Descriptor deprecated

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

Deprecated: Use TotalSupplyResponse.ProtoReflect.Descriptor instead.

func (*TotalSupplyResponse) GetTotalSupply

func (x *TotalSupplyResponse) GetTotalSupply() *decimal.Decimal

func (*TotalSupplyResponse) ProtoMessage

func (*TotalSupplyResponse) ProtoMessage()

func (*TotalSupplyResponse) ProtoReflect

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

func (*TotalSupplyResponse) Reset

func (x *TotalSupplyResponse) Reset()

func (*TotalSupplyResponse) String

func (x *TotalSupplyResponse) String() string

func (*TotalSupplyResponse) Validate

func (this *TotalSupplyResponse) Validate() error

type UnimplementedConfigServiceServer

type UnimplementedConfigServiceServer struct {
}

UnimplementedConfigServiceServer can be embedded to have forward compatible implementations.

func (*UnimplementedConfigServiceServer) GetDecimals

func (*UnimplementedConfigServiceServer) GetName

func (*UnimplementedConfigServiceServer) GetSymbol

func (*UnimplementedConfigServiceServer) GetTotalSupply

Jump to

Keyboard shortcuts

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