libpfs

package
v0.0.0-...-dde4a86 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2022 License: MPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SharedLock = iota
	ExclusiveLock
)

Types of locks

View Source
const PermMask = 0777

PermMask is the default mask used for permissions

Variables

This section is empty.

Functions

func AccessCommand

func AccessCommand(
	paranoidDirectory, filePath string, mode uint32,
) (returnCode returncodes.Code, returnError error)

AccessCommand is used by fuse to check if it has access to a given file.

func ChmodCommand

func ChmodCommand(
	paranoidDirectory, filePath string, perms os.FileMode,
) (returnCode returncodes.Code, returnError error)

ChmodCommand is used to change the permissions of a file.

func CreatCommand

func CreatCommand(
	paranoidDirectory, filePath string, perms os.FileMode,
) (returnCode returncodes.Code, returnError error)

CreatCommand creates a new file with the name filePath in the pfs paranoidDirectory

func GetFileSystemLock

func GetFileSystemLock(paranoidDir string, lockType int) error

GetFileSystemLock locks the filesystem

func InitCommand

func InitCommand(directory string) (returnCode returncodes.Code, returnError error)

InitCommand creates the pvd directory sturucture It also gets a UUID and stores it in the meta directory.

func LinkCommand

func LinkCommand(
	paranoidDirectory, existingFilePath, targetFilePath string,
) (returnCode returncodes.Code, returnError error)

LinkCommand creates a link of a file.

func MkdirCommand

func MkdirCommand(
	paranoidDirectory, dirPath string, mode os.FileMode,
) (returnCode returncodes.Code, returnError error)

MkdirCommand is called when making a paranoidDirectory

func MountCommand

func MountCommand(
	paranoidDirectory, dAddr, mountPoint string,
) (returnCode returncodes.Code, returnError error)

MountCommand is used to notify a pfs paranoidDirectory it has been mounted.

func ReadCommand

func ReadCommand(
	paranoidDirectory, filePath string, offset, length int64,
) (returnCode returncodes.Code, fileContents []byte, returnError error)

ReadCommand reads data from a file

func ReadDirCommand

func ReadDirCommand(
	paranoidDirectory, dirPath string,
) (returnCode returncodes.Code, fileNames []string, returnError error)

ReadDirCommand returns a list of all the files in the given paranoidDirectory

func ReadlinkCommand

func ReadlinkCommand(
	paranoidDirectory, filePath string,
) (returnCode returncodes.Code, linkContents string, returnError error)

ReadlinkCommand reads the value of the symbolic link

func RenameCommand

func RenameCommand(
	paranoidDirectory, oldFilePath, newFilePath string,
) (returnCode returncodes.Code, returnError error)

RenameCommand is called when renaming a file

func RmdirCommand

func RmdirCommand(
	paranoidDirectory, dirPath string,
) (returnCode returncodes.Code, returnError error)

RmdirCommand removes a paranoidDirectory

func SymlinkCommand

func SymlinkCommand(
	paranoidDirectory, existingFilePath, targetFilePath string,
) (returnCode returncodes.Code, returnError error)

SymlinkCommand creates a symbolic link

func TruncateCommand

func TruncateCommand(
	paranoidDirectory, filePath string, length int64,
) (returnCode returncodes.Code, returnError error)

TruncateCommand reduces the file given to the new length

func UnLockFileSystem

func UnLockFileSystem(paranoidDir string) error

UnLockFileSystem removes the lock from the filesystem

func UnlinkCommand

func UnlinkCommand(
	paranoidDirectory, filePath string,
) (returnCode returncodes.Code, returnError error)

UnlinkCommand removes a filename link from an inode.

func UtimesCommand

func UtimesCommand(
	paranoidDirectory, filePath string, atime, mtime *time.Time,
) (returnCode returncodes.Code, returnError error)

UtimesCommand updates the acess time and modified time of a file

func WriteCommand

func WriteCommand(
	paranoidDirectory, filePath string, offset, length int64, data []byte,
) (returnCode returncodes.Code, bytesWrote int, returnError error)

WriteCommand writes data to the given file

Types

type StatInfo

type StatInfo struct {
	Length int64
	Ctime  time.Time
	Mtime  time.Time
	Atime  time.Time
	Mode   os.FileMode
}

StatInfo contains the file metadata

func StatCommand

func StatCommand(
	paranoidDirectory, filePath string,
) (returnCode returncodes.Code, info StatInfo, returnError error)

StatCommand returns information about a file as StatInfo object

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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