aggregate

package
v0.1.14 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2023 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AlreadyFinalized = errors.MakeExternalError("group has already been finalized", "GROUP-STORE", nil, nil)
View Source
var AlreadyInitialized = errors.MakeExternalError("group has already been initialized", "GROUP-STORE", nil, nil)
View Source
var NotFound = errors.MakeExternalError("group not found", "GROUP-STORE", nil, nil)

Functions

This section is empty.

Types

type Function

type Function interface {
	// Initialize a group
	Merge(group []Group) (Group, error)
	Initialize(group Group) error
	// Add an item to a given group
	Add(item *kodex.Item, group Group) error
	// Finalize a group and return the result
	Finalize(group Group) (interface{}, error)
}

type Group

type Group interface {
	Initialized() bool
	Initialize(state State) error
	State() State
	GroupByValues() map[string]interface{}
	Hash() []byte
	Expiration() int64
	Clone() (Group, error)
	Lock()
	Unlock()
}

type GroupStore

type GroupStore interface {
	// Tear down the group store
	Teardown() error
	// Reset the entire state of the group store
	Reset() error
	// Get a shard from the store
	Shard() (Shard, error)
	// Expire groups in all shards based on an expiration index
	ExpireGroups(expiration int64) (map[string][]Group, error)
	// Expire all groups in all shards
	ExpireAllGroups() (map[string][]Group, error)
}

type Shard

type Shard interface {
	// A unique ID identifying the shard globally
	ID() interface{}
	// Synchronize the shard state with the backend
	Commit() error
	// Return the shard to the group store so that it can be reused
	Return() error
	// Create a group in the shard
	CreateGroup(hash []byte, groupByValues map[string]interface{}, expiration int64) (Group, error)
	// Return a group by its unique hash value
	GroupByHash(hash []byte) (Group, error)
	// Expire groups in the shard based on an expiration index
	ExpireGroups(expiration int64) ([]Group, error)
	// Expire all groups in the shard
	ExpireAllGroups() ([]Group, error)
}

type State

type State interface {
	Serialize() ([]byte, error)
	Deserialize([]byte) error
	Clone() (State, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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