Documentation ¶
Overview ¶
Package account 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 account is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Constants
- Variables
- func RegisterAccountServiceChaincode(r *cckit_router.Group, cc AccountServiceChaincode) error
- func RegisterAccountServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterAccountServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client AccountServiceClient) error
- func RegisterAccountServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterAccountServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server AccountServiceServer) error
- func RegisterAccountServiceServer(s *grpc.Server, srv AccountServiceServer)
- type Account
- func (*Account) Descriptor() ([]byte, []int)deprecated
- func (x *Account) GetAddress() string
- func (x *Account) GetStatus() AccountStatus
- func (*Account) ProtoMessage()
- func (x *Account) ProtoReflect() protoreflect.Message
- func (x *Account) Reset()
- func (x *Account) String() string
- func (this *Account) Validate() error
- type AccountId
- type AccountKey
- func (*AccountKey) Descriptor() ([]byte, []int)deprecated
- func (x *AccountKey) GetPublicKey() []byte
- func (x *AccountKey) GetStatus() KeyStatus
- func (*AccountKey) ProtoMessage()
- func (x *AccountKey) ProtoReflect() protoreflect.Message
- func (x *AccountKey) Reset()
- func (x *AccountKey) String() string
- func (this *AccountKey) Validate() error
- type AccountServiceChaincode
- type AccountServiceClient
- type AccountServiceGateway
- func (c *AccountServiceGateway) GetAccount(ctx context.Context, in *AccountId) (*Account, error)
- func (c *AccountServiceGateway) GetAddress(ctx context.Context, in *GetAddressRequest) (*AddressId, error)
- func (c *AccountServiceGateway) GetInvokerAddress(ctx context.Context, in *emptypb.Empty) (*AddressId, error)
- func (c *AccountServiceGateway) Invoker() cckit_gateway.ChaincodeInstanceInvoker
- func (c *AccountServiceGateway) ServiceDef() cckit_gateway.ServiceDef
- type AccountServiceServer
- type AccountStatus
- func (AccountStatus) Descriptor() protoreflect.EnumDescriptor
- func (x AccountStatus) Enum() *AccountStatus
- func (AccountStatus) EnumDescriptor() ([]byte, []int)deprecated
- func (x AccountStatus) Number() protoreflect.EnumNumber
- func (x AccountStatus) String() string
- func (AccountStatus) Type() protoreflect.EnumType
- type Address
- type AddressId
- type GetAccountRequest
- func (*GetAccountRequest) Descriptor() ([]byte, []int)deprecated
- func (x *GetAccountRequest) GetAddress() string
- func (*GetAccountRequest) ProtoMessage()
- func (x *GetAccountRequest) ProtoReflect() protoreflect.Message
- func (x *GetAccountRequest) Reset()
- func (x *GetAccountRequest) String() string
- func (this *GetAccountRequest) Validate() error
- type GetAddressRequest
- func (*GetAddressRequest) Descriptor() ([]byte, []int)deprecated
- func (x *GetAddressRequest) GetPublicKey() []byte
- func (*GetAddressRequest) ProtoMessage()
- func (x *GetAddressRequest) ProtoReflect() protoreflect.Message
- func (x *GetAddressRequest) Reset()
- func (x *GetAddressRequest) String() string
- func (this *GetAddressRequest) Validate() error
- type Getter
- type KeyStatus
- type LocalService
- type Remote
- type UnimplementedAccountServiceServer
- func (*UnimplementedAccountServiceServer) GetAccount(context.Context, *AccountId) (*Account, error)
- func (*UnimplementedAccountServiceServer) GetAddress(context.Context, *GetAddressRequest) (*AddressId, error)
- func (*UnimplementedAccountServiceServer) GetInvokerAddress(context.Context, *emptypb.Empty) (*AddressId, error)
Constants ¶
const ( // AccountServiceChaincodeMethodPrefix allows to use multiple services with same method names in one chaincode AccountServiceChaincodeMethodPrefix = "AccountService." AccountServiceChaincode_GetInvokerAddress = AccountServiceChaincodeMethodPrefix + "GetInvokerAddress" AccountServiceChaincode_GetAddress = AccountServiceChaincodeMethodPrefix + "GetAddress" AccountServiceChaincode_GetAccount = AccountServiceChaincodeMethodPrefix + "GetAccount" )
AccountServiceChaincode method names
Variables ¶
var ( KeyStatus_name = map[int32]string{ 0: "KEY_STATUS_UNKNOWN", 1: "KEY_STATUS_ENABLED", 2: "KEY_STATUS_DISABLED", } KeyStatus_value = map[string]int32{ "KEY_STATUS_UNKNOWN": 0, "KEY_STATUS_ENABLED": 1, "KEY_STATUS_DISABLED": 2, } )
Enum value maps for KeyStatus.
var ( AccountStatus_name = map[int32]string{ 0: "ACCOUNT_STATUS_UNKNOWN", 1: "ACCOUNT_STATUS_ENABLED", 2: "ACCOUNT_STATUS_DISABLED", } AccountStatus_value = map[string]int32{ "ACCOUNT_STATUS_UNKNOWN": 0, "ACCOUNT_STATUS_ENABLED": 1, "ACCOUNT_STATUS_DISABLED": 2, } )
Enum value maps for AccountStatus.
var AccountServiceSwagger []byte
var File_account_account_proto protoreflect.FileDescriptor
Functions ¶
func RegisterAccountServiceChaincode ¶
func RegisterAccountServiceChaincode(r *cckit_router.Group, cc AccountServiceChaincode) error
RegisterAccountServiceChaincode registers service methods as chaincode router handlers
func RegisterAccountServiceHandler ¶
func RegisterAccountServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterAccountServiceHandler registers the http handlers for service AccountService to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterAccountServiceHandlerClient ¶
func RegisterAccountServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client AccountServiceClient) error
RegisterAccountServiceHandlerClient registers the http handlers for service AccountService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "AccountServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "AccountServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "AccountServiceClient" to call the correct interceptors.
func RegisterAccountServiceHandlerFromEndpoint ¶
func RegisterAccountServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterAccountServiceHandlerFromEndpoint is same as RegisterAccountServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterAccountServiceHandlerServer ¶
func RegisterAccountServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server AccountServiceServer) error
RegisterAccountServiceHandlerServer registers the http handlers for service AccountService to "mux". UnaryRPC :call AccountServiceServer 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 RegisterAccountServiceHandlerFromEndpoint instead.
func RegisterAccountServiceServer ¶
func RegisterAccountServiceServer(s *grpc.Server, srv AccountServiceServer)
Types ¶
type Account ¶
type Account struct { Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` Status AccountStatus `protobuf:"varint,2,opt,name=status,proto3,enum=extensions.account.AccountStatus" json:"status,omitempty"` // contains filtered or unexported fields }
func (*Account) Descriptor
deprecated
func (*Account) GetAddress ¶
func (*Account) GetStatus ¶
func (x *Account) GetStatus() AccountStatus
func (*Account) ProtoMessage ¶
func (*Account) ProtoMessage()
func (*Account) ProtoReflect ¶
func (x *Account) ProtoReflect() protoreflect.Message
type AccountId ¶
type AccountId struct { Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // contains filtered or unexported fields }
func (*AccountId) Descriptor
deprecated
func (*AccountId) GetAddress ¶
func (*AccountId) ProtoMessage ¶
func (*AccountId) ProtoMessage()
func (*AccountId) ProtoReflect ¶
func (x *AccountId) ProtoReflect() protoreflect.Message
type AccountKey ¶
type AccountKey struct { PublicKey []byte `protobuf:"bytes,1,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"` Status KeyStatus `protobuf:"varint,2,opt,name=status,proto3,enum=extensions.account.KeyStatus" json:"status,omitempty"` // contains filtered or unexported fields }
func (*AccountKey) Descriptor
deprecated
func (*AccountKey) Descriptor() ([]byte, []int)
Deprecated: Use AccountKey.ProtoReflect.Descriptor instead.
func (*AccountKey) GetPublicKey ¶
func (x *AccountKey) GetPublicKey() []byte
func (*AccountKey) GetStatus ¶
func (x *AccountKey) GetStatus() KeyStatus
func (*AccountKey) ProtoMessage ¶
func (*AccountKey) ProtoMessage()
func (*AccountKey) ProtoReflect ¶
func (x *AccountKey) ProtoReflect() protoreflect.Message
func (*AccountKey) Reset ¶
func (x *AccountKey) Reset()
func (*AccountKey) String ¶
func (x *AccountKey) String() string
func (*AccountKey) Validate ¶
func (this *AccountKey) Validate() error
type AccountServiceChaincode ¶
type AccountServiceChaincode interface { GetInvokerAddress(cckit_router.Context, *emptypb.Empty) (*AddressId, error) GetAddress(cckit_router.Context, *GetAddressRequest) (*AddressId, error) GetAccount(cckit_router.Context, *AccountId) (*Account, error) }
AccountServiceChaincode chaincode methods interface
type AccountServiceClient ¶
type AccountServiceClient interface { GetInvokerAddress(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*AddressId, error) GetAddress(ctx context.Context, in *GetAddressRequest, opts ...grpc.CallOption) (*AddressId, error) GetAccount(ctx context.Context, in *AccountId, opts ...grpc.CallOption) (*Account, error) }
AccountServiceClient is the client API for AccountService service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
func NewAccountServiceClient ¶
func NewAccountServiceClient(cc grpc.ClientConnInterface) AccountServiceClient
type AccountServiceGateway ¶
type AccountServiceGateway 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 NewAccountServiceGateway ¶
func NewAccountServiceGateway(sdk cckit_sdk.SDK, channel, chaincode string, opts ...cckit_gateway.Opt) *AccountServiceGateway
NewAccountServiceGateway creates gateway to access chaincode method via chaincode service
func NewAccountServiceGatewayFromInstance ¶
func NewAccountServiceGatewayFromInstance(chaincodeInstance cckit_gateway.ChaincodeInstance) *AccountServiceGateway
func (*AccountServiceGateway) GetAccount ¶
func (*AccountServiceGateway) GetAddress ¶
func (c *AccountServiceGateway) GetAddress(ctx context.Context, in *GetAddressRequest) (*AddressId, error)
func (*AccountServiceGateway) GetInvokerAddress ¶
func (*AccountServiceGateway) Invoker ¶
func (c *AccountServiceGateway) Invoker() cckit_gateway.ChaincodeInstanceInvoker
func (*AccountServiceGateway) ServiceDef ¶
func (c *AccountServiceGateway) ServiceDef() cckit_gateway.ServiceDef
ServiceDef returns service definition
type AccountServiceServer ¶
type AccountServiceServer interface { GetInvokerAddress(context.Context, *emptypb.Empty) (*AddressId, error) GetAddress(context.Context, *GetAddressRequest) (*AddressId, error) GetAccount(context.Context, *AccountId) (*Account, error) }
AccountServiceServer is the server API for AccountService service.
type AccountStatus ¶
type AccountStatus int32
const ( AccountStatus_ACCOUNT_STATUS_UNKNOWN AccountStatus = 0 AccountStatus_ACCOUNT_STATUS_ENABLED AccountStatus = 1 AccountStatus_ACCOUNT_STATUS_DISABLED AccountStatus = 2 )
func (AccountStatus) Descriptor ¶
func (AccountStatus) Descriptor() protoreflect.EnumDescriptor
func (AccountStatus) Enum ¶
func (x AccountStatus) Enum() *AccountStatus
func (AccountStatus) EnumDescriptor
deprecated
func (AccountStatus) EnumDescriptor() ([]byte, []int)
Deprecated: Use AccountStatus.Descriptor instead.
func (AccountStatus) Number ¶
func (x AccountStatus) Number() protoreflect.EnumNumber
func (AccountStatus) String ¶
func (x AccountStatus) String() string
func (AccountStatus) Type ¶
func (AccountStatus) Type() protoreflect.EnumType
type Address ¶
type Address struct { Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // contains filtered or unexported fields }
func (*Address) Descriptor
deprecated
func (*Address) GetAddress ¶
func (*Address) ProtoMessage ¶
func (*Address) ProtoMessage()
func (*Address) ProtoReflect ¶
func (x *Address) ProtoReflect() protoreflect.Message
type AddressId ¶
type AddressId struct { Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // contains filtered or unexported fields }
func (*AddressId) Descriptor
deprecated
func (*AddressId) GetAddress ¶
func (*AddressId) ProtoMessage ¶
func (*AddressId) ProtoMessage()
func (*AddressId) ProtoReflect ¶
func (x *AddressId) ProtoReflect() protoreflect.Message
type GetAccountRequest ¶
type GetAccountRequest struct { Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // contains filtered or unexported fields }
func (*GetAccountRequest) Descriptor
deprecated
func (*GetAccountRequest) Descriptor() ([]byte, []int)
Deprecated: Use GetAccountRequest.ProtoReflect.Descriptor instead.
func (*GetAccountRequest) GetAddress ¶
func (x *GetAccountRequest) GetAddress() string
func (*GetAccountRequest) ProtoMessage ¶
func (*GetAccountRequest) ProtoMessage()
func (*GetAccountRequest) ProtoReflect ¶
func (x *GetAccountRequest) ProtoReflect() protoreflect.Message
func (*GetAccountRequest) Reset ¶
func (x *GetAccountRequest) Reset()
func (*GetAccountRequest) String ¶
func (x *GetAccountRequest) String() string
func (*GetAccountRequest) Validate ¶
func (this *GetAccountRequest) Validate() error
type GetAddressRequest ¶
type GetAddressRequest struct { PublicKey []byte `protobuf:"bytes,1,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"` // contains filtered or unexported fields }
func (*GetAddressRequest) Descriptor
deprecated
func (*GetAddressRequest) Descriptor() ([]byte, []int)
Deprecated: Use GetAddressRequest.ProtoReflect.Descriptor instead.
func (*GetAddressRequest) GetPublicKey ¶
func (x *GetAddressRequest) GetPublicKey() []byte
func (*GetAddressRequest) ProtoMessage ¶
func (*GetAddressRequest) ProtoMessage()
func (*GetAddressRequest) ProtoReflect ¶
func (x *GetAddressRequest) ProtoReflect() protoreflect.Message
func (*GetAddressRequest) Reset ¶
func (x *GetAddressRequest) Reset()
func (*GetAddressRequest) String ¶
func (x *GetAddressRequest) String() string
func (*GetAddressRequest) Validate ¶
func (this *GetAddressRequest) Validate() error
type KeyStatus ¶
type KeyStatus int32
func (KeyStatus) Descriptor ¶
func (KeyStatus) Descriptor() protoreflect.EnumDescriptor
func (KeyStatus) EnumDescriptor
deprecated
func (KeyStatus) Number ¶
func (x KeyStatus) Number() protoreflect.EnumNumber
func (KeyStatus) Type ¶
func (KeyStatus) Type() protoreflect.EnumType
type LocalService ¶
type LocalService struct { }
func NewLocalService ¶
func NewLocalService() *LocalService
func (*LocalService) GetAccount ¶
func (*LocalService) GetAddress ¶
func (l *LocalService) GetAddress(ctx router.Context, req *GetAddressRequest) (*AddressId, error)
func (*LocalService) GetInvokerAddress ¶
type UnimplementedAccountServiceServer ¶
type UnimplementedAccountServiceServer struct { }
UnimplementedAccountServiceServer can be embedded to have forward compatible implementations.
func (*UnimplementedAccountServiceServer) GetAccount ¶
func (*UnimplementedAccountServiceServer) GetAddress ¶
func (*UnimplementedAccountServiceServer) GetAddress(context.Context, *GetAddressRequest) (*AddressId, error)