Documentation
¶
Index ¶
- type AssetCounters
- type AssetRecord
- type AssetState
- type AssetTracker
- func (at *AssetTracker) DiscoverAndDiscard(file fshelper.FSAndName, fileSize int64, eventCode fileevent.Code, ...)
- func (at *AssetTracker) DiscoverAsset(file fshelper.FSAndName, fileSize int64, eventCode fileevent.Code)
- func (at *AssetTracker) GenerateDetailedReport(ctx context.Context) string
- func (at *AssetTracker) GenerateReport() string
- func (at *AssetTracker) GetAllAssets() []AssetRecord
- func (at *AssetTracker) GetCounters() AssetCounters
- func (at *AssetTracker) GetPending() []AssetRecord
- func (at *AssetTracker) IsComplete() bool
- func (at *AssetTracker) SetDiscarded(file fshelper.FSAndName, eventCode fileevent.Code, reason string)
- func (at *AssetTracker) SetError(file fshelper.FSAndName, eventCode fileevent.Code, err error)
- func (at *AssetTracker) SetProcessed(file fshelper.FSAndName, eventCode fileevent.Code)
- func (at *AssetTracker) Validate() error
- type EventRecord
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AssetCounters ¶
type AssetCounters struct {
// Asset counts (images/videos tracked through lifecycle)
Pending int64 // Assets not yet finalized
Processed int64 // Assets successfully handled
Discarded int64 // Assets skipped (immediate or during processing)
Errors int64 // Assets that failed
// Asset size tracking
AssetSize int64 // Total asset bytes (all states)
ProcessedSize int64 // Processed asset bytes
DiscardedSize int64 // Discarded asset bytes
ErrorSize int64 // Errored asset bytes
PendingSize int64 // Bytes pending
}
AssetCounters provides summary statistics for tracked assets
func (*AssetCounters) IsComplete ¶
func (ac *AssetCounters) IsComplete() bool
IsComplete returns true if all assets have reached a final state
func (*AssetCounters) Total ¶
func (ac *AssetCounters) Total() int64
Total returns the total number of assets tracked
type AssetRecord ¶
type AssetRecord struct {
File fshelper.FSAndName // File identity
FileSize int64 // File size in bytes
State AssetState // Current state
EventCode fileevent.Code // Most recent event code
Reason string // Why discarded/errored
EventHistory []EventRecord // Complete timeline (only in debug mode)
DiscoveredAt time.Time // When asset was discovered
FinalizedAt time.Time // When asset reached final state
}
AssetRecord tracks an individual asset through its lifecycle
type AssetState ¶
type AssetState int
AssetState represents the lifecycle state of an asset
const ( StatePending AssetState = iota // Asset found, entering pipeline StateProcessed // Asset successfully handled StateDiscarded // Asset rejected/skipped StateError // Asset failed to process )
func (AssetState) String ¶
func (s AssetState) String() string
String returns the string representation of the asset state
type AssetTracker ¶
type AssetTracker struct {
// contains filtered or unexported fields
}
AssetTracker tracks the complete lifecycle of assets (images/videos) from discovery through final state (processed/discarded/error). Non-asset files are ignored by this tracker.
func NewWithLogger ¶
func NewWithLogger(log *slog.Logger, debugMode bool) *AssetTracker
NewWithLogger creates a new AssetTracker with debug logging
func (*AssetTracker) DiscoverAndDiscard ¶
func (at *AssetTracker) DiscoverAndDiscard(file fshelper.FSAndName, fileSize int64, eventCode fileevent.Code, reason string)
DiscoverAndDiscard registers an asset that is immediately discarded (e.g., banned filename that's still an image type)
func (*AssetTracker) DiscoverAsset ¶
func (at *AssetTracker) DiscoverAsset(file fshelper.FSAndName, fileSize int64, eventCode fileevent.Code)
DiscoverAsset registers an asset (image/video) entering the pipeline
func (*AssetTracker) GenerateDetailedReport ¶
func (at *AssetTracker) GenerateDetailedReport(ctx context.Context) string
GenerateDetailedReport creates a detailed CSV report of all assets (debug mode)
func (*AssetTracker) GenerateReport ¶
func (at *AssetTracker) GenerateReport() string
GenerateReport creates a summary report of asset processing
func (*AssetTracker) GetAllAssets ¶
func (at *AssetTracker) GetAllAssets() []AssetRecord
GetAllAssets returns all tracked assets
func (*AssetTracker) GetCounters ¶
func (at *AssetTracker) GetCounters() AssetCounters
GetCounters returns current asset counters
func (*AssetTracker) GetPending ¶
func (at *AssetTracker) GetPending() []AssetRecord
GetPending returns all assets that haven't reached a final state
func (*AssetTracker) IsComplete ¶
func (at *AssetTracker) IsComplete() bool
IsComplete returns true if all assets have reached a final state
func (*AssetTracker) SetDiscarded ¶
func (at *AssetTracker) SetDiscarded(file fshelper.FSAndName, eventCode fileevent.Code, reason string)
SetDiscarded transitions an asset to the DISCARDED state
func (*AssetTracker) SetProcessed ¶
func (at *AssetTracker) SetProcessed(file fshelper.FSAndName, eventCode fileevent.Code)
SetProcessed transitions an asset to the PROCESSED state
func (*AssetTracker) Validate ¶
func (at *AssetTracker) Validate() error
Validate checks that all assets reached a final state