{"modulePath":"github.com/s7techlab/cckit","version":"v0.10.5","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package debug\n\nPackage debug contains\n\n  - chaincode methods names {service\\_name}Chaincode\\_{method\\_name}\n  - chaincode interface definition {service\\_name}Chaincode\n  - chaincode gateway definition {service\\_name}}Gateway\n  - chaincode service to cckit router registration func\n\nPackage debug is a reverse proxy.\n\nIt translates gRPC into RESTful JSON APIs.\n\n## Constants\n\n```go\nconst (\n\n\t// DebugStateServiceChaincodeMethodPrefix allows to use multiple services with same method names in one chaincode\n\tDebugStateServiceChaincodeMethodPrefix = \"DebugStateService.\"\n\n\tDebugStateServiceChaincode_ListKeys = DebugStateServiceChaincodeMethodPrefix + \"ListKeys\"\n\n\tDebugStateServiceChaincode_GetState = DebugStateServiceChaincodeMethodPrefix + \"GetState\"\n\n\tDebugStateServiceChaincode_PutState = DebugStateServiceChaincodeMethodPrefix + \"PutState\"\n\n\tDebugStateServiceChaincode_DeleteState = DebugStateServiceChaincodeMethodPrefix + \"DeleteState\"\n\n\tDebugStateServiceChaincode_DeleteStates = DebugStateServiceChaincodeMethodPrefix + \"DeleteStates\"\n)\n```\nDebugStateServiceChaincode method names\n\n```go\nconst (\n\tInvokeStateCleanFunc  = `StateClean`\n\tQueryStateKeysFunc    = `StateKeys`\n\tQueryStateGetFunc     = `StateGet`\n\tInvokeStatePutFunc    = `StatePut`\n\tInvokeStateDeleteFunc = `StateDelete`\n)\n```\n\n## Variables\n\n```go\nvar (\n\t// KeyParam parameter for get, put, delete data from state\n\tKeyParam = param.Strings(`key`)\n\n\t// PrefixParam parameter\n\tPrefixParam = param.String(`prefix`)\n\n\t// PrefixesParams parameter\n\tPrefixesParam = param.Strings(`prefixes`)\n\n\t// ValueParam  parameter for putting value in state\n\tValueParam = param.Bytes(`value`)\n)\n```\n\n```go\nvar DebugStateServiceSwagger []byte\n```\n\n```go\nvar File_debug_debug_state_proto protoreflect.FileDescriptor\n```\n\n## Functions\n\n```go\nfunc AddHandlers(r *router.Group, prefix string, middleware ...router.MiddlewareFunc)\n```\nAddHandler adds debug handlers to router, allows to add more middleware for example for access control\n\n```go\nfunc DeleteStateByPrefixes(s state.State, prefixes []string) (map[string]uint32, error)\n```\nDeleteStateByPrefixes deletes from state entries with matching key prefix raw function, do not use State wrappers, like encryption\n\n```go\nfunc InvokeStateClean(c router.Context) (interface{}, error)\n```\nInvokeStateClean delete entries from state, prefix \\[]string contains key prefixes or whole key\n\n```go\nfunc InvokeStateDelete(c router.Context) (interface{}, error)\n```\nQueryStateGet router handler delete state entry by key (\\[]string)\n\n```go\nfunc InvokeStatePut(c router.Context) (interface{}, error)\n```\nInvokeValueByKeyPut router handler puts value in chaincode state with composite key, created with key parts (\\[]string)\n\n```go\nfunc QueryKeysList(c router.Context) (interface{}, error)\n```\nQueryKeysList router handler returns string slice with keys by prefix (object type)\n\n```go\nfunc QueryStateGet(c router.Context) (interface{}, error)\n```\nQueryStateGet router handler returns state entry by key (\\[]string)\n\n```go\nfunc RegisterDebugStateServiceChaincode(r *cckit_router.Group, cc DebugStateServiceChaincode) error\n```\nRegisterDebugStateServiceChaincode registers service methods as chaincode router handlers\n\n```go\nfunc RegisterDebugStateServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error\n```\nRegisterDebugStateServiceHandler registers the http handlers for service DebugStateService to \"mux\". The handlers forward requests to the grpc endpoint over \"conn\".\n\n```go\nfunc RegisterDebugStateServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client DebugStateServiceClient) error\n```\nRegisterDebugStateServiceHandlerClient 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.\n\n```go\nfunc RegisterDebugStateServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)\n```\nRegisterDebugStateServiceHandlerFromEndpoint is same as RegisterDebugStateServiceHandler but automatically dials to \"endpoint\" and closes the connection when \"ctx\" gets done.\n\n```go\nfunc RegisterDebugStateServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server DebugStateServiceServer) error\n```\nRegisterDebugStateServiceHandlerServer 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](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.\n\n```go\nfunc RegisterDebugStateServiceServer(s *grpc.Server, srv DebugStateServiceServer)\n```\n\n```go\nfunc StateAsIs(ctx router.Context) state.State\n```\n\n## Types\n\n```go\ntype CompositeKey struct {\n\tKey []string `protobuf:\"bytes,1,rep,name=key,proto3\" json:\"key,omitempty\"`\n\t// contains filtered or unexported fields\n}\n```\nState key\n\n```go\nfunc (*CompositeKey) Descriptor() ([]byte, []int)\n```\nDeprecated: Use CompositeKey.ProtoReflect.Descriptor instead.\n\n```go\nfunc (x *CompositeKey) GetKey() []string\n```\n\n```go\nfunc (*CompositeKey) ProtoMessage()\n```\n\n```go\nfunc (x *CompositeKey) ProtoReflect() protoreflect.Message\n```\n\n```go\nfunc (x *CompositeKey) Reset()\n```\n\n```go\nfunc (x *CompositeKey) String() string\n```\n\n```go\nfunc (this *CompositeKey) Validate() error\n```\n\n```go\ntype CompositeKeys struct {\n\tKeys []*CompositeKey `protobuf:\"bytes,1,rep,name=keys,proto3\" json:\"keys,omitempty\"`\n\t// contains filtered or unexported fields\n}\n```\nState keys\n\n```go\nfunc (*CompositeKeys) Descriptor() ([]byte, []int)\n```\nDeprecated: Use CompositeKeys.ProtoReflect.Descriptor instead.\n\n```go\nfunc (x *CompositeKeys) GetKeys() []*CompositeKey\n```\n\n```go\nfunc (*CompositeKeys) ProtoMessage()\n```\n\n```go\nfunc (x *CompositeKeys) ProtoReflect() protoreflect.Message\n```\n\n```go\nfunc (x *CompositeKeys) Reset()\n```\n\n```go\nfunc (x *CompositeKeys) String() string\n```\n\n```go\nfunc (this *CompositeKeys) Validate() error\n```\n\n```go\ntype DebugStateServiceChaincode interface {\n\tListKeys(cckit_router.Context, *Prefix) (*CompositeKeys, error)\n\n\tGetState(cckit_router.Context, *CompositeKey) (*Value, error)\n\n\tPutState(cckit_router.Context, *Value) (*Value, error)\n\n\tDeleteState(cckit_router.Context, *CompositeKey) (*Value, error)\n\n\tDeleteStates(cckit_router.Context, *Prefixes) (*PrefixesMatchCount, error)\n}\n```\nDebugStateServiceChaincode chaincode methods interface\n\n```go\ntype DebugStateServiceClient interface {\n\t// Get keys list, returns all keys or, if prefixes are defined, only prefix matched\n\tListKeys(ctx context.Context, in *Prefix, opts ...grpc.CallOption) (*CompositeKeys, error)\n\t// Get state value by key\n\tGetState(ctx context.Context, in *CompositeKey, opts ...grpc.CallOption) (*Value, error)\n\t// Put state value\n\tPutState(ctx context.Context, in *Value, opts ...grpc.CallOption) (*Value, error)\n\t// Delete state value\n\tDeleteState(ctx context.Context, in *CompositeKey, opts ...grpc.CallOption) (*Value, error)\n\t// Delete all states or, if prefixes are defined, only prefix matched\n\tDeleteStates(ctx context.Context, in *Prefixes, opts ...grpc.CallOption) (*PrefixesMatchCount, error)\n}\n```\nDebugStateServiceClient is the client API for DebugStateService service.\n\nFor semantics around ctx use and closing/ending streaming RPCs, please refer to [https://godoc.org/google.golang.org/grpc#ClientConn.NewStream](https://godoc.org/google.golang.org/grpc#ClientConn.NewStream).\n\n```go\nfunc NewDebugStateServiceClient(cc grpc.ClientConnInterface) DebugStateServiceClient\n```\n\n```go\ntype DebugStateServiceGateway struct {\n\tChaincodeInstance cckit_gateway.ChaincodeInstance\n}\n```\ngateway implementation gateway can be used as kind of SDK, GRPC or REST server ( via grpc-gateway or clay )\n\n```go\nfunc NewDebugStateServiceGateway(sdk cckit_sdk.SDK, channel, chaincode string, opts ...cckit_gateway.Opt) *DebugStateServiceGateway\n```\nNewDebugStateServiceGateway creates gateway to access chaincode method via chaincode service\n\n```go\nfunc NewDebugStateServiceGatewayFromInstance(chaincodeInstance cckit_gateway.ChaincodeInstance) *DebugStateServiceGateway\n```\n\n```go\nfunc (c *DebugStateServiceGateway) DeleteState(ctx context.Context, in *CompositeKey) (*Value, error)\n```\n\n```go\nfunc (c *DebugStateServiceGateway) DeleteStates(ctx context.Context, in *Prefixes) (*PrefixesMatchCount, error)\n```\n\n```go\nfunc (c *DebugStateServiceGateway) GetState(ctx context.Context, in *CompositeKey) (*Value, error)\n```\n\n```go\nfunc (c *DebugStateServiceGateway) Invoker() cckit_gateway.ChaincodeInstanceInvoker\n```\n\n```go\nfunc (c *DebugStateServiceGateway) ListKeys(ctx context.Context, in *Prefix) (*CompositeKeys, error)\n```\n\n```go\nfunc (c *DebugStateServiceGateway) PutState(ctx context.Context, in *Value) (*Value, error)\n```\n\n```go\nfunc (c *DebugStateServiceGateway) ServiceDef() cckit_gateway.ServiceDef\n```\nServiceDef returns service definition\n\n```go\ntype DebugStateServiceServer interface {\n\t// Get keys list, returns all keys or, if prefixes are defined, only prefix matched\n\tListKeys(context.Context, *Prefix) (*CompositeKeys, error)\n\t// Get state value by key\n\tGetState(context.Context, *CompositeKey) (*Value, error)\n\t// Put state value\n\tPutState(context.Context, *Value) (*Value, error)\n\t// Delete state value\n\tDeleteState(context.Context, *CompositeKey) (*Value, error)\n\t// Delete all states or, if prefixes are defined, only prefix matched\n\tDeleteStates(context.Context, *Prefixes) (*PrefixesMatchCount, error)\n}\n```\nDebugStateServiceServer is the server API for DebugStateService service.\n\n```go\ntype Prefix struct {\n\n\t// parts of key\n\tKey []string `protobuf:\"bytes,1,rep,name=key,proto3\" json:\"key,omitempty\"`\n\t// contains filtered or unexported fields\n}\n```\nState key prefix\n\n```go\nfunc (*Prefix) Descriptor() ([]byte, []int)\n```\nDeprecated: Use Prefix.ProtoReflect.Descriptor instead.\n\n```go\nfunc (x *Prefix) GetKey() []string\n```\n\n```go\nfunc (*Prefix) ProtoMessage()\n```\n\n```go\nfunc (x *Prefix) ProtoReflect() protoreflect.Message\n```\n\n```go\nfunc (x *Prefix) Reset()\n```\n\n```go\nfunc (x *Prefix) String() string\n```\n\n```go\nfunc (this *Prefix) Validate() error\n```\n\n```go\ntype Prefixes struct {\n\tPrefixes []*Prefix `protobuf:\"bytes,1,rep,name=prefixes,proto3\" json:\"prefixes,omitempty\"`\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (*Prefixes) Descriptor() ([]byte, []int)\n```\nDeprecated: Use Prefixes.ProtoReflect.Descriptor instead.\n\n```go\nfunc (x *Prefixes) GetPrefixes() []*Prefix\n```\n\n```go\nfunc (*Prefixes) ProtoMessage()\n```\n\n```go\nfunc (x *Prefixes) ProtoReflect() protoreflect.Message\n```\n\n```go\nfunc (x *Prefixes) Reset()\n```\n\n```go\nfunc (x *Prefixes) String() string\n```\n\n```go\nfunc (this *Prefixes) Validate() error\n```\n\n```go\ntype PrefixesMatchCount struct {\n\tMatches map[string]uint32 `protobuf:\"bytes,1,rep,name=matches,proto3\" json:\"matches,omitempty\" protobuf_key:\"bytes,1,opt,name=key,proto3\" protobuf_val:\"varint,2,opt,name=value,proto3\"`\n\t// contains filtered or unexported fields\n}\n```\nState key prefix match count\n\n```go\nfunc (*PrefixesMatchCount) Descriptor() ([]byte, []int)\n```\nDeprecated: Use PrefixesMatchCount.ProtoReflect.Descriptor instead.\n\n```go\nfunc (x *PrefixesMatchCount) GetMatches() map[string]uint32\n```\n\n```go\nfunc (*PrefixesMatchCount) ProtoMessage()\n```\n\n```go\nfunc (x *PrefixesMatchCount) ProtoReflect() protoreflect.Message\n```\n\n```go\nfunc (x *PrefixesMatchCount) Reset()\n```\n\n```go\nfunc (x *PrefixesMatchCount) String() string\n```\n\n```go\nfunc (this *PrefixesMatchCount) Validate() error\n```\n\n```go\ntype StateFn func(router.Context) state.State\n```\nStateFn function can add mappings to state, for correct convertation in StateGet\n\n```go\ntype StateService struct {\n\tState StateFn\n}\n```\n\n```go\nfunc NewStateService() *StateService\n```\n\n```go\nfunc (s *StateService) DeleteState(ctx router.Context, key *CompositeKey) (*Value, error)\n```\n\n```go\nfunc (s *StateService) DeleteStates(ctx router.Context, prefixes *Prefixes) (*PrefixesMatchCount, error)\n```\n\n```go\nfunc (s *StateService) GetState(ctx router.Context, key *CompositeKey) (*Value, error)\n```\n\n```go\nfunc (s *StateService) ListKeys(ctx router.Context, prefix *Prefix) (*CompositeKeys, error)\n```\n\n```go\nfunc (s *StateService) PutState(ctx router.Context, val *Value) (*Value, error)\n```\n\n```go\ntype UnimplementedDebugStateServiceServer struct {\n}\n```\nUnimplementedDebugStateServiceServer can be embedded to have forward compatible implementations.\n\n```go\nfunc (*UnimplementedDebugStateServiceServer) DeleteState(context.Context, *CompositeKey) (*Value, error)\n```\n\n```go\nfunc (*UnimplementedDebugStateServiceServer) DeleteStates(context.Context, *Prefixes) (*PrefixesMatchCount, error)\n```\n\n```go\nfunc (*UnimplementedDebugStateServiceServer) GetState(context.Context, *CompositeKey) (*Value, error)\n```\n\n```go\nfunc (*UnimplementedDebugStateServiceServer) ListKeys(context.Context, *Prefix) (*CompositeKeys, error)\n```\n\n```go\nfunc (*UnimplementedDebugStateServiceServer) PutState(context.Context, *Value) (*Value, error)\n```\n\n```go\ntype Value struct {\n\tKey   []string `protobuf:\"bytes,1,rep,name=key,proto3\" json:\"key,omitempty\"`\n\tValue []byte   `protobuf:\"bytes,2,opt,name=value,proto3\" json:\"value,omitempty\"`\n\tJson  string   `protobuf:\"bytes,3,opt,name=json,proto3\" json:\"json,omitempty\"`\n\t// contains filtered or unexported fields\n}\n```\nState value\n\n```go\nfunc (*Value) Descriptor() ([]byte, []int)\n```\nDeprecated: Use Value.ProtoReflect.Descriptor instead.\n\n```go\nfunc (x *Value) GetJson() string\n```\n\n```go\nfunc (x *Value) GetKey() []string\n```\n\n```go\nfunc (x *Value) GetValue() []byte\n```\n\n```go\nfunc (*Value) ProtoMessage()\n```\n\n```go\nfunc (x *Value) ProtoReflect() protoreflect.Message\n```\n\n```go\nfunc (x *Value) Reset()\n```\n\n```go\nfunc (x *Value) String() string\n```\n\n```go\nfunc (this *Value) Validate() error\n```\n\n","path":"github.com/s7techlab/cckit/extensions/debug","name":"debug","synopsis":"Package debug contains","isRedistributable":true}
