fs

package
v0.0.0-...-01ee8fb Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2018 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package fs contains file system related functions and types.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileInfo

type FileInfo struct {
	Type Type

	// The name of this child within its parent directory.
	Name string

	// The permissions for this file, including the {setuid,setgid,sticky} bits.
	// That is, the things that chmod(2) cares about. This does *not* include
	// type information such as os.ModeDevice or options such as os.ModeAppend.
	Permissions os.FileMode

	// The owning user's UID, and their username if known.
	Uid      sys.UserId
	Username *string

	// The owning group's GID, and its groupname if known.
	Gid       sys.GroupId
	Groupname *string

	// The modification time of this file.
	MTime time.Time

	// The size of regular files. Undefined for other types.
	Size uint64

	// The containing device's device number, and the inode on the device. These
	// are defined only for regular files.
	ContainingDevice int32
	Inode            uint64

	// The scores of zero or more blobs that make up a regular file's contents,
	// to be concatenated in order. For directories, this is exactly one blob
	// whose contents can be processed using repr.Unmarshal.
	//
	// Scores are present only if HardLinkTarget is not present.
	Scores []blob.Score

	// DEPRECATED: Newer versions of comeback do not set this field. They must
	// still check it for being non-nil however, because in that case scores are
	// not present and the file would otherwise look like a plain old empty file.
	//
	// If this regular file belongs to a backup containing another regular file
	// to which it is hard linked, this is the target of the hard link relative
	// to the root of the backup.
	HardLinkTarget *string

	// The target, if this is a symlink.
	Target string

	// The device number, for devices.
	DeviceNumber int32
}

FileInfo gives enough information to reconstruct a single child within a backed up directory.

func ConvertFileInfo

func ConvertFileInfo(
	in os.FileInfo,
	symlinkTarget string) (out *FileInfo, err error)

Convert the result of os.Lstat or os.Stat to a local FileInfo struct. symlinkTarget should be empty if this is not a symlink.

type Type

type Type uint32
const (
	TypeFile Type = iota
	TypeDirectory
	TypeSymlink
	TypeBlockDevice
	TypeCharDevice
	TypeNamedPipe
	TypeSocket
)

Jump to

Keyboard shortcuts

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