spool

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultMaxFiles = 5
	DefaultMaxAge   = 1 * time.Hour
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Spool

type Spool struct {
	Dir      string
	MaxFiles int
	MaxAge   time.Duration
}

Spool manages temporary Arrow IPC files for a session.

func NewSpool

func NewSpool(sessionID string) (*Spool, error)

NewSpool creates a new result spool for the given session.

func (*Spool) Cleanup

func (s *Spool) Cleanup() error

Cleanup removes files exceeding the max count and max age limits.

func (*Spool) Destroy

func (s *Spool) Destroy() error

Destroy removes the entire spool directory.

func (*Spool) NewStreamWriter added in v0.1.1

func (s *Spool) NewStreamWriter(queryID string) (*StreamWriter, error)

NewStreamWriter creates a streaming IPC writer for the given query. Schema is taken from the first Write call.

func (*Spool) OpenReader added in v0.1.1

func (s *Spool) OpenReader(queryID string) (*ipc.Reader, io.Closer, error)

OpenReader opens a streaming IPC reader for the given query.

func (*Spool) Path

func (s *Spool) Path(queryID string) string

Path returns the Arrow IPC file path for a given query ID. Uses filepath.Base to prevent path traversal attacks.

func (*Spool) Remove added in v0.1.2

func (s *Spool) Remove(queryID string) error

Remove deletes a single spool file by query ID.

type StreamWriter added in v0.1.1

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

StreamWriter writes Arrow record batches to an IPC streaming file. Batches are flushed to disk immediately — no accumulation in memory.

func (*StreamWriter) Close added in v0.1.1

func (sw *StreamWriter) Close() error

Close flushes and closes the IPC stream and underlying file.

func (*StreamWriter) Write added in v0.1.1

func (sw *StreamWriter) Write(rec arrow.Record) error

Write writes a single record batch to the IPC stream.

Jump to

Keyboard shortcuts

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