class External extends BaseFileFS

An External Andromeda filesystem is accessible outside Andromeda

The filesystem is used "normally" so that the contents can be viewed outside Andromeda. This also means that the filesystem contents are shared between all users, if it is globally accessible. Useful for making existing content accessible through andromeda.

The files and folder on-disk are considered the authoritative record of what exists, and the database is merely a metadata cache.

Properties

protected $fsmanager from  FSImpl

Methods

__construct(FSManager $fsmanager)

No description

from  FSImpl
int|null
GetChunkSize()

Returns the preferred byte alignment of the filesystem.

from  FSImpl
GetFSManager()

Returns a reference to the parent FS manager

from  FSImpl
GetStorage()

Returns the underlying storage

from  FSImpl
GetDatabase()

Returns a database reference

from  FSImpl
RefreshFile(File $file)

Updates the given DB file from disk

RefreshFolder(Folder $folder, bool $doContents = true, FileCreator|null $fileCr = null, FolderCreator|null $folderCr = null)

Updates the given DB folder (and contents) from disk

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

string
GetFilePath(File $file)

Get the root-relative path of the given file

ManualCopyFolder(Folder $folder, Folder $dest)

Helper function to emulate copying a folder by copying its contents manually

string
GetItemPath(Item $item, string|null $child = null)

Returns the root-relative path of the given item

Details

in FSImpl at line 26
__construct(FSManager $fsmanager)

No description

Parameters

FSManager $fsmanager

in FSImpl 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

in FSImpl at line 40
protected FSManager GetFSManager()

Returns a reference to the parent FS manager

Return Value

FSManager

in FSImpl at line 43
protected Storage GetStorage()

Returns the underlying storage

Return Value

Storage

in FSImpl at line 46
protected ObjectDatabase GetDatabase()

Returns a database reference

Return Value

ObjectDatabase

at line 54
FSImpl RefreshFile(File $file)

Updates the given DB file from disk

Checks that it exists, then updates stat metadata

Parameters

File $file

Return Value

FSImpl

at line 79
FSImpl RefreshFolder(Folder $folder, bool $doContents = true, FileCreator|null $fileCr = null, FolderCreator|null $folderCr = null)

Updates the given DB folder (and contents) from disk

Checks that it exists, then updates stat metadata. Also scans for new items and creates objects for them.

Parameters

Folder $folder
bool $doContents
FileCreator|null $fileCr

MUST BE NULL (unit testing only)

FolderCreator|null $folderCr

MUST BE NULL (unit testing only)

Return Value

FSImpl

at line 136
FSImpl CreateFolder(Folder $folder)

Creates the given folder on disk

Parameters

Folder $folder

Return Value

FSImpl

at line 143
FSImpl DeleteFolder(Folder $folder)

Deletes the given folder from disk

Parameters

Folder $folder

Return Value

FSImpl

in BaseFileFS at line 24
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

in BaseFileFS at line 19
FSImpl CreateFile(File $file)

Creates an empty file on storage

Parameters

File $file

Return Value

FSImpl

in BaseFileFS at line 49
FSImpl DeleteFile(File $file)

Deletes the given file from storage

Parameters

File $file

Return Value

FSImpl

in BaseFileFS at line 29
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

in BaseFileFS at line 34
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

in BaseFileFS at line 39
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 150
FSImpl RenameFile(File $file, string $name)

Renames a file to the given name

Parameters

File $file
string $name

Return Value

FSImpl

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

Renames a folder to the given name

Parameters

Folder $folder
string $name

Return Value

FSImpl

at line 166
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 174
FSImpl MoveFolder(Folder $folder, Folder $parent)

Moves a folder

Parameters

Folder $folder

folder to move

Folder $parent

new parent folder

Return Value

FSImpl

in BaseFileFS at line 44
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 182
FSImpl CopyFolder(Folder $folder, Folder $dest)

Copies a folder

Parameters

Folder $folder

folder to copy

Folder $dest

new object for destination

Return Value

FSImpl

at line 47
protected string GetFilePath(File $file)

Get the root-relative path of the given file

Parameters

File $file

Return Value

string

in BaseFileFS at line 60
protected BaseFileFS ManualCopyFolder(Folder $folder, Folder $dest)

Helper function to emulate copying a folder by copying its contents manually

Parameters

Folder $folder

folder to copy

Folder $dest

new folder object to copy to

Return Value

BaseFileFS

at line 36
protected string GetItemPath(Item $item, string|null $child = null)

Returns the root-relative path of the given item

Parameters

Item $item

item to get (or null)

string|null $child

if not null, add the given path to the end of the result

Return Value

string

path of the given item + $child