Documentation
¶
Index ¶
- Constants
- type Broadcast
- type Manager
- func (m *Manager) Abort(id uuid.UUID) bool
- func (m *Manager) Add(op Operation) (uuid.UUID, context.CancelFunc)
- func (m *Manager) Complete(id uuid.UUID) bool
- func (m *Manager) Context(id uuid.UUID) (context.Context, bool)
- func (m *Manager) Fail(id uuid.UUID, message string) bool
- func (m *Manager) Get(id uuid.UUID) (Operation, bool)
- func (m *Manager) List() map[uuid.UUID]Operation
- type Operation
Constants ¶
const ( ProgressEvent = "operation progress" CompletedEvent = "operation completed" ErrorEvent = "operation error" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager tracks asynchronous operations for one server.
func (*Manager) Complete ¶
Complete emits final progress and completion, then removes the operation.
type Operation ¶
type Operation struct {
Type string `json:"type"`
Path string `json:"path,omitempty"`
DestinationPath string `json:"destination_path,omitempty"`
StartTime time.Time `json:"start_time"`
BytesProcessed *atomic.Uint64 `json:"-"`
BytesTotal *atomic.Uint64 `json:"-"`
FilesProcessed *atomic.Uint64 `json:"-"`
}
Operation describes a long-running filesystem operation.
func (Operation) MarshalJSON ¶
MarshalJSON snapshots atomic counters as ordinary JSON numbers.