graph

package
v0.0.0-...-93b510e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 5, 2017 License: GPL-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BYTE = 1 << (iota * 10)
	KILOBYTE
	MEGABYTE
	GIGABTYE
	TERABYTE

	BLOCK_SIZE = MEGABYTE
)
View Source
const RootNodeId = "rootNode"

Variables

This section is empty.

Functions

func Hash

func Hash(d []byte) string

func LocationOnDisk

func LocationOnDisk(hash string) string

func RawData

func RawData(hash string) ([]byte, error)

func Reader

func Reader(hash string) (io.Reader, error)

func SizeOnDisk

func SizeOnDisk(hash string) (int64, error)

func Sort

func Sort(nodes []*Node, sType Sorter)

func Write

func Write(hash string, d []byte) (int, error)

Types

type BlockInfo

type BlockInfo struct {
	Hash   string `json:"hash"`
	Offset int64  `json:"offset"`
}

type Node

type Node struct {
	Id string
	// contains filtered or unexported fields
}

func (*Node) BlockWithOffset

func (nd *Node) BlockWithOffset(offset int64) string

func (*Node) Blocks

func (nd *Node) Blocks() []BlockInfo

func (*Node) Children

func (nd *Node) Children() []*Node

Return the logical children of this node, i.e, all nodes from which an incoming edge is pointed at this node.

func (*Node) ChildrenSorted

func (nd *Node) ChildrenSorted(sorter Sorter) []*Node

func (*Node) Exists

func (nd *Node) Exists() bool

func (*Node) IsDir

func (nd *Node) IsDir() bool

Convenience method determining whether this node is a directory or not.

func (*Node) MTime

func (nd *Node) MTime() time.Time

func (*Node) Mode

func (nd *Node) Mode() os.FileMode

func (*Node) Move

func (nd *Node) Move(newParentId string) error

func (*Node) Name

func (nd *Node) Name() string

func (*Node) NodeInfo

func (nd *Node) NodeInfo() NodeInfo

func (*Node) Parent

func (nd *Node) Parent() *Node

Return the logical parent of this node, i.e. the node id with an incoming parent edge from this node.

func (*Node) ReadSeeker

func (nd *Node) ReadSeeker() *NodeSeeker

func (*Node) SetMode

func (nd *Node) SetMode(newMode os.FileMode) error

func (*Node) SetName

func (nd *Node) SetName(newName string) error

func (*Node) Size

func (nd *Node) Size() (sz int64)

func (*Node) String

func (nd *Node) String() string

func (*Node) Touch

func (nd *Node) Touch(newTime time.Time) error

func (*Node) Type

func (nd *Node) Type() string

func (*Node) Update

func (nd *Node) Update(info NodeInfo) error

func (*Node) WriteData

func (nd *Node) WriteData(data []byte, offset int64) error

type NodeGraph

type NodeGraph struct {
	*cayley.Handle
	RootNode *Node
}

func NewGraph

func NewGraph(graph *cayley.Handle) (*NodeGraph, error)

func (*NodeGraph) NewNode

func (ng *NodeGraph) NewNode(name, parentId string, mode os.FileMode) (nd *Node, err error)

func (*NodeGraph) NodeWithId

func (ng *NodeGraph) NodeWithId(id string) *Node

func (*NodeGraph) NodeWithName

func (ng *NodeGraph) NodeWithName(parentId, name string) *Node

func (*NodeGraph) RemoveNode

func (ng *NodeGraph) RemoveNode(nd *Node) (err error)

type NodeInfo

type NodeInfo struct {
	Id       string      `json:"id"`
	ParentId string      `json:"parent_id"`
	Name     string      `json:"name"`
	Size     int64       `json:"size"`
	MTime    time.Time   `json:"m_time"`
	Mode     os.FileMode `json:"mode"`
	Type     string      `json:"type"`
}

type NodeSeeker

type NodeSeeker struct {
	// contains filtered or unexported fields
}

func (*NodeSeeker) Read

func (ns *NodeSeeker) Read(p []byte) (n int, err error)

func (*NodeSeeker) Seek

func (ns *NodeSeeker) Seek(offset int64, whence int) (int64, error)

type Sorter

type Sorter int
const (
	Alphabetical Sorter = iota + 1
	DateModified
)

func Reversed

func Reversed(s Sorter) Sorter

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL