Documentation
¶
Index ¶
- Variables
- type InodeMap
- type Node
- type Server
- type Tree
- func (t *Tree) Create(filename string) Node
- func (t *Tree) FileByNode(n Node) (*shade.File, error)
- func (t *Tree) HasChild(parent, child string) bool
- func (t *Tree) Mkdir(dir string) Node
- func (t *Tree) NodeByPath(p string) (Node, error)
- func (t *Tree) NumNodes() int
- func (t *Tree) Refresh() error
- func (t *Tree) Update(n Node)
Constants ¶
This section is empty.
Variables ¶
var (
// DefaultChunkSizeBytes defines the default for newly created shade.File(s)
DefaultChunkSizeBytes = 16 * 1024 * 1024
)
Functions ¶
This section is empty.
Types ¶
type InodeMap ¶
type InodeMap struct { sync.RWMutex // protects acess to all fields of the struct // contains filtered or unexported fields }
InodeMap provides a mapping from fuse.Node to and from the Path that it corresponds to.
func NewInodeMap ¶
func NewInodeMap() *InodeMap
NewInodeMap returns an initialized InodeMap. Initially, it knows of only the path to the root inode.
func (*InodeMap) FromPath ¶
FromPath returns the inode allocated for a given path. If no inode has been allocated for that path yet, it allocates a new one and returns it.
type Node ¶
type Node struct { // Filename is the complete path to a node, with no leading or trailing // slash. Filename string Filesize int64 // in bytes ModifiedTime time.Time // Deleted indicates the file was Deleted at ModifiedTime. NodeByPath // responds exactly as if the node did not exist. Deleted bool Sha256sum []byte // the sha of the full shade.File // Children is a map indicating the presence of a node immediately // below the current node in the tree. The key is only the name of that // node, a relative path, not fully qualified. // TODO(asjoyner): use a struct{} here for efficiency? // unsafe.Sizeof indicates it would save 1 byte per FS entry Children map[string]bool }
Node is a very compact representation of a shade.File. It can also be used to represent a sythetic directory, for tree traversal.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server holds the state about the fuse connection
func New ¶
New returns a Server which will service fuse requests arriving on conn, based on data retrieved from drive.Client. It is ready to serve requests when Server.conn.Ready is closed. The cached view of files is updated every refresh.
type Tree ¶
type Tree struct {
// contains filtered or unexported fields
}
Tree is a representation of all files known to the provided drive.Client. It initially downlods, then periodically refreshes, the set of files by calling ListFiles and GetChunk. It presents methods to query for what file object currently describes what path, and can return a Node or shade.File struct representing that node in the tree.
func NewTree ¶
NewTree queries client to discover all the shade.File(s). It returns a Tree object which is ready to answer questions about the nodes in the file tree. If the initial query fails, an error is returned instead.
func (*Tree) FileByNode ¶
FileByNode returns the full shade.File object for a given node.
func (*Tree) HasChild ¶
HasChild returns true if child exists immediately below parent in the file tree.
func (*Tree) NodeByPath ¶
NodeByPath returns a Node describing the given path.
func (*Tree) NumNodes ¶
NumNodes returns the number of nodes (files + synthetic directories) in the system.