Documentation
¶
Overview ¶
Package sessions provides session management functionality for the tracking system.
Index ¶
- func NewBatchingSchemaLayout(layout schema.Layout) schema.Layout
- func NewBrokenFilteringSchemaLayout(layout schema.Layout) schema.Layout
- type DirectCloser
- type Option
- func WithEncoderDecoder(encoder encoding.EncoderFunc, decoder encoding.DecoderFunc) Option
- func WithLvl1MaxAge(d time.Duration) Option
- func WithLvl1MaxSessions(n int) Option
- func WithLvl1SweepInterval(d time.Duration) Option
- func WithLvl2FlushInterval(d time.Duration) Option
- func WithMaxConsecutiveChildWriteFailures(n int) Option
- func WithSpoolDir(dir string) Option
- func WithWriteChanBuffer(n int) Option
- type SessionWriter
- type SessionWriterOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewBatchingSchemaLayout ¶
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.
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)
type Option ¶ added in v0.32.0
type Option func(*config)
Option is a functional option for configuring the writer.
func WithEncoderDecoder ¶ added in v0.32.0
func WithEncoderDecoder(encoder encoding.EncoderFunc, decoder encoding.DecoderFunc) Option
WithEncoderDecoder sets the encoder and decoder functions.
func WithLvl1MaxAge ¶ added in v0.32.0
WithLvl1MaxAge sets the maximum age for lvl1 buffers.
func WithLvl1MaxSessions ¶ added in v0.32.0
WithLvl1MaxSessions sets the maximum number of sessions in lvl1 buffer.
func WithLvl1SweepInterval ¶ added in v0.32.0
WithLvl1SweepInterval sets the sweep interval for lvl1 buffers.
func WithLvl2FlushInterval ¶ added in v0.32.0
WithLvl2FlushInterval sets the flush interval for lvl2 to child writer.
func WithMaxConsecutiveChildWriteFailures ¶ added in v0.32.0
WithMaxConsecutiveChildWriteFailures sets the maximum number of consecutive child writer failures before a spool file is discarded.
func WithSpoolDir ¶ added in v0.32.0
WithSpoolDir sets the directory for lvl2 spool files.
func WithWriteChanBuffer ¶ added in v0.32.0
WithWriteChanBuffer sets the capacity of the channel used for incoming Write calls. Larger values reduce blocking of callers when the actor is busy (e.g. during L2 flush) at the cost of more in-memory sessions on process crash. Zero means unbuffered. Default is 1000.
type SessionWriter ¶
SessionWriter defines the interface for writing sessions
func NewBackgroundBatchingWriter ¶ added in v0.32.0
func NewBackgroundBatchingWriter( ctx context.Context, childWriter SessionWriter, opts ...Option, ) (SessionWriter, func(), error)
NewBackgroundBatchingWriter creates a writer that uses spool file to queue the writes. Returns the writer, a cleanup function (to be deferred), and an error.
func NewNoopWriter ¶ added in v0.13.0
func NewNoopWriter() SessionWriter
NewNoopWriter creates a new NoopWriter
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.