crosscc

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: 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.

README

Cross chaincode service calls extension

Documentation

Overview

Package crosscc 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 crosscc is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (

	// SettingServiceChaincodeMethodPrefix allows to use multiple services with same method names in one chaincode
	SettingServiceChaincodeMethodPrefix = "SettingService."

	SettingServiceChaincode_ServiceLocatorSet = SettingServiceChaincodeMethodPrefix + "ServiceLocatorSet"

	SettingServiceChaincode_ServiceLocatorGet = SettingServiceChaincodeMethodPrefix + "ServiceLocatorGet"

	SettingServiceChaincode_ListServiceLocators = SettingServiceChaincodeMethodPrefix + "ListServiceLocators"

	SettingServiceChaincode_PingService = SettingServiceChaincodeMethodPrefix + "PingService"

	SettingServiceChaincode_PingServices = SettingServiceChaincodeMethodPrefix + "PingServices"
)

SettingServiceChaincode method names

Variables

View Source
var (
	StateMappings = m.StateMappings{}.
					Add(&ServiceLocator{},
			m.PKeySchema(&ServiceLocatorId{}),
			m.List(&ServiceLocators{}))

	EventMappings = m.EventMappings{}.
					Add(&ServiceLocatorSet{})
)
View Source
var File_crosscc_cclocator_setting_proto protoreflect.FileDescriptor
View Source
var SettingServiceSwagger []byte

Functions

func Event

func Event(ctx router.Context) state.Event

func RegisterSettingServiceChaincode

func RegisterSettingServiceChaincode(r *cckit_router.Group, cc SettingServiceChaincode) error

RegisterSettingServiceChaincode registers service methods as chaincode router handlers

func RegisterSettingServiceHandler

func RegisterSettingServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterSettingServiceHandler registers the http handlers for service SettingService to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterSettingServiceHandlerClient

func RegisterSettingServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client SettingServiceClient) error

RegisterSettingServiceHandlerClient registers the http handlers for service SettingService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "SettingServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "SettingServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "SettingServiceClient" to call the correct interceptors.

func RegisterSettingServiceHandlerFromEndpoint

func RegisterSettingServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterSettingServiceHandlerFromEndpoint is same as RegisterSettingServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterSettingServiceHandlerServer

func RegisterSettingServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server SettingServiceServer) error

RegisterSettingServiceHandlerServer registers the http handlers for service SettingService to "mux". UnaryRPC :call SettingServiceServer 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 RegisterSettingServiceHandlerFromEndpoint instead.

func RegisterSettingServiceServer

func RegisterSettingServiceServer(s *grpc.Server, srv SettingServiceServer)

func State

func State(ctx router.Context) m.MappedState

Types

type PingServiceResponse

type PingServiceResponse struct {
	Locator *ServiceLocator `protobuf:"bytes,1,opt,name=locator,proto3" json:"locator,omitempty"`
	Error   string          `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"`
	// contains filtered or unexported fields
}

func (*PingServiceResponse) Descriptor deprecated

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

Deprecated: Use PingServiceResponse.ProtoReflect.Descriptor instead.

func (*PingServiceResponse) GetError

func (x *PingServiceResponse) GetError() string

func (*PingServiceResponse) GetLocator

func (x *PingServiceResponse) GetLocator() *ServiceLocator

func (*PingServiceResponse) ProtoMessage

func (*PingServiceResponse) ProtoMessage()

func (*PingServiceResponse) ProtoReflect

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

func (*PingServiceResponse) Reset

func (x *PingServiceResponse) Reset()

func (*PingServiceResponse) String

func (x *PingServiceResponse) String() string

func (*PingServiceResponse) Validate

func (this *PingServiceResponse) Validate() error

type PingServiceResponses

type PingServiceResponses struct {
	Responses []*PingServiceResponse `protobuf:"bytes,1,rep,name=responses,proto3" json:"responses,omitempty"`
	// contains filtered or unexported fields
}

func (*PingServiceResponses) Descriptor deprecated

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

Deprecated: Use PingServiceResponses.ProtoReflect.Descriptor instead.

func (*PingServiceResponses) GetResponses

func (x *PingServiceResponses) GetResponses() []*PingServiceResponse

func (*PingServiceResponses) ProtoMessage

func (*PingServiceResponses) ProtoMessage()

func (*PingServiceResponses) ProtoReflect

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

func (*PingServiceResponses) Reset

func (x *PingServiceResponses) Reset()

func (*PingServiceResponses) String

func (x *PingServiceResponses) String() string

func (*PingServiceResponses) Validate

func (this *PingServiceResponses) Validate() error

type ServiceLocator

type ServiceLocator struct {
	Service   string `protobuf:"bytes,1,opt,name=service,proto3" json:"service,omitempty"`     // service identifier
	Channel   string `protobuf:"bytes,2,opt,name=channel,proto3" json:"channel,omitempty"`     // channel id
	Chaincode string `protobuf:"bytes,3,opt,name=chaincode,proto3" json:"chaincode,omitempty"` // chaincode name
	// contains filtered or unexported fields
}

