abstract class FSImpl

Abstract class for a filesystem implementation, with the actual disk functions.

This is the interface that on-disk objects (files) will call into. Filesystem implementations define how DB objects map to disk files, and then call the underlying storage. The FSImpl class's info is managed by the FSManager and is not a DB object.

Properties

protected $fsmanager

Methods

__construct(FSManager $fsmanager)

No description

int|null
GetChunkSize()

Returns the preferred byte alignment of the filesystem.

GetFSManager()

Returns a reference to the parent FS manager

GetStorage()

Returns the underlying storage

GetDatabase()

Returns a database reference

RefreshFile(File $file)

Synchronizes the given file's metadata with storage

RefreshFolder(Folder $folder, bool $doContents = true)

Synchronizes the given folder's metadata with storage

CreateFolder(Folder $folder)

Creates the given folder on disk

DeleteFolder(Folder $folder)

Deletes the given folder from disk

ImportFile(File $file, InputPath $infile)

Creates a new file and imports its content

CreateFile(File $file)

Creates an empty file on storage

DeleteFile(File $file)

Deletes the given file from storage

string
ReadBytes(File $file, int $start, int $length)

Reads the exact number of desired bytes from the given file

WriteBytes(File $file, int $start, string $data)

Writes to the given file, possibly appending it

Truncate(File $file, int $length)

Truncates (changes size of) a file

RenameFile(File $file, string $name)

Renames a file to the given name

RenameFolder(Folder $folder, string $name)

Renames a folder to the given name

MoveFile(File $file, Folder $parent)

Moves a file

MoveFolder(Folder $folder, Folder $parent)

Moves a folder

CopyFile(File $file, File $dest)

Copies a file

CopyFolder(Folder $folder, Folder $dest)

Copies a folder

Details

at line 26
__construct(FSManager $fsmanager)

No description

Parameters

FSManager $fsmanager

at line 37
int|null GetChunkSize()

Returns the preferred byte alignment of the filesystem.

Reads and writes should align to these boundaries for performance

Return Value

int|null

FS chunk size

at line 40
protected FSManager GetFSManager()

Returns a reference to the parent FS manager

Return Value

FSManager

at line 43
protected Storage GetStorage()

Returns the underlying storage

Return Value

Storage

at line 46
protected ObjectDatabase GetDatabase()

Returns a database reference

Return Value

ObjectDatabase

at line 49
abstract FSImpl RefreshFile(File $file)

Synchronizes the given file's metadata with storage

Parameters

File $file

Return Value

FSImpl

at line 52
abstract FSImpl RefreshFolder(Folder $folder, bool $doContents = true)

Synchronizes the given folder's metadata with storage

Parameters

Folder $folder
bool $doContents

Return Value

FSImpl

at line 55
abstract FSImpl CreateFolder(Folder $folder)

Creates the given folder on disk

Parameters

Folder $folder

Return Value

FSImpl

at line 58
abstract FSImpl DeleteFolder(Folder $folder)

Deletes the given folder from disk

Parameters

Folder $folder

Return Value

FSImpl

at line 66
abstract FSImpl ImportFile(File $file, InputPath $infile)

Creates a new file and imports its content

Parameters

File $file

the database object

InputPath $infile

the file to import

Return Value

FSImpl

at line 69
abstract FSImpl CreateFile(File $file)

Creates an empty file on storage

Parameters

File $file

Return Value

FSImpl

at line 72
abstract FSImpl DeleteFile(File $file)

Deletes the given file from storage

Parameters

File $file

Return Value

FSImpl

at line 83
abstract string ReadBytes(File $file, int $start, int $length)

Reads the exact number of desired bytes from the given file

Throws an error if the read goes beyond the end of the file

Parameters

File $file

file to read

int $start

byte offset

int $length

number of bytes

Return Value

string

file data

at line 92
abstract FSImpl WriteBytes(File $file, int $start, string $data)

Writes to the given file, possibly appending it

Parameters

File $file

file to write

int $start

byte offset

string $data

data to write

Return Value

FSImpl

at line 100
abstract FSImpl Truncate(File $file, int $length)

Truncates (changes size of) a file

Parameters

File $file

file to truncate

int $length

desired size in bytes

Return Value

FSImpl

at line 103
abstract FSImpl RenameFile(File $file, string $name)

Renames a file to the given name

Parameters

File $file
string $name

Return Value

FSImpl

at line 106
abstract FSImpl RenameFolder(Folder $folder, string $name)

Renames a folder to the given name

Parameters

Folder $folder
string $name

Return Value

FSImpl

at line 114
abstract FSImpl MoveFile(File $file, Folder $parent)

Moves a file

Parameters

File $file

file to move

Folder $parent

new parent folder

Return Value

FSImpl

at line 122
abstract FSImpl MoveFolder(Folder $folder, Folder $parent)

Moves a folder

Parameters

Folder $folder

folder to move

Folder $parent

new parent folder

Return Value

FSImpl

at line 130
abstract FSImpl CopyFile(File $file, File $dest)

Copies a file

Parameters

File $file

file to copy

File $dest

new object for destination

Return Value

FSImpl

at line 138
abstract FSImpl CopyFolder(Folder $folder, Folder $dest)

Copies a folder

Parameters

Folder $folder

folder to copy

Folder $dest

new object for destination

Return Value

FSImpl