Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Node

type Node struct {
	fs.Inode
	// contains filtered or unexported fields
}

    A tree node in filesystem, it acts as both a directory and file

    func NewRoot

    func NewRoot(store store.Store) *Node

      NewRoot returns a file node - acting as a root, with inode sets to 1 and leaf sets to false

      func (*Node) Create

      func (n *Node) Create(ctx context.Context, name string, flags uint32, mode uint32, out *fuse.EntryOut) (*fs.Inode, fs.FileHandle, uint32, syscall.Errno)

        Create actually writes an empty value into the store (as a placeholder)

        func (*Node) Flush

        func (n *Node) Flush(ctx context.Context, fh fs.FileHandle) syscall.Errno

          Flush puts file content into store

          func (*Node) Fsync

          func (n *Node) Fsync(ctx context.Context, f fs.FileHandle, flags uint32) syscall.Errno

            Some editors (eg. Vim) need to call Fsync, so implement it here as a no-op

            func (*Node) Getattr

            func (n *Node) Getattr(ctx context.Context, fh fs.FileHandle, out *fuse.AttrOut) syscall.Errno

              Getattr outputs file attributes TODO: how to invalidate them?

              func (*Node) Lookup

              func (n *Node) Lookup(ctx context.Context, name string, out *fuse.EntryOut) (*fs.Inode, syscall.Errno)

                Lookup finds a file under the current node(directory)

                func (*Node) Mkdir

                func (n *Node) Mkdir(ctx context.Context, name string, mode uint32, out *fuse.EntryOut) (*fs.Inode, syscall.Errno)

                  Mkdir implements the NodeMkdirer interface and the `mkdir` operation.

                  func (*Node) Open

                  func (n *Node) Open(ctx context.Context, flags uint32) (fh fs.FileHandle, fuseFlags uint32, errno syscall.Errno)

                    Open gets value from store, and saves it in "content" for later read

                    func (*Node) Read

                    func (n *Node) Read(ctx context.Context, dest []byte, off int64) (fuse.ReadResult, syscall.Errno)

                      Read returns bytes from "content", which should be filled by a prior Open operation

                      func (*Node) Readdir

                      func (n *Node) Readdir(ctx context.Context) (fs.DirStream, syscall.Errno)

                        List keys under a certain prefix from the store, and output the next hierarchy level

                        func (*Node) Setattr

                        func (n *Node) Setattr(ctx context.Context, fh fs.FileHandle, in *fuse.SetAttrIn, out *fuse.AttrOut) syscall.Errno

                          Implement Setattr to support truncation

                          func (n *Node) Unlink(ctx context.Context, name string) syscall.Errno

                            Unlink removes a key from the store

                            func (*Node) Write

                            func (n *Node) Write(ctx context.Context, fh fs.FileHandle, buf []byte, off int64) (uint32, syscall.Errno)

                              Write saves to the internal "content" buffer

                              type Server

                              type Server struct {
                              	*fuse.Server
                              	// contains filtered or unexported fields
                              }

                              func MustMount

                              func MustMount(mountPoint string, store store.Store) *Server

                              func (*Server) ListenForUnmount

                              func (s *Server) ListenForUnmount()