eventstore

package
v3.6.3 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	Timestamp   time.Time
	Description EventDescription `json:"description"`
}

type EventDescription

type EventDescription struct {
	Type    string                 `json:"type"`
	Details map[string]interface{} `json:"details"`
}

type EventStore

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

EventStore perists details for events which are to be sent to the Cacophony Events API.

func Open

func Open(fileName string) (*EventStore, error)

Open opens the event store. It should be closed later with the Close() method.

func (*EventStore) Add

func (s *EventStore) Add(event *Event) error

func (*EventStore) All

func (s *EventStore) All() ([]EventTimes, error)

All returns all the events stored in the event store as EventTimes instances. Events with identical details are grouped together into a single EventTimes instance.

func (*EventStore) Close

func (s *EventStore) Close()

Close releases resources used by the EventStore. It should be called once the EventStore is no longer required.

func (*EventStore) Delete

func (s *EventStore) Delete(key uint64) error

func (*EventStore) DeleteKeys

func (s *EventStore) DeleteKeys(keys []uint64) error

func (*EventStore) Discard

func (s *EventStore) Discard(ev EventTimes) error

Discard removes an event from from the store.

func (*EventStore) Get

func (s *EventStore) Get(key uint64) ([]byte, error)

func (*EventStore) GetKeys

func (s *EventStore) GetKeys() ([]uint64, error)

func (*EventStore) Queue

func (s *EventStore) Queue(details []byte, timestamp time.Time) error

Use Add for adding new events now. This is keept for testing migrations Queue recordings an event in the event store. The details provided uniquely identify the event, but the contents are opaque to the event store.

type EventTimes

type EventTimes struct {
	Details    []byte
	Timestamps []time.Time
}

EventTimes holds

Jump to

Keyboard shortcuts

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