groups

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2022 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GroupStores = map[string]GroupStoreMaker{
	"in-memory": MakeInMemoryGroupStore,
}

Functions

func MakeInMemoryGroupStore

func MakeInMemoryGroupStore(config map[string]interface{}, id []byte) (aggregate.GroupStore, error)

Create a new InMemoryGroupStore object for the given config

Types

type GroupStoreMaker

type GroupStoreMaker func(map[string]interface{}, []byte) (aggregate.GroupStore, error)

type GroupsByTo

type GroupsByTo struct {
	To     int64
	Groups map[string]aggregate.Group
}

func (*GroupsByTo) Less

func (g *GroupsByTo) Less(b btree.Item) bool

type InMemoryGroup

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

func MakeInMemoryGroup

func MakeInMemoryGroup(hash []byte,
	groupByValues map[string]interface{},
	expiration int64,
	shard *InMemoryShard) *InMemoryGroup

func (*InMemoryGroup) Clone

func (g *InMemoryGroup) Clone() (aggregate.Group, error)

func (*InMemoryGroup) Expiration

func (g *InMemoryGroup) Expiration() int64

Get the expiration value for the group

func (*InMemoryGroup) GroupByValues

func (g *InMemoryGroup) GroupByValues() map[string]interface{}

Return the group-by fields of a given group

func (*InMemoryGroup) Hash

func (g *InMemoryGroup) Hash() []byte

Get the hash for the group

func (*InMemoryGroup) Initialize

func (g *InMemoryGroup) Initialize(state aggregate.State) error

Initialize the group

func (*InMemoryGroup) Initialized

func (g *InMemoryGroup) Initialized() bool

Returns whether a given group is initialized

func (*InMemoryGroup) Lock

func (g *InMemoryGroup) Lock()

func (*InMemoryGroup) RLock

func (g *InMemoryGroup) RLock()

func (*InMemoryGroup) RUnlock

func (g *InMemoryGroup) RUnlock()

func (*InMemoryGroup) State

func (g *InMemoryGroup) State() aggregate.State

Return the state of the group

func (*InMemoryGroup) Unlock

func (g *InMemoryGroup) Unlock()

type InMemoryGroupStore

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

func (*InMemoryGroupStore) ExpireAllGroups

func (g *InMemoryGroupStore) ExpireAllGroups() (map[string][]aggregate.Group, error)

func (*InMemoryGroupStore) ExpireGroups

func (g *InMemoryGroupStore) ExpireGroups(expiration int64) (map[string][]aggregate.Group, error)

func (*InMemoryGroupStore) Reset

func (g *InMemoryGroupStore) Reset() error

Reset the store

func (*InMemoryGroupStore) Return

func (g *InMemoryGroupStore) Return(id int) error

func (*InMemoryGroupStore) Shard

func (g *InMemoryGroupStore) Shard() (aggregate.Shard, error)

func (*InMemoryGroupStore) Teardown

func (g *InMemoryGroupStore) Teardown() error

type InMemoryShard

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

func MakeInMemoryShard

func MakeInMemoryShard(id int, store *InMemoryGroupStore) *InMemoryShard

Create a new InMemoryShard object

func (*InMemoryShard) Commit

func (g *InMemoryShard) Commit() error

Commit the state of the shard to the store

func (*InMemoryShard) CreateGroup

func (g *InMemoryShard) CreateGroup(hash []byte,
	groupByFields map[string]interface{}, expiration int64) (aggregate.Group, error)

Return a group based on its hash.

func (*InMemoryShard) ExpireAllGroups

func (g *InMemoryShard) ExpireAllGroups() ([]aggregate.Group, error)

func (*InMemoryShard) ExpireGroups

func (g *InMemoryShard) ExpireGroups(expiration int64) ([]aggregate.Group, error)

Get all expired groups for a given config hash and time in the shard

func (*InMemoryShard) GroupByHash

func (g *InMemoryShard) GroupByHash(hash []byte) (aggregate.Group, error)

Return a group based on its hash

func (*InMemoryShard) ID

func (g *InMemoryShard) ID() interface{}

func (*InMemoryShard) Return

func (g *InMemoryShard) Return() error

Return the shard to the store

type MutexBTree

type MutexBTree struct {
	Mutex sync.RWMutex
	Tree  *btree.BTree
}

type MutexConfigGroup

type MutexConfigGroup struct {
	Mutex sync.RWMutex
	Map   map[string]aggregate.Group
}

Jump to

Keyboard shortcuts

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