Documentation
¶
Overview ¶
package mfs implements an in memory model of a mutable IPFS filesystem.
It consists of four main structs:
- The Filesystem The filesystem serves as a container and entry point for various mfs filesystems
- Root Root represents an individual filesystem mounted within the mfs system as a whole
- Directories
- Files
Index ¶
- Constants
- Variables
- func FlushPath(rt *Root, pth string) error
- func Mkdir(r *Root, pth string, mkparents bool, flush bool) error
- func Mv(r *Root, src, dst string) error
- func PutNode(r *Root, path string, nd node.Node) error
- type Directory
- func (d *Directory) AddChild(name string, nd node.Node) error
- func (d *Directory) Child(name string) (FSNode, error)
- func (d *Directory) Flush() error
- func (d *Directory) GetNode() (node.Node, error)
- func (d *Directory) List() ([]NodeListing, error)
- func (d *Directory) ListNames() []string
- func (d *Directory) Mkdir(name string) (*Directory, error)
- func (d *Directory) Path() string
- func (d *Directory) Type() NodeType
- func (d *Directory) Uncache(name string)
- func (d *Directory) Unlink(name string) error
- type FSNode
- type File
- type FileDescriptor
- type NodeListing
- type NodeType
- type PubFunc
- type Republisher
- type Root
Constants ¶
View Source
const (
OpenReadOnly = iota
OpenWriteOnly
OpenReadWrite
)
Variables ¶
View Source
var ErrDirExists = errors.New("directory already has entry by that name")
View Source
var ErrInvalidChild = errors.New("invalid child node")
View Source
var ErrIsDirectory = errors.New("error: is a directory")
View Source
var ErrNotExist = errors.New("no such rootfs")
View Source
var ErrNotYetImplemented = errors.New("not yet implemented")
Functions ¶
Types ¶
type Directory ¶
type Directory struct {
// contains filtered or unexported fields
}
func NewDirectory ¶
func NewDirectory(ctx context.Context, name string, node *dag.ProtoNode, parent childCloser, dserv dag.DAGService) *Directory
func (*Directory) AddChild ¶
func (d *Directory) AddChild(name string, nd node.Node) error
AddChild adds the node 'nd' under this directory giving it the name 'name'
type FSNode ¶
type FSNode interface {
GetNode() (node.Node, error)
Flush() error
Type() NodeType
}
FSNode represents any node (directory, root, or file) in the mfs filesystem
type File ¶
type File struct {
// contains filtered or unexported fields
}
func NewFile ¶
func NewFile(name string, node node.Node, parent childCloser, dserv dag.DAGService) (*File, error)
NewFile returns a NewFile object with the given parameters
type FileDescriptor ¶
type FileDescriptor interface {
io.Reader
CtxReadFull(context.Context, []byte) (int, error)
io.Writer
io.WriterAt
io.Closer
io.Seeker
Truncate(int64) error
Size() (int64, error)
Sync() error
Flush() error
}
type NodeListing ¶
type NodeListing struct {
Name string
Type int
Size int64
Hash string
}
type Republisher ¶
type Republisher struct {
TimeoutLong time.Duration
TimeoutShort time.Duration
Publish chan struct{}
// contains filtered or unexported fields
}
Republisher manages when to publish a given entry
func NewRepublisher ¶
func NewRepublisher(ctx context.Context, pf PubFunc, tshort, tlong time.Duration) *Republisher
NewRepublisher creates a new Republisher object to republish the given root using the given short and long time intervals
type Root ¶
type Root struct {
Type string
// contains filtered or unexported fields
}
Root represents the root of a filesystem tree
Click to show internal directories.
Click to hide internal directories.