debug

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2022 License: MIT Imports: 28 Imported by: 3 modules, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

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

View Source
const (
	InvokeStateCleanFunc  = `StateClean`
	QueryStateKeysFunc    = `StateKeys`
	QueryStateGetFunc     = `StateGet`
	InvokeStatePutFunc    = `StatePut`
	InvokeStateDeleteFunc = `StateDelete`
)

Variables

View Source
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`)
)
View Source
var DebugStateServiceSwagger []byte
View Source
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

func DeleteStateByPrefixes(s state.State, prefixes []string) (map[string]uint32, error)

DeleteStateByPrefixes deletes from state entries with matching key prefix raw function, do not use State wrappers, like encryption

func InvokeStateClean

func InvokeStateClean(c router.Context) (interface{}, error)

InvokeStateClean delete entries from state, prefix []string contains key prefixes or whole key

func InvokeStateDelete

func InvokeStateDelete(c router.Context) (interface{}, error)

QueryStateGet router handler delete state entry by key ([]string)

func InvokeStatePut

func InvokeStatePut(c router.Context) (interface{}, error)

InvokeValueByKeyPut router handler puts value in chaincode state with composite key, created with key parts ([]string)

func QueryKeysList

func QueryKeysList(c router.Context) (interface{}, error)

QueryKeysList router handler returns string slice with keys by prefix (object type)

func QueryStateGet

func QueryStateGet(c router.Context) (interface{}, error)

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.

func RegisterDebugStateServiceServer added in v0.10.1

func RegisterDebugStateServiceServer(s *grpc.Server, srv DebugStateServiceServer)

func StateAsIs added in v0.7.3

func StateAsIs(ctx router.Context) state.State

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 (*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 (*DebugStateServiceGateway) ListKeys added in v0.10.1

func (*DebugStateServiceGateway) PutState added in v0.10.1

func (c *DebugStateServiceGateway) PutState(ctx context.Context, in *Value) (*Value, error)

func (*DebugStateServiceGateway) ServiceDef added in v0.10.1

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

Deprecated: Use Prefix.ProtoReflect.Descriptor instead.

func (*Prefix) GetKey added in v0.7.3

func (x *Prefix) GetKey() []string

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

func (*Prefix) Reset added in v0.7.3

func (x *Prefix) Reset()

func (*Prefix) String added in v0.7.3

func (x *Prefix) String() string

func (*Prefix) Validate added in v0.7.3

func (this *Prefix) Validate() error

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

Deprecated: Use Prefixes.ProtoReflect.Descriptor instead.

func (*Prefixes) GetPrefixes added in v0.7.3

func (x *Prefixes) GetPrefixes() []*Prefix

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

func (*Prefixes) Reset added in v0.7.3

func (x *Prefixes) Reset()

func (*Prefixes) String added in v0.7.3

func (x *Prefixes) String() string

func (*Prefixes) Validate added in v0.7.3

func (this *Prefixes) Validate() error

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

type StateFn func(router.Context) state.State

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)

func (*StateService) PutState added in v0.10.1

func (s *StateService) PutState(ctx router.Context, val *Value) (*Value, 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) DeleteStates added in v0.10.1

func (*UnimplementedDebugStateServiceServer) GetState added in v0.10.1

func (*UnimplementedDebugStateServiceServer) ListKeys added in v0.10.1

func (*UnimplementedDebugStateServiceServer) PutState added in v0.10.1

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

Deprecated: Use Value.ProtoReflect.Descriptor instead.

func (*Value) GetJson added in v0.7.3

func (x *Value) GetJson() string

func (*Value) GetKey added in v0.7.3

func (x *Value) GetKey() []string

func (*Value) GetValue added in v0.7.3

func (x *Value) GetValue() []byte

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

func (*Value) Reset added in v0.7.3

func (x *Value) Reset()

func (*Value) String added in v0.7.3

func (x *Value) String() string

func (*Value) Validate added in v0.7.3

func (this *Value) Validate() error

Jump to

Keyboard shortcuts

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