fileprocessor

package
v0.30.0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2025 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileProcessor

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

FileProcessor coordinates AssetTracker and EventLogger to provide a unified interface for tracking file processing lifecycle.

func New

New creates a new FileProcessor with the given tracker and logger

func (*FileProcessor) Finalize

func (fp *FileProcessor) Finalize(ctx context.Context) error

Finalize validates that all assets have reached a final state. Returns an error if any assets are still pending.

func (*FileProcessor) GenerateDetailedReport

func (fp *FileProcessor) GenerateDetailedReport(ctx context.Context) string

GenerateDetailedReport creates a detailed CSV report of all assets (debug mode)

func (*FileProcessor) GenerateReport

func (fp *FileProcessor) GenerateReport() string

GenerateReport generates a comprehensive report combining asset tracking and event logging information.

func (*FileProcessor) GetAssetCounters

func (fp *FileProcessor) GetAssetCounters() assettracker.AssetCounters

GetAssetCounters returns current asset counters from the tracker

func (*FileProcessor) GetEventCounts

func (fp *FileProcessor) GetEventCounts() map[fileevent.Code]int64

GetEventCounts returns event counts from the logger

func (*FileProcessor) GetEventSizes

func (fp *FileProcessor) GetEventSizes() map[fileevent.Code]int64

GetEventSizes returns event sizes from the logger

func (*FileProcessor) GetPendingAssets

func (fp *FileProcessor) GetPendingAssets() []assettracker.AssetRecord

GetPendingAssets returns all assets that haven't reached a final state

func (*FileProcessor) IsComplete

func (fp *FileProcessor) IsComplete() bool

IsComplete returns true if all assets have reached a final state

func (*FileProcessor) Logger

func (fp *FileProcessor) Logger() *fileevent.Recorder

Logger returns the underlying EventLogger

func (*FileProcessor) RecordAssetDiscarded

func (fp *FileProcessor) RecordAssetDiscarded(ctx context.Context, file fshelper.FSAndName, code fileevent.Code, reason string)

RecordAssetDiscarded transitions an asset to DISCARDED state. The state change is tracked and the event is logged with the reason.

func (*FileProcessor) RecordAssetDiscardedImmediately

func (fp *FileProcessor) RecordAssetDiscardedImmediately(ctx context.Context, file fshelper.FSAndName, size int64, code fileevent.Code, reason string)

RecordAssetDiscardedImmediately records an asset that is immediately discarded upon discovery (e.g., banned filename that's still an image type). The asset is tracked in DISCARDED state and the event is logged.

func (*FileProcessor) RecordAssetDiscovered

func (fp *FileProcessor) RecordAssetDiscovered(ctx context.Context, file fshelper.FSAndName, size int64, code fileevent.Code)

RecordAssetDiscovered records an asset (image/video) entering the pipeline. The asset is tracked and the discovery event is logged.

func (*FileProcessor) RecordAssetError

func (fp *FileProcessor) RecordAssetError(ctx context.Context, file fshelper.FSAndName, code fileevent.Code, err error)

RecordAssetError transitions an asset to ERROR state. The state change is tracked and the error event is logged.

func (*FileProcessor) RecordAssetProcessed

func (fp *FileProcessor) RecordAssetProcessed(ctx context.Context, file fshelper.FSAndName, code fileevent.Code)

RecordAssetProcessed transitions an asset to PROCESSED state. The state change is tracked and the event is logged.

func (*FileProcessor) RecordNonAsset

func (fp *FileProcessor) RecordNonAsset(ctx context.Context, file fshelper.FSAndName, size int64, code fileevent.Code, args ...any)

RecordNonAsset records a non-asset file (sidecar, metadata, etc.). Only logged, not tracked in AssetTracker.

func (*FileProcessor) Summary

func (fp *FileProcessor) Summary() string

Summary provides a quick overview of processing status

func (*FileProcessor) Tracker

func (fp *FileProcessor) Tracker() *assettracker.AssetTracker

Tracker returns the underlying AssetTracker

Jump to

Keyboard shortcuts

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