cos

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: May 29, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientIFace added in v0.0.7

type ClientIFace[T proto.Message] interface {
	// ProcessCommand sends a command to COS and returns the resulting state as T and metadata.
	// The returned error can either be a gRPC error or casting error
	// gRPC status codes: https://grpc.github.io/grpc/core/md_doc_statuscodes.html
	ProcessCommand(ctx context.Context, entityID string, command proto.Message) (T, *cospb.MetaData, error)
	// GetState retrieves the current state as T of an entity and its metadata
	// The returned error can either be a gRPC error or casting error
	// gRPC status codes: https://grpc.github.io/grpc/core/md_doc_statuscodes.html
	GetState(ctx context.Context, entityID string) (T, *cospb.MetaData, error)
}

ClientIFace is the interface for a cos client

type CosClient

type CosClient[T proto.Message] struct {
	Remote cospb.ChiefOfStateServiceClient
}

CosClient implements the Client interface

func NewClient

func NewClient[T proto.Message](conn *grpc.ClientConn) CosClient[T]

NewClient creates a new instance of Client

func (CosClient[T]) GetState

func (c CosClient[T]) GetState(ctx context.Context, entityID string) (T, *cospb.MetaData, error)

GetState retrieves the current state as T of an entity and its metadata The returned error can either be a gRPC error or casting error gRPC status codes: https://grpc.github.io/grpc/core/md_doc_statuscodes.html

func (CosClient[T]) ProcessCommand

func (c CosClient[T]) ProcessCommand(ctx context.Context, entityID string, command proto.Message) (T, *cospb.MetaData, error)

ProcessCommand sends a command to COS and returns the resulting state as T and metadata. The returned error can either be a gRPC error or casting error gRPC status codes: https://grpc.github.io/grpc/core/md_doc_statuscodes.html

Jump to

Keyboard shortcuts

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