debug

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2023 License: Apache-2.0 Imports: 29 Imported by: ? modules, 0 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

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

func RegisterDebugStateServiceChaincode(r *cckit_router.Group, cc DebugStateServiceChaincode) error

RegisterDebugStateServiceChaincode registers service methods as chaincode router handlers

func RegisterDebugStateServiceHandler

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

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

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

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

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

func StateAsIs

func StateAsIs(ctx router.Context) state.State

Types

type CompositeKey

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

func (*CompositeKey) Descriptor() ([]byte, []int)

Deprecated: Use CompositeKey.ProtoReflect.Descriptor instead.

func (*CompositeKey) GetKey

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

func (*CompositeKey) ProtoMessage

func (*CompositeKey) ProtoMessage()

func (*CompositeKey) ProtoReflect

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

func (*CompositeKey) Reset

func (x *CompositeKey) Reset()

func (*CompositeKey) String

func (x *CompositeKey) String() string

func (*CompositeKey) Validate

func (this *CompositeKey) Validate() error

type CompositeKeys

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

func (*CompositeKeys) Descriptor() ([]byte, []int)

Deprecated: Use CompositeKeys.ProtoReflect.Descriptor instead.

func (*CompositeKeys) GetKeys

func (x *CompositeKeys) GetKeys() []*CompositeKey

func (*CompositeKeys) ProtoMessage

func (*CompositeKeys) ProtoMessage()

func (*CompositeKeys) ProtoReflect

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

func (*CompositeKeys) Reset

func (x *CompositeKeys) Reset()

func (*CompositeKeys) String

func (x *CompositeKeys) String() string

func (*CompositeKeys) Validate

func (this *CompositeKeys) Validate() error

type DebugStateServiceChaincode

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

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.

type DebugStateServiceGateway

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

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

func NewDebugStateServiceGatewayFromInstance(chaincodeInstance cckit_gateway.ChaincodeInstance) *DebugStateServiceGateway

func (*DebugStateServiceGateway) DeleteState

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

func (*DebugStateServiceGateway) DeleteStates

func (*DebugStateServiceGateway) GetState

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

func (*DebugStateServiceGateway) Invoker

func (*DebugStateServiceGateway) ListKeys

func (*DebugStateServiceGateway) PutState

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

func (*DebugStateServiceGateway) ServiceDef

ServiceDef returns service definition

type DebugStateServiceServer

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

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

func (*Prefix) Descriptor() ([]byte, []int)

Deprecated: Use Prefix.ProtoReflect.Descriptor instead.

func (*Prefix) GetKey

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

func (*Prefix) ProtoMessage

func (*Prefix) ProtoMessage()

func (*Prefix) ProtoReflect

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

func (*Prefix) Reset

func (x *Prefix) Reset()

func (*Prefix) String

func (x *Prefix) String() string

func (*Prefix) Validate

func (this *Prefix) Validate() error

type Prefixes

type Prefixes struct {
	Prefixes []*Prefix `protobuf:"bytes,1,rep,name=prefixes,proto3" json:"prefixes,omitempty"`
	// contains filtered or unexported fields
}

func (*Prefixes) Descriptor deprecated

func (*Prefixes) Descriptor() ([]byte, []int)

Deprecated: Use Prefixes.ProtoReflect.Descriptor instead.

func (*Prefixes) GetPrefixes

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

func (*Prefixes) ProtoMessage

func (*Prefixes) ProtoMessage()

func (*Prefixes) ProtoReflect

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

func (*Prefixes) Reset

func (x *Prefixes) Reset()

func (*Prefixes) String

func (x *Prefixes) String() string

func (*Prefixes) Validate

func (this *Prefixes) Validate() error

type PrefixesMatchCount

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

func (*PrefixesMatchCount) Descriptor() ([]byte, []int)

Deprecated: Use PrefixesMatchCount.ProtoReflect.Descriptor instead.

func (*PrefixesMatchCount) GetMatches

func (x *PrefixesMatchCount) GetMatches() map[string]uint32

func (*PrefixesMatchCount) ProtoMessage

func (*PrefixesMatchCount) ProtoMessage()

func (*PrefixesMatchCount) ProtoReflect

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

func (*PrefixesMatchCount) Reset

func (x *PrefixesMatchCount) Reset()

func (*PrefixesMatchCount) String

func (x *PrefixesMatchCount) String() string

func (*PrefixesMatchCount) Validate

func (this *PrefixesMatchCount) Validate() error

type StateFn

type StateFn func(router.Context) state.State

StateFn function can add mappings to state, for correct convertation in StateGet

type StateService

type StateService struct {
	State StateFn
}

func NewStateService

func NewStateService() *StateService

func (*StateService) DeleteState

func (s *StateService) DeleteState(ctx router.Context, key *CompositeKey) (*Value, error)

func (*StateService) DeleteStates

func (s *StateService) DeleteStates(ctx router.Context, prefixes *Prefixes) (*PrefixesMatchCount, error)

func (*StateService) GetState

func (s *StateService) GetState(ctx router.Context, key *CompositeKey) (*Value, error)

func (*StateService) ListKeys

func (s *StateService) ListKeys(ctx router.Context, prefix *Prefix) (*CompositeKeys, error)

func (*StateService) PutState

func (s *StateService) PutState(ctx router.Context, val *Value) (*Value, error)

type UnimplementedDebugStateServiceServer

type UnimplementedDebugStateServiceServer struct {
}

UnimplementedDebugStateServiceServer can be embedded to have forward compatible implementations.

func (*UnimplementedDebugStateServiceServer) DeleteState

func (*UnimplementedDebugStateServiceServer) DeleteStates

func (*UnimplementedDebugStateServiceServer) GetState

func (*UnimplementedDebugStateServiceServer) ListKeys

func (*UnimplementedDebugStateServiceServer) PutState

type Value

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

func (*Value) Descriptor() ([]byte, []int)

Deprecated: Use Value.ProtoReflect.Descriptor instead.

func (*Value) GetJson

func (x *Value) GetJson() string

func (*Value) GetKey

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

func (*Value) GetValue

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

func (*Value) ProtoMessage

func (*Value) ProtoMessage()

func (*Value) ProtoReflect

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

func (*Value) Reset

func (x *Value) Reset()

func (*Value) String

func (x *Value) String() string

func (*Value) Validate

func (this *Value) Validate() error

Jump to

Keyboard shortcuts

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