filesystem

package
v0.0.0-...-d8f7d12 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ListSelectSkipMode = 1 << iota
	ListSelectSkipNumLinks
	ListSelectSkipUid
	ListSelectSkipGid
	ListSelectSkipSizeDevnum
	ListSelectSkipMtime
	ListSelectSkipName
	ListSelectSkipData

	ListSelectAll = 0
)

Variables

This section is empty.

Functions

func CompareDirectoriesMetadata

func CompareDirectoriesMetadata(left, right *DirectoryInode,
	logWriter io.Writer) bool

func CompareDirectoryEntries

func CompareDirectoryEntries(left, right *DirectoryEntry,
	logWriter io.Writer) bool

func CompareDirectoryInodes

func CompareDirectoryInodes(left, right *DirectoryInode,
	logWriter io.Writer) bool

func CompareFileSystems

func CompareFileSystems(left, right *FileSystem, logWriter io.Writer) bool

func CompareInodes

func CompareInodes(left, right GenericInode, logWriter io.Writer) (
	sameType, sameMetadata, sameData bool)

func CompareRegularInodes

func CompareRegularInodes(left, right *RegularInode, logWriter io.Writer) bool

func CompareRegularInodesData

func CompareRegularInodesData(left, right *RegularInode,
	logWriter io.Writer) bool

func CompareRegularInodesMetadata

func CompareRegularInodesMetadata(left, right *RegularInode,
	logWriter io.Writer) bool

func CompareSpecialInodes

func CompareSpecialInodes(left, right *SpecialInode, logWriter io.Writer) bool

func CompareSpecialInodesData

func CompareSpecialInodesData(left, right *SpecialInode,
	logWriter io.Writer) bool

func CompareSpecialInodesMetadata

func CompareSpecialInodesMetadata(left, right *SpecialInode,
	logWriter io.Writer) bool

func CompareSymlinkInodes

func CompareSymlinkInodes(left, right *SymlinkInode, logWriter io.Writer) bool

func CompareSymlinkInodesData

func CompareSymlinkInodesData(left, right *SymlinkInode,
	logWriter io.Writer) bool

func CompareSymlinkInodesMetadata

func CompareSymlinkInodesMetadata(left, right *SymlinkInode,
	logWriter io.Writer) bool

func ForceWriteMetadata

func ForceWriteMetadata(inode GenericInode, name string) error

Types

type ComputedRegularInode

type ComputedRegularInode struct {
	Mode   FileMode
	Uid    uint32
	Gid    uint32
	Source string
}

func (*ComputedRegularInode) GetGid

func (inode *ComputedRegularInode) GetGid() uint32

func (*ComputedRegularInode) GetUid

func (inode *ComputedRegularInode) GetUid() uint32

func (*ComputedRegularInode) List

func (inode *ComputedRegularInode) List(w io.Writer, name string,
	numLinksTable NumLinksTable, numLinks int,
	listSelector ListSelector, filter *filter.Filter) error

func (*ComputedRegularInode) SetGid

func (inode *ComputedRegularInode) SetGid(gid uint32)

func (*ComputedRegularInode) SetUid

func (inode *ComputedRegularInode) SetUid(uid uint32)

func (*ComputedRegularInode) WriteMetadata

func (inode *ComputedRegularInode) WriteMetadata(name string) error

type DirectoryEntry

type DirectoryEntry struct {
	Name        string
	InodeNumber uint64
	// contains filtered or unexported fields
}

func (*DirectoryEntry) Inode

func (dirent *DirectoryEntry) Inode() GenericInode

func (*DirectoryEntry) SetInode

func (dirent *DirectoryEntry) SetInode(inode GenericInode)

func (*DirectoryEntry) String

func (dirent *DirectoryEntry) String() string

type DirectoryInode

type DirectoryInode struct {
	EntryList     []*DirectoryEntry
	EntriesByName map[string]*DirectoryEntry
	Mode          FileMode
	Uid           uint32
	Gid           uint32
}

func (*DirectoryInode) BuildEntryMap

func (directory *DirectoryInode) BuildEntryMap()

func (*DirectoryInode) GetGid

func (inode *DirectoryInode) GetGid() uint32

func (*DirectoryInode) GetUid

func (inode *DirectoryInode) GetUid() uint32

func (*DirectoryInode) List

func (inode *DirectoryInode) List(w io.Writer, name string,
	numLinksTable NumLinksTable, numLinks int,
	listSelector ListSelector, filter *filter.Filter) error

func (*DirectoryInode) ReplaceStrings

func (inode *DirectoryInode) ReplaceStrings(replaceFunc func(string) string)

func (*DirectoryInode) SetGid

func (inode *DirectoryInode) SetGid(gid uint32)

func (*DirectoryInode) SetUid

func (inode *DirectoryInode) SetUid(uid uint32)

func (*DirectoryInode) Write

func (inode *DirectoryInode) Write(name string) error

func (*DirectoryInode) WriteMetadata

func (inode *DirectoryInode) WriteMetadata(name string) error

type FileMode

type FileMode uint32

func (FileMode) String

func (mode FileMode) String() string

type FileSystem

type FileSystem struct {
	InodeTable InodeTable

	NumRegularInodes uint64
	TotalDataBytes   uint64

	DirectoryCount uint64
	DirectoryInode
	// contains filtered or unexported fields
}

