stream

package
v1.3.1-RC1 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2022 License: Apache-2.0 Imports: 7 Imported by: 3

Documentation

Index

Constants

View Source
const (
	TOp_Kv byte = 1 << iota
	TOp_ZAdd
	TOp_Ref
)
View Source
const DefaultChunkSize int = 64 * 1024 // 64 * 1024 64 KiB
View Source
const MaxTxValueLen int = 1 << 25 // 32Mb
View Source
const MinChunkSize int = 4096

Variables

View Source
var ErrChunkTooSmall = fmt.Sprintf("minimum chunk size is %d", MinChunkSize)
View Source
var ErrMaxTxValuesLenExceeded = "max transaction values length exceeded"
View Source
var ErrMaxValueLenExceeded = "internal store max value length exceeded"
View Source
var ErrMessageLengthIsZero = "message trailer length is declared equal to zero"
View Source
var ErrMissingExpectedData = "expected data on stream is missing"
View Source
var ErrNotEnoughDataOnStream = "not enough data to build the expected message. check value length declaration"
View Source
var ErrReaderIsEmpty = "reader contains no data"
View Source
var ErrRefOptNotImplemented = "reference operation is not implemented"
View Source
var ErrUnableToReassembleExecAllMessage = "unable to reassemble ZAdd message on a streamExecAll"
View Source
var ProveSinceTxFakeKey = []byte("ProveSinceTx")

Functions

func NewKvStreamSender

func NewKvStreamSender(s MsgSender) *kvStreamSender

NewKvStreamSender returns a new kvStreamSender

func NewMsgReceiver

func NewMsgReceiver(stream ImmuServiceReceiver_Stream) *msgReceiver

NewMsgReceiver returns a NewMsgReceiver reader

func NewMsgSender

func NewMsgSender(s ImmuServiceSender_Stream, bs int) *msgSender

NewMsgSender returns a NewMsgSender. It can be used on server side or client side to send a message on a stream.

func NewVEntryStreamSender

func NewVEntryStreamSender(s MsgSender) *vEntryStreamSender

func NewZStreamReceiver

func NewZStreamReceiver(s io.Reader, bs int) *zStreamReceiver

NewZStreamReceiver ...

func NewZStreamSender

func NewZStreamSender(s MsgSender) *zStreamSender

NewZStreamSender ...

func NumberFromBytes

func NumberFromBytes(bs []byte, n interface{}) error

NumberFromBytes ...

func NumberToBytes

func NumberToBytes(n interface{}) ([]byte, error)

NumberToBytes ...

func ParseVerifiableEntry

func ParseVerifiableEntry(
	entryWithoutValueProto []byte,
	verifiableTxProto []byte,
	inclusionProofProto []byte,
	vr io.Reader,
	chunkSize int,
) (*schema.VerifiableEntry, error)

ParseVerifiableEntry ...

func ParseZEntry

func ParseZEntry(
	set []byte,
	key []byte,
	score float64,
	atTx uint64,
	vr io.Reader,
	chunkSize int,
) (*schema.ZEntry, error)

ParseZEntry ...

func ReadValue

func ReadValue(vr io.Reader, bufferSize int) (value []byte, err error)

ReadValue returns the complete value from a message If no more data is present on the reader nil and io.EOF are returned

Types

type ExecAllRequest

type ExecAllRequest struct {
	Operations []*Op
}

type ExecAllStreamReceiver

type ExecAllStreamReceiver interface {
	Next() (IsOp_Operation, error)
}

func NewExecAllStreamReceiver

func NewExecAllStreamReceiver(s io.Reader, bs int) ExecAllStreamReceiver

NewExecAllStreamReceiver returns a new execAllStreamReceiver

type ExecAllStreamSender

type ExecAllStreamSender interface {
	Send(req *ExecAllRequest) error
}

func NewExecAllStreamSender

func NewExecAllStreamSender(s MsgSender) ExecAllStreamSender

NewExecAllStreamSender returns a new ExecAllStreamSender

type ImmuServiceReceiver_Stream

type ImmuServiceReceiver_Stream interface {
	Recv() (*schema.Chunk, error)
}

