Orchestrator
provide.foundation.file.operations.detectors.orchestrator
¶
File operation detector orchestrator.
Coordinates detector functions via registry to identify the best match for file events.
Classes¶
OperationDetector
¶
OperationDetector(
config: DetectorConfig | None = None,
on_operation_complete: Any = None,
registry: Registry | None = None,
)
Detects and classifies file operations from events.
Initialize with optional configuration and callback.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
DetectorConfig | None
|
Detector configuration |
None
|
on_operation_complete
|
Any
|
Callback function(operation: FileOperation) called when an operation is detected. Used for streaming mode. |
None
|
registry
|
Registry | None
|
Optional registry for detectors (defaults to global) |
None
|
Source code in provide/foundation/file/operations/detectors/orchestrator.py
Functions¶
add_event
¶
Add event with auto-flush and callback support.
This is the recommended method for streaming detection with automatic temp file hiding and callback-based operation reporting.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
FileEvent
|
File event to process |
required |
Behavior
- Hides temp files automatically (no callback until operation completes)
- Schedules auto-flush timer for pending operations
- Calls on_operation_complete(operation) when pattern detected
- Emits non-temp files immediately if no operation pattern found
Source code in provide/foundation/file/operations/detectors/orchestrator.py
detect
¶
Detect all operations from a list of events.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
events
|
list[FileEvent]
|
List of file events to analyze |
required |
Returns:
| Type | Description |
|---|---|
list[FileOperation]
|
List of detected operations, ordered by start time |
Source code in provide/foundation/file/operations/detectors/orchestrator.py
detect_streaming
¶
Process events in streaming fashion.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
FileEvent
|
Single file event |
required |
Returns:
| Type | Description |
|---|---|
FileOperation | None
|
Completed operation if detected, None otherwise |
Source code in provide/foundation/file/operations/detectors/orchestrator.py
flush
¶
Get any pending operations and clear buffer.