batch

package
v0.7.6 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Batch

type Batch struct {
	ID    string
	Count int
	// contains filtered or unexported fields
}

Batch contains and points multiple data ID. it manages data IDs using trie-like structure.

func UnmarshalBatch

func UnmarshalBatch(batchID string, rawBatch []byte) (*Batch, error)

UnmarshalBatch decodes a batch from the bytes.

func (*Batch) Append

func (batch *Batch) Append(dataID types.DataId)

Append adds a data ID to the batch.

func (*Batch) Iterator

func (batch *Batch) Iterator() chan types.DataId

Iterator returns an iterator channel that can be used to traverse data IDs in for-range loop.

func (*Batch) Marshal

func (batch *Batch) Marshal() []byte

Marshal encodes a batch to the bytes.

type BatchManager

type BatchManager struct {
	// contains filtered or unexported fields
}

BatchManager creates a batch (pointing multiple Data ID) and manages batches by storing them on the local database.

func NewBatchManager

func NewBatchManager(localDatabase localdb.Database) *BatchManager

NewBatchManager creates a instance of BatchManager.

func (*BatchManager) Create

func (operator *BatchManager) Create() (*Batch, string, error)

func (*BatchManager) Delete

func (operator *BatchManager) Delete(batchId string) error

func (*BatchManager) Get

func (operator *BatchManager) Get(batchId string) (*Batch, error)

func (*BatchManager) Save

func (operator *BatchManager) Save(batchId string) error

type Bundles

type Bundles map[types.ID]UserIds

type UserIds

type UserIds map[types.ID][][4]byte

Jump to

Keyboard shortcuts

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