ImmuServiceReceiver_Stream is used to inject schema.ImmuService_StreamGetClient, schema.ImmuService_StreamGetClient, schema.ImmuService_StreamHistoryClient and similar inside both client and server receivers

type ImmuServiceSender_Stream

type ImmuServiceSender_Stream interface {
	Send(*schema.Chunk) error
	RecvMsg(m interface{}) error // used to retrieve server side errors
}

ImmuServiceSender_Stream is used to inject schema.ImmuService_StreamGetServer, schema.ImmuService_StreamZScanServer inside both client and server senders

type IsOp_Operation

type IsOp_Operation interface {
	// contains filtered or unexported methods
}

type KeyValue

type KeyValue struct {
	Key   *ValueSize
	Value *ValueSize
}

type KvStreamReceiver

type KvStreamReceiver interface {
	Next() ([]byte, io.Reader, error)
}

func NewKvStreamReceiver

func NewKvStreamReceiver(s io.Reader, bs int) KvStreamReceiver

NewKvStreamReceiver returns a new kvStreamReceiver

type KvStreamSender

type KvStreamSender interface {
	Send(kv *KeyValue) error
}

type MsgReceiver

type MsgReceiver interface {
	Read(data []byte) (n int, err error)
	ReadFully() ([]byte, error)
}

type MsgSender

type MsgSender interface {
	Send(reader io.Reader, payloadSize int) (err error)
	RecvMsg(m interface{}) error
}

type Op

type Op struct {
	Operation IsOp_Operation
}

type Op_KeyValue

type Op_KeyValue struct {
	KeyValue *KeyValue
}

type Op_Ref

type Op_Ref struct{}

type Op_ZAdd

type Op_ZAdd struct {
	ZAdd *schema.ZAddRequest
}

type ServiceFactory

type ServiceFactory interface {
	NewMsgReceiver(str ImmuServiceReceiver_Stream) MsgReceiver
	NewMsgSender(str ImmuServiceSender_Stream) MsgSender

	NewKvStreamReceiver(str MsgReceiver) KvStreamReceiver
	NewKvStreamSender(str MsgSender) KvStreamSender

	NewVEntryStreamReceiver(str MsgReceiver) VEntryStreamReceiver
	NewVEntryStreamSender(str MsgSender) VEntryStreamSender

	NewZStreamReceiver(str MsgReceiver) ZStreamReceiver
	NewZStreamSender(str MsgSender) ZStreamSender

	NewExecAllStreamSender(str MsgSender) ExecAllStreamSender
	NewExecAllStreamReceiver(str MsgReceiver) ExecAllStreamReceiver
}

ServiceFactory returns high level immudb streaming services High level services are capable to receive and send immudb transportation objects. Those services rely on internal more generic receiver and sender services.

func NewStreamServiceFactory

func NewStreamServiceFactory(chunkSize int) ServiceFactory

NewStreamServiceFactory returns a new ServiceFactory

type VEntryStreamReceiver

type VEntryStreamReceiver interface {
	Next() ([]byte, []byte, []byte, io.Reader, error)
}

VEntryStreamReceiver ...

func NewVEntryStreamReceiver

func NewVEntryStreamReceiver(s io.Reader, bs int) VEntryStreamReceiver

NewVEntryStreamReceiver ...

type VEntryStreamSender

type VEntryStreamSender interface {
	Send(ve *VerifiableEntry) error
}

VEntryStreamSender ...

type ValueSize

type ValueSize struct {
	Content io.Reader
	Size    int
}

type VerifiableEntry

type VerifiableEntry struct {
	EntryWithoutValueProto *ValueSize
	VerifiableTxProto      *ValueSize
	InclusionProofProto    *ValueSize
	Value                  *ValueSize
}

type ZEntry

type ZEntry struct {
	Set   *ValueSize
	Key   *ValueSize
	Score *ValueSize
	AtTx  *ValueSize
	Value *ValueSize
}

type ZStreamReceiver

type ZStreamReceiver interface {
	Next() ([]byte, []byte, float64, uint64, io.Reader, error)
}

ZStreamReceiver ...

type ZStreamSender

type ZStreamSender interface {
	Send(ze *ZEntry) error
}

ZStreamSender ...

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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