chainreader

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2024 License: MIT Imports: 17 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.ChainReaderServer

func RegisterContractReaderService

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

Types

type Client

type Client struct {
	*goplugin.ServiceClient
	// contains filtered or unexported fields
}

func NewClient

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

func (*Client) Bind

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

func (*Client) GetLatestValue

func (c *Client) GetLatestValue(ctx context.Context, contractName, method string, confidenceLevel primitives.ConfidenceLevel, params, returnVal any) error

func (*Client) QueryKey

func (c *Client) QueryKey(ctx context.Context, contractName string, filter query.KeyFilter, limitAndSort query.LimitAndSort, sequenceDataType any) ([]types.Sequence, 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
)

enum of all known encoding formats for versioned data.

func (EncodingVersion) Uint32

func (v EncodingVersion) Uint32() uint32

type Server

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

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) QueryKey

func (c *Server) QueryKey(ctx context.Context, request *pb.QueryKeyRequest) (*pb.QueryKeyReply, 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