streaming

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package streaming provides functionality for streaming processing of templates.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type StreamConfig

type StreamConfig struct {
	// BufferSize is the size of the buffer for reading files
	BufferSize int
	// ChunkSize is the size of chunks for processing
	ChunkSize int
	// MaxConcurrent is the maximum number of concurrent operations
	MaxConcurrent int
	// TemporaryDir is the directory for temporary files
	TemporaryDir string
}

StreamConfig contains configuration for the stream processor

type StreamProcessor

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

StreamProcessor processes templates in a streaming fashion to minimize memory usage

func NewStreamProcessor

func NewStreamProcessor(config *StreamConfig) *StreamProcessor

NewStreamProcessor creates a new stream processor

func (*StreamProcessor) GetStats

func (p *StreamProcessor) GetStats() StreamStats

GetStats gets the processor statistics

func (*StreamProcessor) ProcessTemplateDirectory

func (p *StreamProcessor) ProcessTemplateDirectory(ctx context.Context, dirPath string, processor func(*format.Template) error) error

ProcessTemplateDirectory processes all template files in a directory

func (*StreamProcessor) ProcessTemplateFile

func (p *StreamProcessor) ProcessTemplateFile(ctx context.Context, filePath string, processor func(*format.Template) error) error

ProcessTemplateFile processes a template file in a streaming fashion

func (*StreamProcessor) ProcessTemplateStream

func (p *StreamProcessor) ProcessTemplateStream(ctx context.Context, reader io.Reader, processor func(*format.Template) error) error

ProcessTemplateStream processes a template stream

func (*StreamProcessor) ResetStats

func (p *StreamProcessor) ResetStats()

ResetStats resets the processor statistics

func (*StreamProcessor) StreamExecute

func (p *StreamProcessor) StreamExecute(ctx context.Context, template *format.Template, executor interfaces.TemplateExecutor, options map[string]interface{}, resultWriter io.Writer) error

StreamExecute executes a template in a streaming fashion

func (*StreamProcessor) StreamExecuteBatch

func (p *StreamProcessor) StreamExecuteBatch(ctx context.Context, templates []*format.Template, executor interfaces.TemplateExecutor, options map[string]interface{}, resultWriter io.Writer) error

StreamExecuteBatch executes multiple templates in a streaming fashion

type StreamStats

type StreamStats struct {
	// ProcessedBytes is the number of bytes processed
	ProcessedBytes int64
	// ProcessedTemplates is the number of templates processed
	ProcessedTemplates int64
	// ProcessingTime is the total time spent processing
	ProcessingTime time.Duration
	// PeakMemoryUsage is the peak memory usage in bytes
	PeakMemoryUsage int64
}

StreamStats tracks processor statistics

Jump to

Keyboard shortcuts

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