State: ervice resolving setting

func (*ServiceLocator) Descriptor deprecated

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

Deprecated: Use ServiceLocator.ProtoReflect.Descriptor instead.

func (*ServiceLocator) GetChaincode

func (x *ServiceLocator) GetChaincode() string

func (*ServiceLocator) GetChannel

func (x *ServiceLocator) GetChannel() string

func (*ServiceLocator) GetService

func (x *ServiceLocator) GetService() string

func (*ServiceLocator) ProtoMessage

func (*ServiceLocator) ProtoMessage()

func (*ServiceLocator) ProtoReflect

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

func (*ServiceLocator) Reset

func (x *ServiceLocator) Reset()

func (*ServiceLocator) String

func (x *ServiceLocator) String() string

func (*ServiceLocator) Validate

func (this *ServiceLocator) Validate() error

type ServiceLocatorId

type ServiceLocatorId struct {
	Service string `protobuf:"bytes,1,opt,name=service,proto3" json:"service,omitempty"` // service identifier
	// contains filtered or unexported fields
}

Id: service resolving setting identifier

func (*ServiceLocatorId) Descriptor deprecated

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

Deprecated: Use ServiceLocatorId.ProtoReflect.Descriptor instead.

func (*ServiceLocatorId) GetService

func (x *ServiceLocatorId) GetService() string

func (*ServiceLocatorId) ProtoMessage

func (*ServiceLocatorId) ProtoMessage()

func (*ServiceLocatorId) ProtoReflect

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

func (*ServiceLocatorId) Reset

func (x *ServiceLocatorId) Reset()

func (*ServiceLocatorId) String

func (x *ServiceLocatorId) String() string

func (*ServiceLocatorId) Validate

func (this *ServiceLocatorId) Validate() error

type ServiceLocatorSet

type ServiceLocatorSet struct {
	Service   string `protobuf:"bytes,1,opt,name=service,proto3" json:"service,omitempty"`     // service identifier
	Channel   string `protobuf:"bytes,2,opt,name=channel,proto3" json:"channel,omitempty"`     // channel id
	Chaincode string `protobuf:"bytes,3,opt,name=chaincode,proto3" json:"chaincode,omitempty"` // chaincode name
	// contains filtered or unexported fields
}

Event: service resolving settings was set

func (*ServiceLocatorSet) Descriptor deprecated

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

Deprecated: Use ServiceLocatorSet.ProtoReflect.Descriptor instead.

func (*ServiceLocatorSet) GetChaincode

func (x *ServiceLocatorSet) GetChaincode() string

func (*ServiceLocatorSet) GetChannel

func (x *ServiceLocatorSet) GetChannel() string

func (*ServiceLocatorSet) GetService

func (x *ServiceLocatorSet) GetService() string

func (*ServiceLocatorSet) ProtoMessage

func (*ServiceLocatorSet) ProtoMessage()

func (*ServiceLocatorSet) ProtoReflect

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

func (*ServiceLocatorSet) Reset

func (x *ServiceLocatorSet) Reset()

func (*ServiceLocatorSet) String

func (x *ServiceLocatorSet) String() string

func (*ServiceLocatorSet) Validate

func (this *ServiceLocatorSet) Validate() error

type ServiceLocatorSetRequest

type ServiceLocatorSetRequest struct {
	Service   string `protobuf:"bytes,1,opt,name=service,proto3" json:"service,omitempty"`     // service identifier
	Channel   string `protobuf:"bytes,2,opt,name=channel,proto3" json:"channel,omitempty"`     // channel id
	Chaincode string `protobuf:"bytes,3,opt,name=chaincode,proto3" json:"chaincode,omitempty"` // chaincode name
	// contains filtered or unexported fields
}

Request: set service resolving setting

func (*ServiceLocatorSetRequest) Descriptor deprecated

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

Deprecated: Use ServiceLocatorSetRequest.ProtoReflect.Descriptor instead.

func (*ServiceLocatorSetRequest) GetChaincode

func (x *ServiceLocatorSetRequest) GetChaincode() string

func (*ServiceLocatorSetRequest) GetChannel

func (x *ServiceLocatorSetRequest) GetChannel() string

func (*ServiceLocatorSetRequest) GetService

func (x *ServiceLocatorSetRequest) GetService() string

func (*ServiceLocatorSetRequest) ProtoMessage

func (*ServiceLocatorSetRequest) ProtoMessage()

func (*ServiceLocatorSetRequest) ProtoReflect

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

func (*ServiceLocatorSetRequest) Reset

func (x *ServiceLocatorSetRequest) Reset()

func (*ServiceLocatorSetRequest) String

func (x *ServiceLocatorSetRequest) String() string

func (*ServiceLocatorSetRequest) Validate

func (this *ServiceLocatorSetRequest) Validate() error

type ServiceLocators

