contractreader

package
v0.3.1-beholder Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultEncodingVersion = CBOREncodingVersion

Variables

This section is empty.

Functions

func DecodeVersionedBytes

func DecodeVersionedBytes(res any, vData *pb.VersionedBytes) error

func EncodeVersionedBytes

func EncodeVersionedBytes(data any, version EncodingVersion) (*pb.VersionedBytes, error)

func NewCodecServer

func NewCodecServer(impl types.Codec) pb.CodecServer

func NewCodecTestClient

func NewCodecTestClient(conn *grpc.ClientConn) types.Codec

NewCodecTestClient is a test client for types.Codec internal users should instantiate a client directly and set all private fields.

func NewServer

func NewServer(impl types.ContractReader, opts ...ServerOpt) pb.ContractReaderServer

func RegisterContractReaderService

func RegisterContractReaderService(s *grpc.Server, contractReader types.ContractReader)

Types

type Client

type Client struct {
	types.UnimplementedContractReader
	// contains filtered or unexported fields
}

func NewClient

func NewClient(b *net.BrokerExt, cc grpc.ClientConnInterface, opts ...ClientOpt) *Client

func (*Client) BatchGetLatestValues

func (*Client) Bind

func (c *Client) Bind(ctx context.Context, bindings []types.BoundContract) error

func (*Client) ClientConn

func (c *Client) ClientConn() grpc.ClientConnInterface

func (*Client) Close

func (c *Client) Close() error

func (*Client) GetLatestValue

func (c *Client) GetLatestValue(ctx context.Context, readIdentifier string, confidenceLevel primitives.ConfidenceLevel, params, retVal any) error

func (*Client) GetLatestValueWithHeadData

func (c *Client) GetLatestValueWithHeadData(ctx context.Context, readIdentifier string, confidenceLevel primitives.ConfidenceLevel, params, retVal any) (*types.Head, error)

func (*Client) HealthReport

func (c *Client) HealthReport() map[string]error

func (*Client) Name

func (c *Client) Name() string

func (*Client) QueryKey

func (c *Client) QueryKey(ctx context.Context, contract types.BoundContract, filter query.KeyFilter, limitAndSort query.LimitAndSort, sequenceDataType any) ([]types.Sequence, error)

func (*Client) Ready

func (c *Client) Ready() error

func (*Client) Start

func (c *Client) Start(ctx context.Context) error

func (*Client) Unbind

func (c *Client) Unbind(ctx context.Context, bindings []types.BoundContract) error

type ClientOpt

type ClientOpt func(*Client)

func WithClientEncoding

func WithClientEncoding(version EncodingVersion) ClientOpt

type CodecClient

type CodecClient struct {
	*net.BrokerExt
	// contains filtered or unexported fields
}

func NewCodecClient

func NewCodecClient(b *net.BrokerExt, cc grpc.ClientConnInterface, opts ...CodecClientOpt) *CodecClient

func (*CodecClient) Decode

func (c *CodecClient) Decode(ctx context.Context, raw []byte, into any, itemType string) error

func (*CodecClient) Encode

func (c *CodecClient) Encode(ctx context.Context, item any, itemType string) ([]byte, error)

func (*CodecClient) GetMaxDecodingSize

func (c *CodecClient) GetMaxDecodingSize(ctx context.Context, n int, itemType string) (int, error)

func (*CodecClient) GetMaxEncodingSize

func (c *CodecClient) GetMaxEncodingSize(ctx context.Context, n int, itemType string) (int, error)

type CodecClientOpt

type CodecClientOpt func(*CodecClient)

func WithCodecClientEncoding

func WithCodecClientEncoding(version EncodingVersion) CodecClientOpt

type CodecServer

type CodecServer struct {
	pb.UnimplementedCodecServer
	// contains filtered or unexported fields
}

func (*CodecServer) GetDecoding

func (*CodecServer) GetEncoding

func (*CodecServer) GetMaxSize

type EncodingVersion

type EncodingVersion uint32
const (
	JSONEncodingVersion1 EncodingVersion = iota
	JSONEncodingVersion2
	CBOREncodingVersion
	ValuesEncodingVersion
)

enum of all known encoding formats for versioned data.

func (EncodingVersion) Uint32

func (v EncodingVersion) Uint32() uint32

type Server

type Server struct {
	pb.UnimplementedContractReaderServer
	// contains filtered or unexported fields
}

func (*Server) BatchGetLatestValues

func (c *Server) BatchGetLatestValues(ctx context.Context, pbRequest *pb.BatchGetLatestValuesRequest) (*pb.BatchGetLatestValuesReply, error)

func (*Server) Bind

func (c *Server) Bind(ctx context.Context, bindings *pb.BindRequest) (*emptypb.Empty, error)

func (*Server) GetLatestValue

func (c *Server) GetLatestValue(ctx context.Context, request *pb.GetLatestValueRequest) (*pb.GetLatestValueReply, error)

func (*Server) GetLatestValueWithHeadData

func (c *Server) GetLatestValueWithHeadData(ctx context.Context, request *pb.GetLatestValueRequest) (*pb.GetLatestValueWithHeadDataReply, error)

func (*Server) QueryKey

func (c *Server) QueryKey(ctx context.Context, request *pb.QueryKeyRequest) (*pb.QueryKeyReply, error)

func (*Server) Unbind

func (c *Server) Unbind(ctx context.Context, bindings *pb.UnbindRequest) (*emptypb.Empty, error)

type ServerOpt

type ServerOpt func(*Server)

func WithServerEncoding

func WithServerEncoding(version EncodingVersion) ServerOpt

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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