Documentation
¶
Overview ¶
Package debug 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 debug is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Constants
- Variables
- func AddHandlers(r *router.Group, prefix string, middleware ...router.MiddlewareFunc)
- func DeleteStateByPrefixes(s state.State, prefixes []string) (map[string]uint32, error)
- func InvokeStateClean(c router.Context) (interface{}, error)
- func InvokeStateDelete(c router.Context) (interface{}, error)
- func InvokeStatePut(c router.Context) (interface{}, error)
- func QueryKeysList(c router.Context) (interface{}, error)
- func QueryStateGet(c router.Context) (interface{}, error)
- func RegisterDebugStateServiceChaincode(r *cckit_router.Group, cc DebugStateServiceChaincode) error
- func RegisterDebugStateServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterDebugStateServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client DebugStateServiceClient) error
- func RegisterDebugStateServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterDebugStateServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server DebugStateServiceServer) error
- func RegisterDebugStateServiceServer(s *grpc.Server, srv DebugStateServiceServer)
- func StateAsIs(ctx router.Context) state.State
- type CompositeKey
- func (*CompositeKey) Descriptor() ([]byte, []int)deprecated
- func (x *CompositeKey) GetKey() []string
- func (*CompositeKey) ProtoMessage()
- func (x *CompositeKey) ProtoReflect() protoreflect.Message
- func (x *CompositeKey) Reset()
- func (x *CompositeKey) String() string
- func (this *CompositeKey) Validate() error
- type CompositeKeys
- func (*CompositeKeys) Descriptor() ([]byte, []int)deprecated
- func (x *CompositeKeys) GetKeys() []*CompositeKey
- func (*CompositeKeys) ProtoMessage()
- func (x *CompositeKeys) ProtoReflect() protoreflect.Message
- func (x *CompositeKeys) Reset()
- func (x *CompositeKeys) String() string
- func (this *CompositeKeys) Validate() error
- type DebugStateServiceChaincode
- type DebugStateServiceClient
- type DebugStateServiceGateway
- func (c *DebugStateServiceGateway) DeleteState(ctx context.Context, in *CompositeKey) (*Value, error)
- func (c *DebugStateServiceGateway) DeleteStates(ctx context.Context, in *Prefixes) (*PrefixesMatchCount, error)
- func (c *DebugStateServiceGateway) GetState(ctx context.Context, in *CompositeKey) (*Value, error)
- func (c *DebugStateServiceGateway) Invoker() cckit_gateway.ChaincodeInstanceInvoker
- func (c *DebugStateServiceGateway) ListKeys(ctx context.Context, in *Prefix) (*CompositeKeys, error)
- func (c *DebugStateServiceGateway) PutState(ctx context.Context, in *Value) (*Value, error)
- func (c *DebugStateServiceGateway) ServiceDef() cckit_gateway.ServiceDef
- type DebugStateServiceServer
- type Prefix
- type Prefixes
- type PrefixesMatchCount
- func (*PrefixesMatchCount) Descriptor() ([]byte, []int)deprecated
- func (x *PrefixesMatchCount) GetMatches() map[string]uint32
- func (*PrefixesMatchCount) ProtoMessage()
- func (x *PrefixesMatchCount) ProtoReflect() protoreflect.Message
- func (x *PrefixesMatchCount) Reset()
- func (x *PrefixesMatchCount) String() string
- func (this *PrefixesMatchCount) Validate() error
- type StateFn
- type StateService
- func (s *StateService) DeleteState(ctx router.Context, key *CompositeKey) (*Value, error)
- func (s *StateService) DeleteStates(ctx router.Context, prefixes *Prefixes) (*PrefixesMatchCount, error)
- func (s *StateService) GetState(ctx router.Context, key *CompositeKey) (*Value, error)
- func (s *StateService) ListKeys(ctx router.Context, prefix *Prefix) (*CompositeKeys, error)
- func (s *StateService) PutState(ctx router.Context, val *Value) (*Value, error)
- type UnimplementedDebugStateServiceServer
- func (*UnimplementedDebugStateServiceServer) DeleteState(context.Context, *CompositeKey) (*Value, error)
- func (*UnimplementedDebugStateServiceServer) DeleteStates(context.Context, *Prefixes) (*PrefixesMatchCount, error)
- func (*UnimplementedDebugStateServiceServer) GetState(context.Context, *CompositeKey) (*Value, error)
- func (*UnimplementedDebugStateServiceServer) ListKeys(context.Context, *Prefix) (*CompositeKeys, error)
- func (*UnimplementedDebugStateServiceServer) PutState(context.Context, *Value) (*Value, error)
- type Value
- func (*Value) Descriptor() ([]byte, []int)deprecated
- func (x *Value) GetJson() string
- func (x *Value) GetKey() []string
- func (x *Value) GetValue() []byte
- func (*Value) ProtoMessage()
- func (x *Value) ProtoReflect() protoreflect.Message
- func (x *Value) Reset()
- func (x *Value) String() string
- func (this *Value) Validate() error
Constants ¶
const ( // DebugStateServiceChaincodeMethodPrefix allows to use multiple services with same method names in one chaincode DebugStateServiceChaincodeMethodPrefix = "DebugStateService." DebugStateServiceChaincode_ListKeys = DebugStateServiceChaincodeMethodPrefix + "ListKeys" DebugStateServiceChaincode_GetState = DebugStateServiceChaincodeMethodPrefix + "GetState" DebugStateServiceChaincode_PutState = DebugStateServiceChaincodeMethodPrefix + "PutState" DebugStateServiceChaincode_DeleteState = DebugStateServiceChaincodeMethodPrefix + "DeleteState" DebugStateServiceChaincode_DeleteStates = DebugStateServiceChaincodeMethodPrefix + "DeleteStates" )
DebugStateServiceChaincode method names
const ( InvokeStateCleanFunc = `StateClean` QueryStateKeysFunc = `StateKeys` QueryStateGetFunc = `StateGet` InvokeStatePutFunc = `StatePut` InvokeStateDeleteFunc = `StateDelete` )
Variables ¶
var ( // KeyParam parameter for get, put, delete data from state KeyParam = param.Strings(`key`) // PrefixParam parameter PrefixParam = param.String(`prefix`) // PrefixesParams parameter PrefixesParam = param.Strings(`prefixes`) // ValueParam parameter for putting value in state ValueParam = param.Bytes(`value`) )
var DebugStateServiceSwagger []byte
var File_debug_debug_state_proto protoreflect.FileDescriptor
Functions ¶
func AddHandlers ¶
func AddHandlers(r *router.Group, prefix string, middleware ...router.MiddlewareFunc)
AddHandler adds debug handlers to router, allows to add more middleware for example for access control
func DeleteStateByPrefixes ¶ added in v0.7.3
DeleteStateByPrefixes deletes from state entries with matching key prefix raw function, do not use State wrappers, like encryption
func InvokeStateClean ¶
InvokeStateClean delete entries from state, prefix []string contains key prefixes or whole key
func InvokeStateDelete ¶
QueryStateGet router handler delete state entry by key ([]string)
func InvokeStatePut ¶
InvokeValueByKeyPut router handler puts value in chaincode state with composite key, created with key parts ([]string)
func QueryKeysList ¶
QueryKeysList router handler returns string slice with keys by prefix (object type)
func QueryStateGet ¶
QueryStateGet router handler returns state entry by key ([]string)
func RegisterDebugStateServiceChaincode ¶ added in v0.10.1
func RegisterDebugStateServiceChaincode(r *cckit_router.Group, cc DebugStateServiceChaincode) error
RegisterDebugStateServiceChaincode registers service methods as chaincode router handlers
func RegisterDebugStateServiceHandler ¶ added in v0.10.1
func RegisterDebugStateServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterDebugStateServiceHandler registers the http handlers for service DebugStateService to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterDebugStateServiceHandlerClient ¶ added in v0.10.1
func RegisterDebugStateServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client DebugStateServiceClient) error
RegisterDebugStateServiceHandlerClient registers the http handlers for service DebugStateService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "DebugStateServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "DebugStateServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "DebugStateServiceClient" to call the correct interceptors.
func RegisterDebugStateServiceHandlerFromEndpoint ¶ added in v0.10.1
func RegisterDebugStateServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterDebugStateServiceHandlerFromEndpoint is same as RegisterDebugStateServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterDebugStateServiceHandlerServer ¶ added in v0.10.1
func RegisterDebugStateServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server DebugStateServiceServer) error
RegisterDebugStateServiceHandlerServer registers the http handlers for service DebugStateService to "mux". UnaryRPC :call DebugStateServiceServer 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 RegisterDebugStateServiceHandlerFromEndpoint instead.
func RegisterDebugStateServiceServer ¶ added in v0.10.1
func RegisterDebugStateServiceServer(s *grpc.Server, srv DebugStateServiceServer)
Types ¶
type CompositeKey ¶ added in v0.7.3
type CompositeKey struct { Key []string `protobuf:"bytes,1,rep,name=key,proto3" json:"key,omitempty"` // contains filtered or unexported fields }
State key
func (*CompositeKey) Descriptor
deprecated
added in
v0.7.3
func (*CompositeKey) Descriptor() ([]byte, []int)
Deprecated: Use CompositeKey.ProtoReflect.Descriptor instead.
func (*CompositeKey) GetKey ¶ added in v0.7.3
func (x *CompositeKey) GetKey() []string
func (*CompositeKey) ProtoMessage ¶ added in v0.7.3
func (*CompositeKey) ProtoMessage()
func (*CompositeKey) ProtoReflect ¶ added in v0.10.1
func (x *CompositeKey) ProtoReflect() protoreflect.Message
func (*CompositeKey) Reset ¶ added in v0.7.3
func (x *CompositeKey) Reset()
func (*CompositeKey) String ¶ added in v0.7.3
func (x *CompositeKey) String() string
func (*CompositeKey) Validate ¶ added in v0.7.3
func (this *CompositeKey) Validate() error
type CompositeKeys ¶ added in v0.7.3
type CompositeKeys struct { Keys []*CompositeKey `protobuf:"bytes,1,rep,name=keys,proto3" json:"keys,omitempty"` // contains filtered or unexported fields }
State keys
func (*CompositeKeys) Descriptor
deprecated
added in
v0.7.3
func (*CompositeKeys) Descriptor() ([]byte, []int)
Deprecated: Use CompositeKeys.ProtoReflect.Descriptor instead.
func (*CompositeKeys) GetKeys ¶ added in v0.7.3
func (x *CompositeKeys) GetKeys() []*CompositeKey
func (*CompositeKeys) ProtoMessage ¶ added in v0.7.3
func (*CompositeKeys) ProtoMessage()
func (*CompositeKeys) ProtoReflect ¶ added in v0.10.1
func (x *CompositeKeys) ProtoReflect() protoreflect.Message
func (*CompositeKeys) Reset ¶ added in v0.7.3
func (x *CompositeKeys) Reset()
func (*CompositeKeys) String ¶ added in v0.7.3
func (x *CompositeKeys) String() string
func (*CompositeKeys) Validate ¶ added in v0.7.3
func (this *CompositeKeys) Validate() error
type DebugStateServiceChaincode ¶ added in v0.10.1
type DebugStateServiceChaincode interface { ListKeys(cckit_router.Context, *Prefix) (*CompositeKeys, error) GetState(cckit_router.Context, *CompositeKey) (*Value, error) PutState(cckit_router.Context, *Value) (*Value, error) DeleteState(cckit_router.Context, *CompositeKey) (*Value, error) DeleteStates(cckit_router.Context, *Prefixes) (*PrefixesMatchCount, error) }
DebugStateServiceChaincode chaincode methods interface
type DebugStateServiceClient ¶ added in v0.10.1
type DebugStateServiceClient interface { // Get keys list, returns all keys or, if prefixes are defined, only prefix matched ListKeys(ctx context.Context, in *Prefix, opts ...grpc.CallOption) (*CompositeKeys, error) // Get state value by key GetState(ctx context.Context, in *CompositeKey, opts ...grpc.CallOption) (*Value, error) // Put state value PutState(ctx context.Context, in *Value, opts ...grpc.CallOption) (*Value, error) // Delete state value DeleteState(ctx context.Context, in *CompositeKey, opts ...grpc.CallOption) (*Value, error) // Delete all states or, if prefixes are defined, only prefix matched DeleteStates(ctx context.Context, in *Prefixes, opts ...grpc.CallOption) (*PrefixesMatchCount, error) }
DebugStateServiceClient is the client API for DebugStateService service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
func NewDebugStateServiceClient ¶ added in v0.10.1
func NewDebugStateServiceClient(cc grpc.ClientConnInterface) DebugStateServiceClient
type DebugStateServiceGateway ¶ added in v0.10.1
type DebugStateServiceGateway 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 NewDebugStateServiceGateway ¶ added in v0.10.1
func NewDebugStateServiceGateway(sdk cckit_sdk.SDK, channel, chaincode string, opts ...cckit_gateway.Opt) *DebugStateServiceGateway
NewDebugStateServiceGateway creates gateway to access chaincode method via chaincode service
func NewDebugStateServiceGatewayFromInstance ¶ added in v0.10.1
func NewDebugStateServiceGatewayFromInstance(chaincodeInstance cckit_gateway.ChaincodeInstance) *DebugStateServiceGateway
func (*DebugStateServiceGateway) DeleteState ¶ added in v0.10.1
func (c *DebugStateServiceGateway) DeleteState(ctx context.Context, in *CompositeKey) (*Value, error)
func (*DebugStateServiceGateway) DeleteStates ¶ added in v0.10.1
func (c *DebugStateServiceGateway) DeleteStates(ctx context.Context, in *Prefixes) (*PrefixesMatchCount, error)
func (*DebugStateServiceGateway) GetState ¶ added in v0.10.1
func (c *DebugStateServiceGateway) GetState(ctx context.Context, in *CompositeKey) (*Value, error)
func (*DebugStateServiceGateway) Invoker ¶ added in v0.10.1
func (c *DebugStateServiceGateway) Invoker() cckit_gateway.ChaincodeInstanceInvoker
func (*DebugStateServiceGateway) ListKeys ¶ added in v0.10.1
func (c *DebugStateServiceGateway) ListKeys(ctx context.Context, in *Prefix) (*CompositeKeys, error)
func (*DebugStateServiceGateway) ServiceDef ¶ added in v0.10.1
func (c *DebugStateServiceGateway) ServiceDef() cckit_gateway.ServiceDef
ServiceDef returns service definition
type DebugStateServiceServer ¶ added in v0.10.1
type DebugStateServiceServer interface { // Get keys list, returns all keys or, if prefixes are defined, only prefix matched ListKeys(context.Context, *Prefix) (*CompositeKeys, error) // Get state value by key GetState(context.Context, *CompositeKey) (*Value, error) // Put state value PutState(context.Context, *Value) (*Value, error) // Delete state value DeleteState(context.Context, *CompositeKey) (*Value, error) // Delete all states or, if prefixes are defined, only prefix matched DeleteStates(context.Context, *Prefixes) (*PrefixesMatchCount, error) }
DebugStateServiceServer is the server API for DebugStateService service.
type Prefix ¶ added in v0.7.3
type Prefix struct { // parts of key Key []string `protobuf:"bytes,1,rep,name=key,proto3" json:"key,omitempty"` // contains filtered or unexported fields }
State key prefix
func (*Prefix) Descriptor
deprecated
added in
v0.7.3
func (*Prefix) ProtoMessage ¶ added in v0.7.3
func (*Prefix) ProtoMessage()
func (*Prefix) ProtoReflect ¶ added in v0.10.1
func (x *Prefix) ProtoReflect() protoreflect.Message
type Prefixes ¶ added in v0.7.3
type Prefixes struct { Prefixes []*Prefix `protobuf:"bytes,1,rep,name=prefixes,proto3" json:"prefixes,omitempty"` // contains filtered or unexported fields }
func (*Prefixes) Descriptor
deprecated
added in
v0.7.3
func (*Prefixes) GetPrefixes ¶ added in v0.7.3
func (*Prefixes) ProtoMessage ¶ added in v0.7.3
func (*Prefixes) ProtoMessage()
func (*Prefixes) ProtoReflect ¶ added in v0.10.1
func (x *Prefixes) ProtoReflect() protoreflect.Message
type PrefixesMatchCount ¶ added in v0.7.3
type PrefixesMatchCount struct { Matches map[string]uint32 `` /* 156-byte string literal not displayed */ // contains filtered or unexported fields }
State key prefix match count
func (*PrefixesMatchCount) Descriptor
deprecated
added in
v0.7.3
func (*PrefixesMatchCount) Descriptor() ([]byte, []int)
Deprecated: Use PrefixesMatchCount.ProtoReflect.Descriptor instead.
func (*PrefixesMatchCount) GetMatches ¶ added in v0.7.3
func (x *PrefixesMatchCount) GetMatches() map[string]uint32
func (*PrefixesMatchCount) ProtoMessage ¶ added in v0.7.3
func (*PrefixesMatchCount) ProtoMessage()
func (*PrefixesMatchCount) ProtoReflect ¶ added in v0.10.1
func (x *PrefixesMatchCount) ProtoReflect() protoreflect.Message
func (*PrefixesMatchCount) Reset ¶ added in v0.7.3
func (x *PrefixesMatchCount) Reset()
func (*PrefixesMatchCount) String ¶ added in v0.7.3
func (x *PrefixesMatchCount) String() string
func (*PrefixesMatchCount) Validate ¶ added in v0.7.3
func (this *PrefixesMatchCount) Validate() error
type StateFn ¶ added in v0.7.3
StateFn function can add mappings to state, for correct convertation in StateGet
type StateService ¶ added in v0.7.3
type StateService struct {
State StateFn
}
func NewStateService ¶ added in v0.7.3
func NewStateService() *StateService
func (*StateService) DeleteState ¶ added in v0.10.1
func (s *StateService) DeleteState(ctx router.Context, key *CompositeKey) (*Value, error)
func (*StateService) DeleteStates ¶ added in v0.10.1
func (s *StateService) DeleteStates(ctx router.Context, prefixes *Prefixes) (*PrefixesMatchCount, error)
func (*StateService) GetState ¶ added in v0.10.1
func (s *StateService) GetState(ctx router.Context, key *CompositeKey) (*Value, error)
func (*StateService) ListKeys ¶ added in v0.10.1
func (s *StateService) ListKeys(ctx router.Context, prefix *Prefix) (*CompositeKeys, error)
type UnimplementedDebugStateServiceServer ¶ added in v0.10.1
type UnimplementedDebugStateServiceServer struct { }
UnimplementedDebugStateServiceServer can be embedded to have forward compatible implementations.
func (*UnimplementedDebugStateServiceServer) DeleteState ¶ added in v0.10.1
func (*UnimplementedDebugStateServiceServer) DeleteState(context.Context, *CompositeKey) (*Value, error)
func (*UnimplementedDebugStateServiceServer) DeleteStates ¶ added in v0.10.1
func (*UnimplementedDebugStateServiceServer) DeleteStates(context.Context, *Prefixes) (*PrefixesMatchCount, error)
func (*UnimplementedDebugStateServiceServer) GetState ¶ added in v0.10.1
func (*UnimplementedDebugStateServiceServer) GetState(context.Context, *CompositeKey) (*Value, error)
func (*UnimplementedDebugStateServiceServer) ListKeys ¶ added in v0.10.1
func (*UnimplementedDebugStateServiceServer) ListKeys(context.Context, *Prefix) (*CompositeKeys, error)
type Value ¶ added in v0.7.3
type Value struct { Key []string `protobuf:"bytes,1,rep,name=key,proto3" json:"key,omitempty"` Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` Json string `protobuf:"bytes,3,opt,name=json,proto3" json:"json,omitempty"` // contains filtered or unexported fields }
State value
func (*Value) Descriptor
deprecated
added in
v0.7.3
func (*Value) ProtoMessage ¶ added in v0.7.3
func (*Value) ProtoMessage()
func (*Value) ProtoReflect ¶ added in v0.10.1
func (x *Value) ProtoReflect() protoreflect.Message