Documentation
¶
Index ¶
- Variables
- func Serialize(root *Dir, writer io.Writer) error
- type Context
- type Dir
- func (n *Dir) AddNode(name string, node tree.Node, overwrite bool) error
- func (n *Dir) CreateNode(name string, nodeType tree.NodeType) (tree.Node, error)
- func (n *Dir) CreateSymlink(name string, target string) (tree.Node, error)
- func (n *Dir) DeleteNode(name string) error
- func (n *Dir) GetNodeByName(name string) (tree.Node, error)
- func (n *Dir) GetNodes() (map[string]tree.Node, error)
- func (n *Dir) Pack(outputChan chan *NodeData) error
- func (n *Dir) Type() tree.NodeType
- type DirEntry
- type ExternalReference
- type File
- func (n *File) GetExecutable() (bool, error)
- func (n *File) GetSize() (uint64, error)
- func (n *File) Pack(outputChan chan *NodeData) error
- func (n *File) Read(offset uint64, size uint32) ([]byte, error)
- func (n *File) SetExecutable(executable bool) error
- func (n *File) Truncate(size uint64) error
- func (n *File) Type() tree.NodeType
- func (n *File) Write(offset uint64, data []byte) (uint32, error)
- type Node
- type NodeCommon
- func (n *NodeCommon) AddNode(name string, node tree.Node, overwrite bool) error
- func (n *NodeCommon) CreateNode(name string, nodeType tree.NodeType) (tree.Node, error)
- func (n *NodeCommon) CreateSymlink(name string, target string) (tree.Node, error)
- func (n *NodeCommon) DeleteNode(name string) error
- func (n *NodeCommon) GetCreationTime() (time.Time, error)
- func (n *NodeCommon) GetExecutable() (bool, error)
- func (n *NodeCommon) GetModTime() (time.Time, error)
- func (n *NodeCommon) GetNodeByName(name string) (tree.Node, error)
- func (n *NodeCommon) GetNodes() (map[string]tree.Node, error)
- func (n *NodeCommon) GetParent() Node
- func (n *NodeCommon) GetResolved() bool
- func (n *NodeCommon) GetSize() (uint64, error)
- func (n *NodeCommon) Id() string
- func (n *NodeCommon) IsReadOnly() bool
- func (n *NodeCommon) Lock()
- func (n *NodeCommon) Pack(outputChan chan *NodeData) error
- func (n *NodeCommon) RLock()
- func (n *NodeCommon) RUnlock()
- func (n *NodeCommon) Read(offset uint64, size uint32) ([]byte, error)
- func (n *NodeCommon) ReadLink() (string, error)
- func (n *NodeCommon) SetDriver(d driver.Driver)
- func (n *NodeCommon) SetExecutable(executable bool) error
- func (n *NodeCommon) SetParent(node Node)
- func (n *NodeCommon) SetReference(ref driver.Reference)
- func (n *NodeCommon) SetResolved(resolved bool)
- func (n *NodeCommon) Truncate(size uint64) error
- func (n *NodeCommon) Unlock()
- func (n *NodeCommon) Write(offset uint64, data []byte) (uint32, error)
- type NodeData
- type Notifier
- type Symlink
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrNotImplemented = errors.New("method not implemented for the node type")
)
Functions ¶
Types ¶
type Dir ¶
type Dir struct { NodeCommon // Obtained after resolution Nodes map[string]Node }
func NewDirWithChildren ¶
func NewExternalDir ¶
func (*Dir) CreateNode ¶
func (*Dir) CreateSymlink ¶
func (*Dir) DeleteNode ¶
type DirEntry ¶
type DirEntry struct { Name string Id string NodeType tree.NodeType IsExecutable bool IsExternal bool }
Encode directoy entries. Stored as JSON in blob.
type ExternalReference ¶
Encode an external node. Stored as JSON in blob.
type File ¶
type File struct { NodeCommon IsExecutable bool // Obtained after resolution Data []byte }
func NewExternalFile ¶
func NewExternalFile(ctx *Context, id string, isExecutable bool, d driver.Driver, r driver.Reference) *File
New external file node with given driver and reference
func NewFileWithData ¶
New file node with given data
func (*File) GetExecutable ¶
func (*File) SetExecutable ¶
type Node ¶
type Node interface { tree.Node Lock() Unlock() RLock() RUnlock() GetParent() Node SetParent(node Node) GetResolved() bool SetResolved(resolved bool) SetDriver(driver.Driver) SetReference(driver.Reference) // This method needs to be called with read lock held, similar to other // methods that access the internal state. Pack(outputChan chan *NodeData) error }
type NodeCommon ¶
type NodeCommon struct { NodeId string Parent Node CreatedTime time.Time ModifiedTime time.Time // External bit (this is true if a node used to be external, even // after its resolution) External bool Driver driver.Driver Reference driver.Reference Resolved bool Context *Context Mutex sync.RWMutex }
Mem-cached node implementation with optional persistent backend.
func (*NodeCommon) CreateNode ¶
func (*NodeCommon) CreateSymlink ¶
func (*NodeCommon) DeleteNode ¶
func (n *NodeCommon) DeleteNode(name string) error
func (*NodeCommon) GetCreationTime ¶
func (n *NodeCommon) GetCreationTime() (time.Time, error)
func (*NodeCommon) GetExecutable ¶
func (n *NodeCommon) GetExecutable() (bool, error)
func (*NodeCommon) GetModTime ¶
func (n *NodeCommon) GetModTime() (time.Time, error)
func (*NodeCommon) GetNodeByName ¶
func (n *NodeCommon) GetNodeByName(name string) (tree.Node, error)
func (*NodeCommon) GetParent ¶
func (n *NodeCommon) GetParent() Node
func (*NodeCommon) GetResolved ¶
func (n *NodeCommon) GetResolved() bool
func (*NodeCommon) GetSize ¶
func (n *NodeCommon) GetSize() (uint64, error)
func (*NodeCommon) Id ¶
func (n *NodeCommon) Id() string
func (*NodeCommon) IsReadOnly ¶
func (n *NodeCommon) IsReadOnly() bool
func (*NodeCommon) Lock ¶
func (n *NodeCommon) Lock()
func (*NodeCommon) Pack ¶
func (n *NodeCommon) Pack(outputChan chan *NodeData) error
func (*NodeCommon) RLock ¶
func (n *NodeCommon) RLock()
func (*NodeCommon) RUnlock ¶
func (n *NodeCommon) RUnlock()
func (*NodeCommon) ReadLink ¶
func (n *NodeCommon) ReadLink() (string, error)
func (*NodeCommon) SetDriver ¶
func (n *NodeCommon) SetDriver(d driver.Driver)
func (*NodeCommon) SetExecutable ¶
func (n *NodeCommon) SetExecutable(executable bool) error
func (*NodeCommon) SetParent ¶
func (n *NodeCommon) SetParent(node Node)
func (*NodeCommon) SetReference ¶
func (n *NodeCommon) SetReference(ref driver.Reference)
func (*NodeCommon) SetResolved ¶
func (n *NodeCommon) SetResolved(resolved bool)
func (*NodeCommon) Truncate ¶
func (n *NodeCommon) Truncate(size uint64) error
func (*NodeCommon) Unlock ¶
func (n *NodeCommon) Unlock()
type NodeData ¶
Serialized format of a node. Used to communicate with the persistent backend.
func (*NodeData) UnpackFile ¶
type Notifier ¶
type Notifier interface {
NodeChanged(id string)
}
Notifier describes an optional entity to each node for it to notify certain events. The user of this library can implement its own notifier to capture and process those events.
type Symlink ¶
type Symlink struct { NodeCommon // Obtained after resolution Target string }
func NewExternalSymlink ¶
Click to show internal directories.
Click to hide internal directories.