type ServiceLocators struct {
	Items []*ServiceLocator `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"`
	// contains filtered or unexported fields
}

List: service resolving settings

func (*ServiceLocators) Descriptor deprecated

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

Deprecated: Use ServiceLocators.ProtoReflect.Descriptor instead.

func (*ServiceLocators) GetItems

func (x *ServiceLocators) GetItems() []*ServiceLocator

func (*ServiceLocators) ProtoMessage

func (*ServiceLocators) ProtoMessage()

func (*ServiceLocators) ProtoReflect

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

func (*ServiceLocators) Reset

func (x *ServiceLocators) Reset()

func (*ServiceLocators) String

func (x *ServiceLocators) String() string

func (*ServiceLocators) Validate

func (this *ServiceLocators) Validate() error

type SettingService

type SettingService struct{}

func NewSettingService

func NewSettingService() *SettingService

func (*SettingService) ListServiceLocators

func (c *SettingService) ListServiceLocators(ctx router.Context, _ *empty.Empty) (*ServiceLocators, error)

func (*SettingService) LocatorResolver

func (c *SettingService) LocatorResolver() gateway.ChaincodeLocatorResolver

func (*SettingService) PingService

func (c *SettingService) PingService(context router.Context, id *ServiceLocatorId) (*PingServiceResponse, error)

func (*SettingService) PingServices

func (c *SettingService) PingServices(context router.Context, empty *empty.Empty) (*PingServiceResponses, error)

func (*SettingService) ServiceLocatorGet

func (c *SettingService) ServiceLocatorGet(ctx router.Context, id *ServiceLocatorId) (*ServiceLocator, error)

func (*SettingService) ServiceLocatorSet

func (c *SettingService) ServiceLocatorSet(ctx router.Context, locatorSet *ServiceLocatorSetRequest) (*ServiceLocator, error)

type SettingServiceChaincode

SettingServiceChaincode chaincode methods interface

type SettingServiceClient

type SettingServiceClient interface {
	ServiceLocatorSet(ctx context.Context, in *ServiceLocatorSetRequest, opts ...grpc.CallOption) (*ServiceLocator, error)
	ServiceLocatorGet(ctx context.Context, in *ServiceLocatorId, opts ...grpc.CallOption) (*ServiceLocator, error)
	ListServiceLocators(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*ServiceLocators, error)
	// Try to query chaincodes from service chaincode settings
	PingService(ctx context.Context, in *ServiceLocatorId, opts ...grpc.CallOption) (*PingServiceResponse, error)
	PingServices(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*PingServiceResponses, error)
}

SettingServiceClient is the client API for SettingService service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

type SettingServiceGateway

type SettingServiceGateway 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 NewSettingServiceGateway

func NewSettingServiceGateway(sdk cckit_sdk.SDK, channel, chaincode string, opts ...cckit_gateway.Opt) *SettingServiceGateway

NewSettingServiceGateway creates gateway to access chaincode method via chaincode service

func NewSettingServiceGatewayFromInstance

func NewSettingServiceGatewayFromInstance(chaincodeInstance cckit_gateway.ChaincodeInstance) *SettingServiceGateway

func (*SettingServiceGateway) Invoker

func (*SettingServiceGateway) ListServiceLocators

func (c *SettingServiceGateway) ListServiceLocators(ctx context.Context, in *emptypb.Empty) (*ServiceLocators, error)

func (*SettingServiceGateway) PingService

func (*SettingServiceGateway) PingServices

func (*SettingServiceGateway) ServiceDef

ServiceDef returns service definition

func (*SettingServiceGateway) ServiceLocatorGet

func (c *SettingServiceGateway) ServiceLocatorGet(ctx context.Context, in *ServiceLocatorId) (*ServiceLocator, error)

func (*SettingServiceGateway) ServiceLocatorSet

type SettingServiceServer

type SettingServiceServer interface {
	ServiceLocatorSet(context.Context, *ServiceLocatorSetRequest) (*ServiceLocator, error)
	ServiceLocatorGet(context.Context, *ServiceLocatorId) (*ServiceLocator, error)
	ListServiceLocators(context.Context, *emptypb.Empty) (*ServiceLocators, error)
	// Try to query chaincodes from service chaincode settings
	PingService(context.Context, *ServiceLocatorId) (*PingServiceResponse, error)
	PingServices(context.Context, *emptypb.Empty) (*PingServiceResponses, error)
}

SettingServiceServer is the server API for SettingService service.

type UnimplementedSettingServiceServer

type UnimplementedSettingServiceServer struct {
}

UnimplementedSettingServiceServer can be embedded to have forward compatible implementations.

func (*UnimplementedSettingServiceServer) ListServiceLocators

func (*UnimplementedSettingServiceServer) PingService

func (*UnimplementedSettingServiceServer) PingServices

func (*UnimplementedSettingServiceServer) ServiceLocatorGet

func (*UnimplementedSettingServiceServer) ServiceLocatorSet

Jump to

Keyboard shortcuts

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