efs

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EntryTypeFolder = iota
	EntryTypeFile
	EntryTypeSymlink
	EntryTypeDeleted
	EntryTypeDeletedFile
	EntryTypeDeletedFolder
	EntryTypeOnlineDocument
	EntryTypeReparsePointsSymlink
	EntryTypePlaceholder
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AbsoluteOutcome

type AbsoluteOutcome interface {
	eidiom.Outcome

	IsFileSystemNotAccessible() bool
	IsNoDefaultPath() bool
}

type ChildOutcome

type ChildOutcome interface {
	NameOutcome

	// IsPathTooLong returns true if the path is too long for the system.
	IsPathTooLong() bool
}

type CopyOutcome

type CopyOutcome interface {
	FileSystemOutcome
}

type CreateFileOutcome

type CreateFileOutcome interface {
	FileSystemOutcome
}

type CurrentPathOutcome

type CurrentPathOutcome interface {
	eidiom.Outcome
}

type DeleteFileOutcome

type DeleteFileOutcome interface {
	FileSystemOutcome

	IsFileNotFound() bool
}

type Entry

type Entry interface {
	fmt.Stringer

	// Name base name of the entry.
	Name() string
}

Entry is an element for representation of child item of a folder, that is typically a file or a folder.

type File

type File interface {
	Size() uint64
}

type FileOps

type FileOps interface {
	CreateFile() (File, CreateFileOutcome)
	DeleteFile() DeleteFileOutcome
	DeleteFileIfExists() DeleteFileOutcome
}

FileOps defines operation set for a file.

type FileSystem

type FileSystem interface {
	Identity() string

	// Path resolves path in the file system. This func does not verify file/folder existence.
	Path(path string) (Path, PathOutcome)

	// Equals compare to the other. returns true if the other is exactly same as the instance, otherwise false.
	Equals(other FileSystem) bool

	CurrentPath() (Path, CurrentPathOutcome)

	NameRule() Name
}

type FileSystemOutcome

type FileSystemOutcome interface {
	eidiom.Outcome

	// IsTimeout returns true if an operation failed with timeout.
	IsTimeout() bool

	// IsOperationNotAllowed returns true if an operation is not allowed.
	IsOperationNotAllowed() bool
}

type Folder

type Folder interface {
}

type FolderOps

type FolderOps interface {
	ListEntries(f func(entry Entry) eidiom.Outcome) ListOutcome
	ListFiles(f func(file File) eidiom.Outcome) ListOutcome
	ListFolders(f func(folder Folder) eidiom.Outcome) ListOutcome

	WalkEntries(f func(entry Entry) eidiom.Outcome) WalkOutcome
	WalkFiles(f func(file File) eidiom.Outcome) WalkOutcome
	WalkFolders(f func(folder Folder) eidiom.Outcome) WalkOutcome
}

type ListOutcome

type ListOutcome interface {
	FileSystemOutcome
}

type MoveOutcome

type MoveOutcome interface {
	FileSystemOutcome
}

type Name

type Name interface {
	Accept(name string) NameOutcome
}

type NameOutcome

type NameOutcome interface {
	eidiom.Outcome

	// IsInvalidChar return true if invalid char found in given name
	// See more detail about limitation:
	// https://en.wikipedia.org/wiki/Filename#Comparison_of_filename_limitations
	IsInvalidChar() bool

	// IsNameReserved IsReserved return true if the name is reserved by the system
	IsNameReserved() bool
	IsNameTooLong() bool
}

type Namespace

type Namespace interface {
	fmt.Stringer

	// Identity The path implementation must use path separator for '/' even for the Windows implementation.
	// The identity string does not need to be portable.
	// It might point to the another path if some context change, e.g. different user context.
	//
	// Case sensitivity: see more detail at Path#Identity
	Identity() string

	// Equals compare to the other. returns true if the other is exactly same as this instance, otherwise false.
	Equals(other Namespace) bool

	// IsDefault returns true if the namespace is the default namespace of current file system and principle.
	IsDefault() bool

	// FileSystem returns the file system.
	FileSystem() FileSystem
}

