eq_bundle

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type Barrel

type Barrel struct {
	MouldId string `json:"mould_id"`
	BatchId string `json:"batch_id"`
	Time    int64  `json:"time"`
	D       []byte `json:"d"`
}

func FromBytes

func FromBytes(b []byte) (barrel Barrel, err error)

Deserialize from byte sequence.

func NewBarrel

func NewBarrel(mouldId, batchId string, d []byte) Barrel

func (Barrel) BarrelBatch

func (z Barrel) BarrelBatch() string

func (Barrel) ToBytes

func (z Barrel) ToBytes() (d []byte)

type Bundle

type Bundle interface {
	// Enqueue data with batchId
	Enqueue(b Barrel)

	// Fetch data from the queue.
	Fetch() (b Barrel, found bool)

	// Mark data as completed
	Complete(b Barrel)

	// Size of uncompleted tasks.
	Size() (total int)

	// Size of the InProgress queue
	SizeInProgress() int

	// Close this bundle.
	Close()

	// Preserve this bundle.
	Preserve() (session Session, err error)
}

Bundle interface will not return error. If there any error happens, the impl. should recover from the error themself or raise panic() to tell critical issue to the caller.

func NewSimple

func NewSimple(logger esl.Logger,
	policy FetchPolicy,
	progress eq_progress.Progress,
	factory eq_pipe.Factory) Bundle

func RestoreSimple

func RestoreSimple(logger esl.Logger,
	policy FetchPolicy,
	progress eq_progress.Progress,
	factory eq_pipe.Factory,
	session Session) (b Bundle, err error)

type FetchPolicy

type FetchPolicy string
const (
	FetchSequential FetchPolicy = "sequential"
	FetchRandom     FetchPolicy = "random"
	FetchBalance    FetchPolicy = "balance"
)

type OnCompleteHandler

type OnCompleteHandler func(batchId string, completed, total int)

type Session

type Session struct {
	Pipes      map[string]eq_pipe.SessionId `json:"pipes"`
	InProgress eq_pipe.SessionId            `json:"in_progress"`
}

Jump to

Keyboard shortcuts

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