Documentation
¶
Index ¶
- Constants
- Variables
- func BlobView(tx *bolt.Tx, key string) []byte
- func CBORMarshal(v any) ([]byte, error)
- func CBORUnmarshal(data []byte, v any) error
- func RestoreDatabase(ctx context.Context, dbFile string, r io.Reader) error
- func VersionFromFS(fsys fs.FS) string
- type Event
- type KType
- type Physalis
- type Reducer
- type ReducerReader
- type ReducerRegistry
- type ReducerRuntime
- type SortedKV
- type SortedKVView
- type Transaction
Constants ¶
View Source
const GlobalGroup = "."
View Source
const SkipEvent = ""
Variables ¶
View Source
var ErrReducerAlreadyExists = errors.New("reducer already exists")
Functions ¶
func CBORMarshal ¶
func CBORUnmarshal ¶
func RestoreDatabase ¶
func VersionFromFS ¶
VersionFromFS returns a deterministic "version" string for the contents of the provided filesystem (fs.FS). The version is derived from every file's bytes together with its relative path, so any change to file contents or to the set of files (add/remove/rename) results in a different version.
Intended for use with embed.FS, but works with any fs.FS.
On any traversal or read error, the function panics.
Types ¶
type Event ¶
func (*Event[EV]) ReadTimestamp ¶
type Physalis ¶
type Physalis[EV any] struct { // contains filtered or unexported fields }
func (*Physalis[EV]) Write ¶
func (phs *Physalis[EV]) Write(transaction Transaction[EV]) error
type Reducer ¶
type Reducer[ST any, EV any] interface { Version() string // Возвращает // 1. ключ группы событий, если он пустой то событие пропускается (SkipEvent) // 2. опционально может вернуть другое событие, которое будет использовано вместо текущего. Менять исходное нельзя! Оно шариться между всеми редюссерами! Prepare(*Event[EV]) (string, *Event[EV]) Apply(runtime *ReducerRuntime, state *ST, groupKey string, evs iter.Seq2[uint64, *Event[EV]]) *ST }
type ReducerReader ¶
type ReducerReader[ST any] struct { // contains filtered or unexported fields }
func AddReducer ¶
func AddReducer[ST any, EV any]( reg *ReducerRegistry[EV], name string, reducer Reducer[ST, EV], ) (*ReducerReader[ST], error)
func (*ReducerReader[ST]) AllStates ¶
func (rr *ReducerReader[ST]) AllStates(tx *bolt.Tx) SortedKVView[string, ST]
type ReducerRegistry ¶
type ReducerRegistry[EV any] struct { // contains filtered or unexported fields }
func NewReducerRegistry ¶
func NewReducerRegistry[EV any]() *ReducerRegistry[EV]
type ReducerRuntime ¶
type ReducerRuntime struct {
// contains filtered or unexported fields
}
type SortedKV ¶
type SortedKV[K KType, V any] interface { Get(key K) *V Delete(key K) Put(key K, data *V) AscendRange(greaterOrEqual, lessThan K) iter.Seq2[K, *V] Ascend() iter.Seq2[K, *V] Descend() iter.Seq2[K, *V] AscendGreaterOrEqual(greaterOrEqual K) iter.Seq2[K, *V] AscendLessThan(lessThan K) iter.Seq2[K, *V] DescendRange(lessOrEqual, greaterThan K) iter.Seq2[K, *V] DescendGreaterThan(greaterThan K) iter.Seq2[K, *V] DescendLessOrEqual(lessOrEqual K) iter.Seq2[K, *V] }
type SortedKVView ¶
type SortedKVView[K KType, V any] interface { Get(key K) *V AscendRange(greaterOrEqual, lessThan K) iter.Seq2[K, *V] Ascend() iter.Seq2[K, *V] Descend() iter.Seq2[K, *V] AscendGreaterOrEqual(greaterOrEqual K) iter.Seq2[K, *V] AscendLessThan(lessThan K) iter.Seq2[K, *V] DescendRange(lessOrEqual, greaterThan K) iter.Seq2[K, *V] DescendGreaterThan(greaterThan K) iter.Seq2[K, *V] DescendLessOrEqual(lessOrEqual K) iter.Seq2[K, *V] }
func OpenKVView ¶
func OpenKVView[K KType, V any, ST any]( reader *ReducerReader[ST], tx *bolt.Tx, groupKey string, kvName string, ) SortedKVView[K, V]
Source Files
¶
Click to show internal directories.
Click to hide internal directories.