type Path

type Path interface {
	fmt.Stringer

	// Identity is for identify path. It designed for compare paths with identity whether it equals to another.
	// The identity string does not need to be portable.
	// It might point to the another path if some context change, e.g. different user context.
	// The path implementation must use path separator for '/' even for the Windows implementation.
	//
	// Case sensitivity:
	// The identity string should be lowercase for case in-sensitive file systems.
	// Changing case should use user's context such as locale,
	// for example, in case of changing case from "I" to "i", change to "ı" (dotless I) for Turkish locale.
	// https://en.wikipedia.org/wiki/Dotted_and_dotless_I
	Identity() string

	// FileSystem returns associated file system instance.
	FileSystem() FileSystem

	// Parent returns parent path.
	Parent() Path

	// Basename Returns the last element of the path. Returns empty string if the path is "/".
	Basename() string

	// Extname returns the extension of the last element of the path.
	// Returns empty if no ext like ('\.(.)+$') part found.
	Extname() string

	// IsRoot returns true when the path is root path of this file system or namespace.
	IsRoot() bool

	// Namespace of the path. Returns empty string if no namespace associated to the path.
	//
	// Windows example; Returns "C:" for "C:\foo\bar", "\\host\share" for "\\host\share\foo.txt", or
	// "\\?\C:" for "\\?\C:\foo.txt".
	// UN*X example; Returns "" for "/foo/bar", or "host:" for "host:/foo/bar".
	Namespace() Namespace

	// Child creates child path.
	Child(name ...string) (Path, ChildOutcome)
}

Path abstract absolute file path for various file systems.

type PathOps

type PathOps interface {
	Exist() (bool, FileSystemOutcome)
	Move(dest Path) MoveOutcome
	Copy(dest Path) CopyOutcome
}

type PathOutcome

type PathOutcome interface {
	eidiom.Outcome

	IsInvalidPath() bool
}

type Profile

type Profile interface {
	// IsPosixPermission returns true if the file system uses POSIX compatible permission model, otherwise false.
	IsPosixPermission() bool

	// IsHardLinkSupported returns true if the file system supports hard link, otherwise false.
	IsHardLinkSupported() bool

	// IsSymbolicLinkSupported returns true if the file system supports symbolic link, otherwise false.
	IsSymbolicLinkSupported() bool

	// IsReparsePointsSupported returns true if the file system supports reparse points, otherwise false.
	IsReparsePointsSupported() bool

	// IsOnlineDocumentSupported returns true if the file systems supports special online document such as Google Docs, otherwise false.
	IsOnlineDocumentSupported() bool

	// IsFileLockSupported returns true if the file system supports lock/unlock a file, otherwise false.
	IsFileLockSupported() bool

	// IsFileCommentSupported returns true if the file system supports comment for a file, otherwise false.
	IsFileCommentSupported() bool

	// IsFileVersionHistorySupported returns true if the file system supports file version history, otherwise false.
	IsFileVersionHistorySupported() bool

	// IsHiddenAttrSupported returns true if the file system supports hidden file, otherwise false.
	IsHiddenAttrSupported() bool

	// IsReadOnly returns true if the file system is read only, otherwise false.
	IsReadOnly() bool

	// MaxFileSize returns maximum file size.
	MaxFileSize() (uint64, ProfileOutcome)

	// MaxNumFiles returns maximum number of files per single namespace.
	MaxNumFiles(namespace Namespace) (uint64, ProfileOutcome)
}

Profile collection of information about file system with current principle. All profiles are knowledge based on the file system implementation. Some attribute may not true for a specific path. For example, On UNIX, base file system usually supports read/write. But you can mount readonly device such as CD/DVD to a certain mount point.

type ProfileOutcome

type ProfileOutcome interface {
	FileSystemOutcome

	IsUnknown() bool
}

type WalkOutcome

type WalkOutcome interface {
	FileSystemOutcome
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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