eventlog

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 22, 2026 License: Apache-2.0 Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package eventlog persists session-scoped envelopes for resume and subscription replay. The default implementation is in-memory ring per session.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	SessionID string
	EventSeq  uint64
	JobID     string
	StoredAt  time.Time
	Envelope  arcp.Envelope
}

Entry is one persisted envelope.

type Log

type Log interface {
	Append(e Entry) error
	Since(sessionID string, fromSeq uint64) ([]Entry, error)
	SinceJob(jobID string, fromSeq uint64) ([]Entry, error)
	Trim(sessionID string, beforeSeq uint64) error
}

Log is the event-log interface.

type Memory

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

Memory is a per-session in-memory event log with a fixed retention window. It is not durable; for production deployments wire a persistent Log against your own store.

func NewMemory

func NewMemory(maxPerSession int) *Memory

NewMemory returns a Memory log retaining at most maxPerSession entries per session (the oldest are dropped past the limit).

func (*Memory) Append

func (m *Memory) Append(e Entry) error

Append stores e indexed by session id.

func (*Memory) Since

func (m *Memory) Since(sessionID string, fromSeq uint64) ([]Entry, error)

Since returns entries for sessionID whose EventSeq > fromSeq.

func (*Memory) SinceJob

func (m *Memory) SinceJob(jobID string, fromSeq uint64) ([]Entry, error)

SinceJob returns entries for jobID whose EventSeq > fromSeq across all sessions.

func (*Memory) Trim

func (m *Memory) Trim(sessionID string, beforeSeq uint64) error

Trim drops entries for sessionID whose EventSeq <= beforeSeq.

Jump to

Keyboard shortcuts

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