account

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2024 License: Apache-2.0 Imports: 28 Imported by: 0

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

View Source
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

View Source
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.

View Source
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.

View Source
var AccountServiceSwagger []byte
View Source
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) Descriptor() ([]byte, []int)

Deprecated: Use Account.ProtoReflect.Descriptor instead.

func (*Account) GetAddress

func (x *Account) GetAddress() string

func (*Account) GetStatus

func (x *Account) GetStatus() AccountStatus

func (*Account) ProtoMessage

func (*Account) ProtoMessage()

func (*Account) ProtoReflect

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

func (*Account) Reset

func (x *Account) Reset()

func (*Account) String

func (x *Account) String() string

func (*Account) Validate

func (this *Account) Validate() error

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) Descriptor() ([]byte, []int)

Deprecated: Use AccountId.ProtoReflect.Descriptor instead.

func (*AccountId) GetAddress

func (x *AccountId) GetAddress() string

func (*AccountId) ProtoMessage

func (*AccountId) ProtoMessage()

func (*AccountId) ProtoReflect

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

func (*AccountId) Reset

func (x *AccountId) Reset()

func (*AccountId) String

func (x *AccountId) String() string

func (*AccountId) Validate

func (this *AccountId) Validate() error

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.

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 (c *AccountServiceGateway) GetAccount(ctx context.Context, in *AccountId) (*Account, error)

func (*AccountServiceGateway) GetAddress

func (*AccountServiceGateway) GetInvokerAddress

func (c *AccountServiceGateway) GetInvokerAddress(ctx context.Context, in *emptypb.Empty) (*AddressId, error)

func (*AccountServiceGateway) Invoker

func (*AccountServiceGateway) 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) Enum

func (x AccountStatus) Enum() *AccountStatus

func (AccountStatus) EnumDescriptor deprecated

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

Deprecated: Use AccountStatus.Descriptor instead.

func (AccountStatus) Number

func (AccountStatus) String

func (x AccountStatus) String() string

func (AccountStatus) Type

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) Descriptor() ([]byte, []int)

Deprecated: Use Address.ProtoReflect.Descriptor instead.

func (*Address) GetAddress

func (x *Address) GetAddress() string

func (*Address) ProtoMessage

func (*Address) ProtoMessage()

func (*Address) ProtoReflect

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

func (*Address) Reset

func (x *Address) Reset()

func (*Address) String

func (x *Address) String() string

func (*Address) Validate

func (this *Address) Validate() error

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) Descriptor() ([]byte, []int)

Deprecated: Use AddressId.ProtoReflect.Descriptor instead.

func (*AddressId) GetAddress

func (x *AddressId) GetAddress() string

func (*AddressId) ProtoMessage

func (*AddressId) ProtoMessage()

func (*AddressId) ProtoReflect

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

func (*AddressId) Reset

func (x *AddressId) Reset()

func (*AddressId) String

func (x *AddressId) String() string

func (*AddressId) Validate

func (this *AddressId) Validate() error

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 Getter

type Getter interface {
	GetInvokerAddress(router.Context, *emptypb.Empty) (*AddressId, error)

	GetAddress(router.Context, *GetAddressRequest) (*AddressId, error)

	GetAccount(router.Context, *AccountId) (*Account, error)
}

type KeyStatus

type KeyStatus int32
const (
	KeyStatus_KEY_STATUS_UNKNOWN  KeyStatus = 0
	KeyStatus_KEY_STATUS_ENABLED  KeyStatus = 1
	KeyStatus_KEY_STATUS_DISABLED KeyStatus = 2
)

func (KeyStatus) Descriptor

func (KeyStatus) Descriptor() protoreflect.EnumDescriptor

func (KeyStatus) Enum

func (x KeyStatus) Enum() *KeyStatus

func (KeyStatus) EnumDescriptor deprecated

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

Deprecated: Use KeyStatus.Descriptor instead.

func (KeyStatus) Number

func (x KeyStatus) Number() protoreflect.EnumNumber

func (KeyStatus) String

func (x KeyStatus) String() string

func (KeyStatus) Type

type LocalService

type LocalService struct {
}

func NewLocalService

func NewLocalService() *LocalService

func (*LocalService) GetAccount

func (l *LocalService) GetAccount(ctx router.Context, id *AccountId) (*Account, error)

func (*LocalService) GetAddress

func (l *LocalService) GetAddress(ctx router.Context, req *GetAddressRequest) (*AddressId, error)

func (*LocalService) GetInvokerAddress

func (l *LocalService) GetInvokerAddress(ctx router.Context, _ *emptypb.Empty) (*AddressId, error)

type Remote

type Remote struct {
}

type UnimplementedAccountServiceServer

type UnimplementedAccountServiceServer struct {
}

UnimplementedAccountServiceServer can be embedded to have forward compatible implementations.

func (*UnimplementedAccountServiceServer) GetAccount

func (*UnimplementedAccountServiceServer) GetAddress

func (*UnimplementedAccountServiceServer) GetInvokerAddress

Jump to

Keyboard shortcuts

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