events

package
v0.12.6 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	EventSegment     = Segment{0xdf, 0xb7}
	MetaEventSegment = Segment{0xd6, 0x8d}
	IndashSegment    = Segment{0xca, 0xac}
)

Segments in use by the Ensign event store

Functions

This section is empty.

Types

type EventErrorIterator added in v0.9.0

type EventErrorIterator struct {
	errors.ErrorIterator
}

Implements iterator.EventIterator to return an error.

func (*EventErrorIterator) Event added in v0.9.0

func (i *EventErrorIterator) Event() (*api.EventWrapper, error)

func (*EventErrorIterator) Seek added in v0.9.0

func (i *EventErrorIterator) Seek(eventID rlid.RLID) bool

type EventIterator added in v0.9.0

type EventIterator struct {
	ldbiter.Iterator
	// contains filtered or unexported fields
}

Implements iterator.EventIterator to access to a sequence of events in a topic.

func (*EventIterator) Error added in v0.9.0

func (i *EventIterator) Error() error

func (*EventIterator) Event added in v0.9.0

func (i *EventIterator) Event() (*api.EventWrapper, error)

func (*EventIterator) Seek added in v0.9.0

func (t *EventIterator) Seek(eventID rlid.RLID) bool

type IndashErrorIterator added in v0.11.0

type IndashErrorIterator struct {
	errors.ErrorIterator
}

Implements iterator.IndashIterator to return an error.

func (*IndashErrorIterator) Hash added in v0.11.0

func (i *IndashErrorIterator) Hash() ([]byte, error)

type IndashIterator added in v0.11.0

type IndashIterator struct {
	ldbiter.Iterator
}

Implements iterator.IndashIterator to access a sequence of hashes for a topic.

func (*IndashIterator) Error added in v0.11.0

func (i *IndashIterator) Error() error

Error wraps an internal leveldb error so that ensign users can test against it.

func (*IndashIterator) Hash added in v0.11.0

func (i *IndashIterator) Hash() ([]byte, error)

Hash returns the key with the prefixed topic and segment stripped. If the key is not the right length then an error is returned but no other parsing happens.

type Key added in v0.9.0

type Key [28]byte

Key is is the 16 byte topic ID followed by a 2 byte segment that splits events from meta events then the 10 byte RLID for an event ID.

func CreateKey added in v0.9.0

func CreateKey(topicID ulid.ULID, eventID rlid.RLID, segment Segment) (key Key, err error)

func EventKey added in v0.9.0

func EventKey(event *api.EventWrapper) (key Key, err error)

func MetaEventKey added in v0.9.0

func MetaEventKey(event *api.EventWrapper) (key Key, err error)

func (*Key) EventID added in v0.9.0

func (k *Key) EventID() (eventID rlid.RLID)

EventID parses and returns the eventID RLID from the key.

func (*Key) Segment added in v0.9.0

func (k *Key) Segment() Segment

func (*Key) TopicID added in v0.9.0

func (k *Key) TopicID() (topicID ulid.ULID)

TopicID parses and returns the topicID ULID from the key.

type Segment added in v0.9.0

type Segment [2]byte

Segments ensure that a topic's events and meta events are stored contiguously.

func (Segment) String added in v0.9.0

func (s Segment) String() string

type Store

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

func Open

func Open(conf config.StorageConfig) (store *Store, err error)

func (*Store) ClearIndash added in v0.12.0

func (s *Store) ClearIndash(topicID ulid.ULID) error

ClearIndash deletes all of the index hashes for the the specified topic.

func (*Store) Close

func (s *Store) Close() error

func (*Store) Count added in v0.9.0

func (s *Store) Count(slice *util.Range) (count uint64, err error)

Count the number of objects that match the specified range by iterating through all of the keys and counting them. This is primarily used for testing.

func (*Store) Destroy added in v0.12.0

func (s *Store) Destroy(topicID ulid.ULID) (err error)

Destroy all events, meta-events, and index hashes of the specified topic. NOTE: this will destroy anything in the database that is prefixed with the topicID.

func (*Store) Indash added in v0.11.0

func (s *Store) Indash(topicID ulid.ULID, hash []byte, eventID rlid.RLID) (err error)

Indash stores an index hash of an event for duplicate detection purposes. In the underlying database, the indash key is the topicID + indashSegment + hash and the value is the eventID. Primarily the hashes are used to construct bloom filters for online duplicate detection, but the hash can also be used to lookup the event that represents the duplicate for equality comparison.

func (*Store) Insert added in v0.9.0

func (s *Store) Insert(event *api.EventWrapper) (err error)

Insert an event with the event segment into the database. If the event doesn't have an ID or a TopicID, an error is returned. This method also ensures that the localID is not stored and is nil. No other validation is performed by the database as this method is designed to write as quickly as possible.

func (*Store) List added in v0.9.0

func (s *Store) List(topicID ulid.ULID) iterator.EventIterator

Returns an iterator of events in the specified topic. If an offset RLID is specified

func (*Store) LoadIndash added in v0.11.0

func (s *Store) LoadIndash(topicID ulid.ULID) iterator.IndashIterator

LoadIndash returns an iterator that exposes all hashes in the database for the specified topicID. The iterator will strip off the topicID and segment from the key to return the Hash value.

func (*Store) ReadOnly

func (s *Store) ReadOnly() bool

func (*Store) Retrieve added in v0.9.0

func (s *Store) Retrieve(topicId ulid.ULID, eventID rlid.RLID) (event *api.EventWrapper, err error)

Retrieve a specific event from the database by topic and eventID.

func (*Store) Unhash added in v0.12.0

func (s *Store) Unhash(topicID ulid.ULID, hash []byte) (_ *api.EventWrapper, err error)

Unhash returns the event for the specified index hash (e.g. retrieving the original value from the hash using the event ID has as intermediate lookup).

Jump to

Keyboard shortcuts

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