compression

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package compression provides the compression service interface. This service wraps the 31-layer filter pipeline for microservice deployment.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CompressRequest

type CompressRequest struct {
	Input       string      // Text to compress
	Mode        filter.Mode // Compression mode (none/minimal/aggressive)
	QueryIntent string      // Query intent for query-aware compression
	Budget      int         // Token budget (0 = unlimited)
	Preset      string      // Pipeline preset (fast/balanced/full)
}

CompressRequest is the input for compression.

type CompressResponse

type CompressResponse struct {
	Output         string   // Compressed text
	OriginalSize   int      // Original token count
	CompressedSize int      // Compressed token count
	SavingsPercent float64  // Token savings percentage
	LayersApplied  []string // List of layers that were applied
}

CompressResponse is the output from compression.

type CompressionService

type CompressionService interface {
	// Compress applies the 31-layer compression pipeline to input text.
	Compress(ctx context.Context, req *CompressRequest) (*CompressResponse, error)

	// GetStats returns compression statistics.
	GetStats(ctx context.Context) (*StatsResponse, error)

	// GetLayers returns information about all compression layers.
	GetLayers(ctx context.Context) ([]LayerInfo, error)
}

CompressionService defines the interface for the compression service.

type LayerInfo

type LayerInfo struct {
	Name        string // Layer name
	Number      int    // Layer number (1-31)
	Research    string // Research paper source
	Compression string // Typical compression ratio
}

LayerInfo describes a compression layer.

type Service

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

Service implements CompressionService using the filter pipeline.

func NewService

func NewService(cfg filter.PipelineConfig) *Service

NewService creates a new compression service.

func (*Service) Compress

func (s *Service) Compress(ctx context.Context, req *CompressRequest) (*CompressResponse, error)

Compress implements CompressionService.

func (*Service) GetLayers

func (s *Service) GetLayers(ctx context.Context) ([]LayerInfo, error)

GetLayers implements CompressionService.

func (*Service) GetStats

func (s *Service) GetStats(ctx context.Context) (*StatsResponse, error)

GetStats implements CompressionService. Note: Returns runtime metrics from Prometheus counters. For persistent historical stats, wire up to the tracking database via the analytics service.

type StatsResponse

type StatsResponse struct {
	TotalCompressions  int64
	TotalTokensSaved   int64
	AverageCompression float64
	P99LatencyMs       float64
}

StatsResponse contains compression statistics.

Directories

Path Synopsis
Package grpc provides gRPC server implementation for the compression service.
Package grpc provides gRPC server implementation for the compression service.

Jump to

Keyboard shortcuts

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