mirror of https://github.com/restic/restic.git
node: add comments
This commit is contained in:
parent
ff4dd1f1fb
commit
0ca678228d
3
node.go
3
node.go
|
@ -17,6 +17,7 @@ import (
|
||||||
"github.com/restic/restic/server"
|
"github.com/restic/restic/server"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Node is a file, directory or other item in a backup.
|
||||||
type Node struct {
|
type Node struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Type string `json:"type"`
|
Type string `json:"type"`
|
||||||
|
@ -62,6 +63,7 @@ func (node Node) Tree() *Tree {
|
||||||
return node.tree
|
return node.tree
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NodeFromFileInfo returns a new node from the given path and FileInfo.
|
||||||
func NodeFromFileInfo(path string, fi os.FileInfo) (*Node, error) {
|
func NodeFromFileInfo(path string, fi os.FileInfo) (*Node, error) {
|
||||||
node := &Node{
|
node := &Node{
|
||||||
path: path,
|
path: path,
|
||||||
|
@ -100,6 +102,7 @@ func nodeTypeFromFileInfo(fi os.FileInfo) string {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CreatAt creates the node at the given path and restores all the meta data.
|
||||||
func (node *Node) CreateAt(path string, s *server.Server) error {
|
func (node *Node) CreateAt(path string, s *server.Server) error {
|
||||||
switch node.Type {
|
switch node.Type {
|
||||||
case "dir":
|
case "dir":
|
||||||
|
|
Loading…
Reference in New Issue