vfs

package
v0.4.24-alpha Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2024 License: ISC Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const VERSION = 001

Variables

This section is empty.

Functions

This section is empty.

Types

type ChildEntry

type ChildEntry struct {
	Checksum [32]byte
	FileInfo objects.FileInfo
}

type CustomMetadata

type CustomMetadata struct {
	Key   string `msgpack:"key"`
	Value []byte `msgpack:"value"`
}

type DirEntry

type DirEntry struct {
	Version            uint32              `msgpack:"version"`                      // Version number of the file entry structure for compatibility
	Name               string              `msgpack:"name"`                         // Name of the directory
	Type               importer.RecordType `msgpack:"type"`                         // Type of entry (directory)
	Size               int64               `msgpack:"size,omitempty"`               // Size of the file in bytes (optional for directories)
	Permissions        os.FileMode         `msgpack:"permissions"`                  // Directory permissions (read/write/execute)
	ModTime            time.Time           `msgpack:"modTime"`                      // Modification time of the directory
	DeviceID           uint64              `msgpack:"deviceID,omitempty"`           // Device ID for special files (block/character devices)
	InodeID            uint64              `msgpack:"inodeID,omitempty"`            // Inode ID for special files (block/character devices)
	UserID             uint64              `msgpack:"userID,omitempty"`             // User ID of the owner (optional)
	GroupID            uint64              `msgpack:"groupID,omitempty"`            // Group ID of the owner (optional)
	NumLinks           uint16              `msgpack:"numLinks,omitempty"`           // Number of hard links to the directory (optional)
	Children           []ChildEntry        `msgpack:"children,omitempty"`           // List of child entries' serialized checksums (files and subdirectories)
	ExtendedAttributes []ExtendedAttribute `msgpack:"extendedAttributes,omitempty"` // Extended attributes (xattrs) (optional)
	CustomMetadata     []CustomMetadata    `msgpack:"customMetadata,omitempty"`     // Custom key-value metadata defined by the user (optional)
	Tags               []string            `msgpack:"tags,omitempty"`               // List of tags associated with the directory (optional)
	ParentPath         string              `msgpack:"parentPath,omitempty"`         // Path to the parent directory (optional)
}

DirEntry represents the comprehensive structure for a directory entry

func DirEntryFromBytes

func DirEntryFromBytes(serialized []byte) (*DirEntry, error)

func NewDirectoryEntry

func NewDirectoryEntry(parentPath string, record *importer.ScanRecord) *DirEntry

func (*DirEntry) AddChild

func (d *DirEntry) AddChild(checksum [32]byte, fileInfo objects.FileInfo)

func (*DirEntry) AddTags

func (d *DirEntry) AddTags(tags []string)

func (*DirEntry) FileInfo

func (d *DirEntry) FileInfo() *objects.FileInfo

func (*DirEntry) Serialize

func (d *DirEntry) Serialize() ([]byte, error)

type ExtendedAttribute

type ExtendedAttribute struct {
	Name  string `msgpack:"name"`
	Value []byte `msgpack:"value"`
}

type FSEntry

type FSEntry interface {
	// contains filtered or unexported methods
}

type FileAttributes

type FileAttributes struct {
	IsHidden    bool `msgpack:"isHidden,omitempty"`    // Hidden file attribute (Windows, Linux)
	IsSystem    bool `msgpack:"isSystem,omitempty"`    // System file attribute (Windows)
	IsReadonly  bool `msgpack:"isReadonly,omitempty"`  // Read-only attribute
	IsArchive   bool `msgpack:"isArchive,omitempty"`   // Archive attribute (Windows)
	IsTemporary bool `msgpack:"isTemporary,omitempty"` // Temporary file (Windows)
}

FileAttributes represents platform-specific file attributes (e.g., hidden, system, etc.)

type FileEntry

