sessions

package
v0.49.3 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package sessions provides session management functionality for the tracking system.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBatchingSchemaLayout

func NewBatchingSchemaLayout(layout schema.Layout) schema.Layout

NewBatchingSchemaLayout creates a new layout that makes sure that all the rows from a single table will be written to the warehouse in a single call.

func NewBrokenFilteringSchemaLayout added in v0.19.0

func NewBrokenFilteringSchemaLayout(layout schema.Layout) schema.Layout

Types

type DirectCloser added in v0.13.0

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

func NewDirectCloser

func NewDirectCloser(writer SessionWriter, failureSleepDuration time.Duration) *DirectCloser

NewDirectCloser creates a new protosessions.Closer that writes the session directly to warehouse.Driver, without intermediate queue (suitable only for single-tenant setup)

func (*DirectCloser) Close added in v0.13.0

func (c *DirectCloser) Close(protosessions [][]*hits.Hit) error

Close implements protosessions.Closer

type InMemSpoolOption added in v0.49.1

type InMemSpoolOption func(*inMemSpoolWriter)

InMemSpoolOption configures an inMemSpoolWriter.

func WithMaxAge added in v0.49.1

func WithMaxAge(d time.Duration) InMemSpoolOption

WithMaxAge sets the maximum age a buffered session can have before a sweep flushes its property buffer.

func WithMaxBufferEvents added in v0.49.1

func WithMaxBufferEvents(n int) InMemSpoolOption

WithMaxBufferEvents sets the maximum total number of events (across all property buffers) that can be buffered before incoming sessions are discarded. Zero means unlimited. Default is 50000.

func WithMaxBufferedSessions added in v0.49.1

func WithMaxBufferedSessions(n int) InMemSpoolOption

WithMaxBufferedSessions sets the maximum total number of sessions (across all property buffers) that can be buffered before incoming sessions are discarded. Zero means unlimited. Default is 10000.

func WithMaxSessions added in v0.49.1

func WithMaxSessions(n int) InMemSpoolOption

WithMaxSessions sets the per-property session count that triggers a flush.

func WithSweepInterval added in v0.49.1

func WithSweepInterval(d time.Duration) InMemSpoolOption

WithSweepInterval sets how often the background loop checks for aged buffers.

func WithWriteChanBuffer added in v0.32.0

func WithWriteChanBuffer(n int) InMemSpoolOption

WithWriteChanBuffer sets the input channel capacity for incoming write requests.

type PersistentSpoolOption added in v0.49.1

type PersistentSpoolOption func(*persistentSpoolWriter)

PersistentSpoolOption configures a persistentSpoolWriter.

func WithEncoderDecoder added in v0.32.0

func WithEncoderDecoder(encoder encoding.EncoderFunc, decoder encoding.DecoderFunc) PersistentSpoolOption

WithEncoderDecoder sets the encoder and decoder functions.

type SessionWriter

type SessionWriter interface {
	Write(sessions ...*schema.Session) error
}

SessionWriter defines the interface for writing sessions

func NewInMemSpoolWriter added in v0.49.1

func NewInMemSpoolWriter(child SessionWriter, opts ...InMemSpoolOption) (SessionWriter, func(), error)

NewInMemSpoolWriter creates a SessionWriter decorator that accumulates *schema.Session objects per property in memory and flushes to child on count or age thresholds. Returns the writer, a cleanup function, and an error.

func NewNoopWriter added in v0.13.0

func NewNoopWriter() SessionWriter

NewNoopWriter creates a new NoopWriter

func NewPersistentSpoolWriter added in v0.49.1

func NewPersistentSpoolWriter(
	spoolFactory spools.Factory,
	child SessionWriter,
	opts ...PersistentSpoolOption,
) (SessionWriter, error)

NewPersistentSpoolWriter creates a SessionWriter decorator that encodes sessions and appends them to a Spool keyed by PropertyID.

func NewSessionWriter

func NewSessionWriter(
	parentCtx context.Context,
	whr warehouse.Registry,
	columnsRegistry schema.ColumnsRegistry,
	layouts schema.LayoutRegistry,
	splitterRegistry splitter.Registry,
	opts ...SessionWriterOption,
) SessionWriter

NewSessionWriter creates a new SessionWriter with the provided warehouse, column sources, and layout sources. It caches each entity (warehouse, columns, layout) for 5 minutes.

type SessionWriterOption added in v0.13.0

type SessionWriterOption func(*sessionWriterImpl)

SessionWriterOption configures the SessionWriter.

func WithCacheTTL added in v0.13.0

func WithCacheTTL(d time.Duration) SessionWriterOption

WithCacheTTL sets the TTL for cached registries.

func WithConcurrency added in v0.13.0

func WithConcurrency(n int) SessionWriterOption

WithConcurrency sets the concurrency limit for parallel writes.

func WithWriteTimeout added in v0.13.0

func WithWriteTimeout(d time.Duration) SessionWriterOption

WithWriteTimeout sets the timeout for individual write operations.

Jump to

Keyboard shortcuts

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