spool

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2025 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Decoder

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

Decoder handles decoding Santa protobuf spool files (primary) with an optional JSON fallback used for development and testing fixtures.

func NewDecoder

func NewDecoder() *Decoder

NewDecoder creates a new decoder with default limits.

func (*Decoder) DecodeEvents

func (d *Decoder) DecodeEvents(path string) ([]*santapb.SantaMessage, error)

DecodeEvents decodes multiple Santa events from a spool file.

func (*Decoder) DecodeEventsContext

func (d *Decoder) DecodeEventsContext(ctx context.Context, path string) ([]*santapb.SantaMessage, error)

DecodeEventsContext decodes multiple Santa events with context support.

func (*Decoder) WithLimits

func (d *Decoder) WithLimits(maxFileSize, maxDecompressedSize int64, maxRate int) *Decoder

WithLimits creates a decoder with custom size limits.

type Watcher

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

Watcher monitors the Santa spool directory for new files

func NewWatcher

func NewWatcher(spoolDir string, stabilityWait time.Duration) (*Watcher, error)

NewWatcher creates a new spool directory watcher with default settings

func NewWatcherWithOptions

func NewWatcherWithOptions(spoolDir string, stabilityWait time.Duration, opts WatcherOptions) (*Watcher, error)

NewWatcherWithOptions creates a new spool directory watcher with custom options

func (*Watcher) ArchiveFile

func (w *Watcher) ArchiveFile(path string) error

ArchiveFile moves or deletes a processed file

func (*Watcher) Close

func (w *Watcher) Close() error

Close stops the watcher and releases resources

func (*Watcher) Events

func (w *Watcher) Events() <-chan string

Events returns the channel of file paths ready for processing

func (*Watcher) Start

func (w *Watcher) Start(ctx context.Context) error

Start begins watching for new files

type WatcherOptions

type WatcherOptions struct {
	ArchiveDir      string        // Directory to move processed files (empty = delete)
	CheckInterval   time.Duration // How often to check file stability (default: 1s)
	MaxPendingFiles int           // Maximum files waiting for stability (default: 1000)
	ChannelBuffer   int           // Size of event channel buffer (default: 100)
}

WatcherOptions contains optional configuration for the watcher

Jump to

Keyboard shortcuts

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