func Decode

func Decode(reader io.Reader) (*FileSystem, error)

func (*FileSystem) ComputeTotalDataBytes

func (fs *FileSystem) ComputeTotalDataBytes()

func (*FileSystem) Encode

func (fs *FileSystem) Encode(writer io.Writer) error

func (*FileSystem) EstimateUsage

func (fs *FileSystem) EstimateUsage(blockSize uint64) uint64

func (*FileSystem) FilenameToInodeTable

func (fs *FileSystem) FilenameToInodeTable() FilenameToInodeTable

func (*FileSystem) Filter

func (fs *FileSystem) Filter(filter *filter.Filter) *FileSystem

func (*FileSystem) ForEachFile

func (fs *FileSystem) ForEachFile(
	fn func(name string, inodeNumber uint64, inode GenericInode) error) error

func (*FileSystem) GetObjects

func (fs *FileSystem) GetObjects() map[hash.Hash]uint64

func (*FileSystem) HashToInodesTable

func (fs *FileSystem) HashToInodesTable() HashToInodesTable

func (*FileSystem) InodeToFilenamesTable

func (fs *FileSystem) InodeToFilenamesTable() InodeToFilenamesTable

func (*FileSystem) List

func (fs *FileSystem) List(w io.Writer) error

func (*FileSystem) Listf

func (fs *FileSystem) Listf(w io.Writer, listSelector ListSelector,
	filter *filter.Filter) error

func (*FileSystem) NumComputedRegularInodes

func (fs *FileSystem) NumComputedRegularInodes() uint64

func (*FileSystem) RebuildInodePointers

func (fs *FileSystem) RebuildInodePointers() error

func (*FileSystem) String

func (fs *FileSystem) String() string

type FilenameToInodeTable

type FilenameToInodeTable map[string]uint64

type GenericInode

type GenericInode interface {
	GetGid() uint32
	GetUid() uint32
	List(w io.Writer, name string, numLinksTable NumLinksTable,
		numLinks int, listSelector ListSelector, filter *filter.Filter) error
	SetGid(gid uint32)
	SetUid(uid uint32)
	WriteMetadata(name string) error
}

type HashToInodesTable

type HashToInodesTable map[hash.Hash][]uint64

type InodeTable

type InodeTable map[uint64]GenericInode

type InodeToFilenamesTable

type InodeToFilenamesTable map[uint64][]string

type ListSelector

type ListSelector uint8

type NumLinksTable

type NumLinksTable map[uint64]int

type RegularInode

type RegularInode struct {
	Mode             FileMode
	Uid              uint32
	Gid              uint32
	MtimeNanoSeconds int32
	MtimeSeconds     int64
	Size             uint64
	Hash             hash.Hash
}

func (*RegularInode) GetGid

func (inode *RegularInode) GetGid() uint32

func (*RegularInode) GetUid

func (inode *RegularInode) GetUid() uint32

func (*RegularInode) List

func (inode *RegularInode) List(w io.Writer, name string,
	numLinksTable NumLinksTable, numLinks int,
	listSelector ListSelector, filter *filter.Filter) error

func (*RegularInode) SetGid

func (inode *RegularInode) SetGid(gid uint32)

func (*RegularInode) SetUid

func (inode *RegularInode) SetUid(uid uint32)

func (*RegularInode) WriteMetadata

func (inode *RegularInode) WriteMetadata(name string) error

type SpecialInode

type SpecialInode struct {
	Mode             FileMode
	Uid              uint32
	Gid              uint32
	MtimeNanoSeconds int32
	MtimeSeconds     int64
	Rdev             uint64
}

func (*SpecialInode) GetGid

func (inode *SpecialInode) GetGid() uint32

func (*SpecialInode) GetUid

func (inode *SpecialInode) GetUid() uint32

func (*SpecialInode) List

func (inode *SpecialInode) List(w io.Writer, name string,
	numLinksTable NumLinksTable, numLinks int,
	listSelector ListSelector, filter *filter.Filter) error

func (*SpecialInode) SetGid

func (inode *SpecialInode) SetGid(gid uint32)

func (*SpecialInode) SetUid

func (inode *SpecialInode) SetUid(uid uint32)

func (*SpecialInode) Write

func (inode *SpecialInode) Write(name string) error

func (*SpecialInode) WriteMetadata

func (inode *SpecialInode) WriteMetadata(name string) error

type SymlinkInode

type SymlinkInode struct {
	Uid     uint32
	Gid     uint32
	Symlink string
}

func (*SymlinkInode) GetGid

func (inode *SymlinkInode) GetGid() uint32

func (*SymlinkInode) GetUid

func (inode *SymlinkInode) GetUid() uint32

func (*SymlinkInode) List

func (inode *SymlinkInode) List(w io.Writer, name string,
	numLinksTable NumLinksTable, numLinks int,
	listSelector ListSelector, filter *filter.Filter) error

func (*SymlinkInode) SetGid

func (inode *SymlinkInode) SetGid(gid uint32)

func (*SymlinkInode) SetUid

func (inode *SymlinkInode) SetUid(uid uint32)

func (*SymlinkInode) Write

func (inode *SymlinkInode) Write(name string) error

func (*SymlinkInode) WriteMetadata

func (inode *SymlinkInode) WriteMetadata(name string) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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