Documentation
¶
Overview ¶
Package file is a durable store.Store: an append-only JSONL event log that replays into memory on open. Pure Go, zero dependencies — the single static binary stays single and static, and events survive restarts. The append log is the source of truth; queries are served from the in-memory index (same speed as the memory store). This is the smol, always-correct default for a single box; the columnar segment tier (internal/store/segment) sits behind the same interface for scale.
Index ¶
- type Store
- func (s *Store) Clear() error
- func (s *Store) Close() error
- func (s *Store) Count() int
- func (s *Store) DeleteUser(distinctID string) (int, error)
- func (s *Store) Ingest(events ...event.Event) error
- func (s *Store) Names() ([]string, error)
- func (s *Store) Prune(before time.Time) (int, error)
- func (s *Store) Range(from, to time.Time) ([]event.Event, error)
- func (s *Store) Scan(from, to time.Time, fn func(event.Event) error) error
- func (s *Store) SetMaxEvents(n int) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func Open ¶
Open replays the log at path (creating it and any parent dirs if absent) and returns a store ready to append. Corrupt trailing lines are skipped, not fatal.
func (*Store) DeleteUser ¶ added in v0.3.0
DeleteUser erases every event for one distinct_id (GDPR erasure), rewriting the log via the same atomic temp-file+rename path compaction uses.
func (*Store) Prune ¶
Prune drops events older than the cutoff and compacts the log. Runs under the write lock; O(n) but only on the retention schedule.
func (*Store) SetMaxEvents ¶ added in v0.2.0
SetMaxEvents bounds how many of the most-recent events stay resident (0 = unlimited). This is the guardrail that keeps a small instance alive under a flood of ingest instead of OOM-crashing it; it trims immediately if already over. Pair it with retention (RetainDays) to also bound the on-disk log.