MFSManager class
Manages the Mutable File System (MFS) for an IPFS node.
Every mutation writes its blocks to the block store and persists the new
root CID to the datastore (write-through). flush/sync therefore act as
barriers that wait for in-flight mutations and re-persist the root — which
is also what Kubo's ipfs files flush does when the MFS write buffer is
drained.
Constructors
- MFSManager(IBlockStore _blockStore, Datastore _datastore, {DenylistService? denylistService})
-
Creates a new MFSManager with the given
blockStoreanddatastore.
Properties
Methods
-
chcid(
String path, {int? cidVersion, String? hash}) → Future< void> -
Changes the CID version/hash function of the node at
path. -
chmod(
String path, int mode) → Future< void> -
Sets the POSIX mode on the node at
path(files chmod). -
cp(
String src, String dst, {bool force = false, bool parents = false}) → Future< void> -
Copies a file or directory from
srctodst. -
flush(
{String? path}) → Future< CID> -
Flushes pending mutations for
path(or the whole MFS when null or/) and returns the CID of the flushed path. -
flushAll(
) → Future< CID> - Flushes the entire MFS and returns the root CID.
-
init(
) → Future< void> - Initializes the MFS by loading the root CID from the datastore or creating an empty root directory if it doesn't exist.
-
ls(
String path, {bool long = false, bool u = false}) → Future< List< MFSListEntry> > -
Lists the contents of the directory at the given
path. -
mkdir(
String path, {bool recursive = false, bool parents = false, int? cidVersion, String? hash, int? mode, int? mtimeSecs, int? mtimeNsecs}) → Future< void> -
Creates a directory at the given
path. -
mtime(
String path, {int? mtimeSecs, int? mtimeNsecs}) → Future< void> -
Alias for touch — sets the mtime of the node at
path. -
mv(
String src, String dst) → Future< void> -
Moves a file or directory from
srctodst. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
read(
String path, {int? offset, int? count}) → Future< Stream< List< >int> > -
Reads data from a file at the given
path, optionally starting atoffsetand limiting tocountbytes. -
rm(
String path, {bool recursive = false, bool force = false}) → Future< void> -
Removes a file or directory at the given
path. -
start(
) → Future< void> - Starts the service.
-
stat(
String path, {bool withLocal = false, String? cidBase}) → Future< MFSStat> -
Gets Kubo-compatible information about a file or directory at
path. -
stop(
) → Future< void> - Stops the service.
-
sync(
) → Future< void> - Waits for in-flight operations to complete and ensures the root CID is persisted.
-
toString(
) → String -
A string representation of this object.
inherited
-
touch(
String path, {int? mtimeSecs, int? mtimeNsecs}) → Future< void> -
Sets the modification time on the node at
path(files touch). -
unawaited(
Future< void> future) → void - Silences the unawaited future analyzer warning without actually awaiting.
-
write(
String path, Stream< List< data, {bool create = false, int? offset, bool truncate = false, int? count, bool parents = false, int? cidVersion, bool? rawLeaves, String? hash, int? mode, int? mtimeSecs, int? mtimeNsecs}) → Future<int> >void> -
Writes
datato a file at the givenpath.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited