DriveManager class

Orchestrates OmnyDrive mounts over OmnyShell drive sessions.

The client is the active side of a mount: it runs OmnyDrive's directory synchronizer (for dir mounts) against a ChannelContentSource that reaches the node, or issues git RPCs the node executes (for git mounts). Mount state is persisted in a MountStore; the Hub and Node need no mount registry.

Constructors

DriveManager(ClientRuntime client, MountStore store)
Creates a manager over client and store.

Properties

client ClientRuntime
The connected, authenticated client.
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
store MountStore
The persisted mount registry.
final

Methods

conflicts(String mountId, {bool includeDiffs = false}) Future<DriveChanges>
Lists every path that differs between the local copy and the node for a directory mount, grouped by which side changed — true conflicts (both sides), local-only changes (a sync would push), and remote-only changes (a sync would pull). Read-only: it performs no sync, resolve, or state change.
diffFile(String mountId, String path) Future<FileDiff>
Compares one path on a directory mount's local copy against the node.
findReusableDirMount({required String nodeId, required String localDir, String? remotePath, PathFilter? filter}) MountRecord?
Finds a directory mount that run/exec --mount can reuse for localDir on nodeId, or null if none.
get(String id) MountRecord?
The mount with id, or null.
list() List<MountRecord>
All known mounts, ordered by id.
mountDirectory({required String localDir, required String nodeId, required String remotePath, String? name, bool readWrite = false, bool initialSync = true, bool ephemeral = false, PathFilter? filter, DriveProgress? onProgress}) Future<MountRecord>
Mounts a local directory onto remotePath of nodeId.
mountGit({required String url, required String nodeId, required String remotePath, String? name, String? branch, int? depth, bool readWrite = false, DriveProgress? onProgress}) Future<MountRecord>
Mounts a git repository onto remotePath of nodeId. The node clones the repo, so url must be reachable from the node.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pushLocalMirror(String mountId, {DriveProgress? onProgress}) Future<SyncOutcome>
First sync of a reused directory mount: pushes the local copy up so the node mirrors it exactly, reusing files already present on the node. Unlike the two-way sync, this is authoritative local→remote — it never pulls, modifies, or deletes anything in the local directory, and never raises a conflict (see _pushLocalAuthoritative).
remount(String mountId, {DriveProgress? onProgress}) Future<MountRecord>
Re-establishes mountId after a node restart or fresh CLI run: git mounts re-clone (the node reuses an existing checkout), directory mounts re-anchor on the node and push the local copy back up.
require(String id) MountRecord
Looks up id or throws a DriveException.
resolve(String mountId, {required String strategy, DriveProgress? onProgress}) Future<SyncOutcome>
Resolves a conflict on mountId. strategy is accept-local, accept-origin, or reclone.
resolveFile(String mountId, String path, {required String strategy, DriveProgress? onProgress}) Future<FileResolveOutcome>
Resolves a single path on a directory mount by copying its bytes one way: accept-local overwrites the node, accept-origin overwrites the local copy. When the path is absent on the accepted side the other side is removed. If the file was the mount's last divergence the mount is re-anchored clean; otherwise its conflicted state is left untouched.
sync(String mountId, {SyncDirection? direction, DriveProgress? onProgress}) Future<SyncOutcome>
Synchronizes mountId. With no direction, picks one automatically: read-only mounts always push; read-write mounts push, pull or no-op based on which side changed. When both sides changed, non-overlapping edits are auto-merged (local-only edits pushed, remote-only edits pulled) and only a path edited on both sides surfaces a conflict.
toString() String
A string representation of this object.
inherited
unmount(String mountId, {bool syncFirst = false, bool keepRemote = true}) Future<void>
Unmounts mountId. With syncFirst, runs a final sync; with keepRemote false, deletes the mount's files on the node (dir mounts only).
watch(String mountId, {Duration interval = const Duration(seconds: 15), Duration debounce = const Duration(milliseconds: 500), void log(String message)?, DriveProgress? onProgress, Future<void>? until}) Future<void>
Watches mountId and auto-syncs on local changes and on an interval poll. Runs until until completes; when omitted it runs until the returned future is never completed (the caller cancels via process signal). Directory mounts also react to filesystem events.

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

open(ClientRuntime client, {String? home}) Future<DriveManager>
Loads the mount store and returns a manager bound to client. home overrides the state directory (tests use an isolated one).