modulepackage
0.0.0-20220907104234-6b37e0a35e3b
Repository: https://github.com/functionland/go-mfs.git
Documentation: pkg.go.dev
# README
go-mfs
go-mfs implements an in-memory model of a mutable IPFS filesystem.
Lead Maintainer
Table of Contents
Install
go-mfs
works like a regular Go module:
> go get github.com/ipfs/go-mfs
It uses Gx to manage dependencies. You can use make all
to build it with the gx
dependencies.
Usage
import "github.com/ipfs/go-mfs"
Check the GoDoc documentation
Documentation
Documentation around the MFS and the Files API in general around IPFS is a work in progress the following links may be of use:
Repository Structure
This repository contains many files, all belonging to the root mfs
package.
file.go
: MFSFile
.dir.go
: MFSDirectory
.fd.go
:FileDescriptor
used to operate onFile
s.ops.go
: Functions that do not belong to eitherFile
norDirectory
(although they mostly operate on them) that contain common operations to the MFS, e.g., find, move, add a file, make a directory.root.go
: MFSRoot
(aDirectory
with republishing support).repub.go
:Republisher
.mfs_test.go
: General tests (needs a revision).repub_test.go
: Republisher-specific tests (contains only theTestRepublisher
function).
Contribute
PRs accepted.
Small note: If editing the README, please conform to the standard-readme specification.
License
MIT © Protocol Labs, Inc.
# Functions
DirLookup will look up a file or directory at the given path under the directory 'd'.
TODO: Document this function and link its functionality with the republisher.
IsDir checks whether the FSNode is dir type.
IsFile checks whether the FSNode is file type.
Lookup extracts the root directory and performs a lookup under it.
Mkdir creates a directory at 'path' under the directory 'd', creating intermediary directories as needed if 'mkparents' is set to true.
Mv moves the file or directory at 'src' to 'dst' TODO: Document what the strings 'src' and 'dst' represent.
NewDirectory constructs a new MFS directory.
NewFile returns a NewFile object with the given parameters.
NewRepublisher creates a new Republisher object to republish the given root using the given short and long time intervals.
NewRoot creates a new Root and starts up a republisher routine for it.
PutNode inserts 'nd' at 'path' in the given mfs TODO: Rename or clearly document that this is not about nodes but actually MFS files/directories (that in the underlying representation can be considered as just nodes).
# Variables
No description provided by the author
No description provided by the author
No description provided by the author
TODO: Remove if not used.
TODO: Remove if not used.
No description provided by the author
# Structs
TODO: There's too much functionality associated with this structure, let's organize it (and if possible extract part of it elsewhere) and document the main features of `Directory` here.
File represents a file in the MFS, its logic its mainly targeted to coordinating (potentially many) `FileDescriptor`s pointing to it.
No description provided by the author
MkdirOpts is used by Mkdir.
No description provided by the author
Republisher manages when to publish a given entry.
Root represents the root of a filesystem tree.
# Interfaces
One `File` can have many `FileDescriptor`s associated to it (only one if it's RW, many if they are RO, see `File.desclock`).
FSNode abstracts the `Directory` and `File` structures, it represents any child node in the MFS (i.e., all the nodes besides the `Root`).