type FileEntry struct {
	Version            uint32              `msgpack:"version"`                      // Version number of the file entry structure for compatibility
	Name               string              `msgpack:"name"`                         // Name of the file
	Type               importer.RecordType `msgpack:"type"`                         // Type of entry (file, directory, symlink, etc.)
	Size               int64               `msgpack:"size,omitempty"`               // Size of the file in bytes (optional for directories)
	Permissions        os.FileMode         `msgpack:"permissions"`                  // File permissions (read/write/execute)
	ModTime            time.Time           `msgpack:"modTime"`                      // Modification time of the file or directory
	DeviceID           uint64              `msgpack:"deviceID,omitempty"`           // Device ID for special files (block/character devices)
	InodeID            uint64              `msgpack:"inodeID,omitempty"`            // Inode ID for special files (block/character devices)
	UserID             uint64              `msgpack:"userID,omitempty"`             // User ID of the owner (optional)
	GroupID            uint64              `msgpack:"groupID,omitempty"`            // Group ID of the owner (optional)
	NumLinks           uint16              `msgpack:"numLinks,omitempty"`           // Number of hard links to the file (optional)
	Checksum           [32]byte            `msgpack:"checksum,omitempty"`           // Checksum of the file contents (SHA-256, etc.)
	Chunks             []objects.Chunk     `msgpack:"chunks,omitempty"`             // List of chunk checksums (optional)
	ExtendedAttributes []ExtendedAttribute `msgpack:"extendedAttributes,omitempty"` // Extended attributes (xattrs) (optional)
	FileAttributes     FileAttributes      `msgpack:"fileAttributes,omitempty"`     // Platform-specific attributes (e.g., hidden, system, etc.)
	SymlinkTarget      string              `msgpack:"symlinkTarget,omitempty"`      // Target path if the entry is a symbolic link (optional)
	ContentType        string              `msgpack:"contentType,omitempty"`        // MIME type of the file (optional)
	CustomMetadata     []CustomMetadata    `msgpack:"customMetadata,omitempty"`     // Custom key-value metadata defined by the user (optional)
	Tags               []string            `msgpack:"tags,omitempty"`               // List of tags associated with the file or directory (optional)
	ParentPath         string              `msgpack:"parentPath,omitempty"`         // Path to the parent directory (optional)
}

FileEntry represents the comprehensive structure for a file entry, capturing all relevant metadata

func FileEntryFromBytes

func FileEntryFromBytes(serialized []byte) (*FileEntry, error)

func NewFileEntry

func NewFileEntry(parentPath string, record *importer.ScanRecord) *FileEntry

func (*FileEntry) AddChecksum

func (f *FileEntry) AddChecksum(checksum [32]byte)

func (*FileEntry) AddChunk

func (f *FileEntry) AddChunk(chunk objects.Chunk)

func (*FileEntry) AddContentType

func (f *FileEntry) AddContentType(contentType string)

func (*FileEntry) AddFileAttributes

func (f *FileEntry) AddFileAttributes(fileAttributes FileAttributes)

func (*FileEntry) AddSymlinkTarget

func (f *FileEntry) AddSymlinkTarget(symlinkTarget string)

func (*FileEntry) AddTags

func (f *FileEntry) AddTags(tags []string)

func (*FileEntry) FileInfo

func (f *FileEntry) FileInfo() *objects.FileInfo

func (*FileEntry) Serialize

func (f *FileEntry) Serialize() ([]byte, error)

type Filesystem

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

func NewFilesystem

func NewFilesystem(repo *repository.Repository, root [32]byte) (*Filesystem, error)

func (*Filesystem) Children

func (fsc *Filesystem) Children(path string) (<-chan string, error)

func (*Filesystem) Directories

func (fsc *Filesystem) Directories() <-chan string

func (*Filesystem) DirectoryChecksums

func (fsc *Filesystem) DirectoryChecksums() <-chan [32]byte

func (*Filesystem) FileChecksums

func (fsc *Filesystem) FileChecksums() <-chan [32]byte

func (*Filesystem) Files

func (fsc *Filesystem) Files() <-chan string

func (*Filesystem) Pathnames

func (fsc *Filesystem) Pathnames() <-chan string

func (*Filesystem) Stat

func (fsc *Filesystem) Stat(path string) (FSEntry, error)

type ObjectType

type ObjectType string
const (
	ObjectTypeFile    ObjectType = "file"
	ObjectTypeDir     ObjectType = "directory"
	ObjectTypeSymlink ObjectType = "symlink"
	ObjectTypeDevice  ObjectType = "device"
	ObjectTypePipe    ObjectType = "pipe"
	ObjectTypeSocket  ObjectType = "socket"
)

Jump to

Keyboard shortcuts

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