Documentation ¶
Index ¶
- Variables
- type EventErrorIterator
- type EventIterator
- type IndashErrorIterator
- type IndashIterator
- type Key
- type Segment
- type Store
- func (s *Store) ClearIndash(topicID ulid.ULID) error
- func (s *Store) Close() error
- func (s *Store) Count(slice *util.Range) (count uint64, err error)
- func (s *Store) Destroy(topicID ulid.ULID) (err error)
- func (s *Store) Indash(topicID ulid.ULID, hash []byte, eventID rlid.RLID) (err error)
- func (s *Store) Insert(event *api.EventWrapper) (err error)
- func (s *Store) List(topicID ulid.ULID) iterator.EventIterator
- func (s *Store) LoadIndash(topicID ulid.ULID) iterator.IndashIterator
- func (s *Store) ReadOnly() bool
- func (s *Store) Retrieve(topicId ulid.ULID, eventID rlid.RLID) (event *api.EventWrapper, err error)
- func (s *Store) Unhash(topicID ulid.ULID, hash []byte) (_ *api.EventWrapper, err error)
Constants ¶
This section is empty.
Variables ¶
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)
type EventIterator ¶ added in v0.9.0
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)
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
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 MetaEventKey ¶ added in v0.9.0
func MetaEventKey(event *api.EventWrapper) (key Key, err error)
type Segment ¶ added in v0.9.0
type Segment [2]byte
Segments ensure that a topic's events and meta events are stored contiguously.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) ClearIndash ¶ added in v0.12.0
ClearIndash deletes all of the index hashes for the the specified topic.
func (*Store) Count ¶ added in v0.9.0
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
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
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.