ManagedMassStorage: Difference between revisions
Appearance
No edit summary |
No edit summary |
||
| (7 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
The ManagedMassStorageUD component is what backs [[Hard Disk Drive|Hard Disk Drives]] and [[Floppy Disk|Floppy Disks]]. This virtual component offers the following properties: | The ManagedMassStorageUD component is what backs [[Hard Disk Drive|Hard Disk Drives]] and [[Floppy Disk|Floppy Disks]]. This virtual component offers the following properties: | ||
{| class="wikitable" | {| class="wikitable" | ||
|+ | |+ ManagedMassStorageUD component properties | ||
|- | |- | ||
! Name !! Type !! Read/Write !! Description | ! Name !! Type !! Read/Write !! Description | ||
|- | |- | ||
| <code>totalCapacityBytes</code> || <code>integer</code> || READ || Total capacity of this drive (capacity is currently not limited, so this is not meaningful currently) | | <code>totalCapacityBytes</code> || <code>integer</code> || READ || Total capacity of this drive (capacity is currently not limited, so this is not meaningful currently). | ||
|- | |||
|<code>storageFamilyName</code> | |||
|<code>string</code> | |||
|READ | |||
|A string representing the type of storage medium, e.g. <code>hdd</code> or <code>floppy</code>. | |||
|- | |||
|<code>storageApiType</code> | |||
|<code>string</code> | |||
|READ | |||
|Simply <code>managed</code> for now. [[UnmanagedMassStorage]] would state <code>unmanaged</code> instead. | |||
|- | |||
|<code>diskId</code> | |||
|<code>integer</code> | |||
|READ | |||
|The unique id of this disk. | |||
|} | |} | ||
{| class="wikitable" | {| class="wikitable" | ||
|+ | |+ ManagedMassStorageUD component methods | ||
|- | |- | ||
! Name !! Returns !! Description | ! Name !! Returns !! Description | ||
|- | |- | ||
| style="white-space: nowrap;" | <code>:open(string:filePath[, string:mode=r])</code>|| <code> | | style="white-space: nowrap;" | <code>:open(string:filePath[, string:mode=r])</code>|| <code>LuaFsFileUD</code>|| style="padding:0;"| | ||
{| class="wikitable" style="margin:0;" | {| class="wikitable" style="margin:0;" | ||
!mode | !mode | ||
| Line 33: | Line 48: | ||
|Open or create a new file, do not erase the contents, allow only appending. | |Open or create a new file, do not erase the contents, allow only appending. | ||
|} | |} | ||
|- | |||
|<code>:list(string:path)</code> | |||
|<code>string[]</code> | |||
|Returns a list of file and directory names in the given directory. Directory names are indicated by a trailing slash. | |||
|- | |||
|<code>:fileExists(string:path)</code> | |||
|<code>boolean</code> | |||
|Returns whether the given path exists and represents a file | |||
|- | |||
|<code>:directoryExists(string:path)</code> | |||
|<code>string[]</code> | |||
|Returns whether the given path exists and represents a directory | |||
|- | |||
|<code>:delete(string:path)</code> | |||
|<code>void</code> | |||
|Deletes the specified file or directory. Directories are deleted recursively. | |||
|- | |||
|<code>:move(string:srcPath, string:destPath)</code> | |||
|<code>void</code> | |||
|Moves the specified file or directory to the destination path. | |||
|- | |||
|<code>:makeDirection(string:path)</code> | |||
|<code>void</code> | |||
|Creates a new directory at the specified path. | |||
|- | |||
|<code>:spaceUsed([string:path="/"])</code> | |||
|<code>long</code> | |||
|Returns the amount of space used on this storage device. If a path is given, only the space in this directory is measured. | |||
|} | |||
== LuaFsFileUD == | |||
{| class="wikitable" | |||
|+ ManagedMassStorageUD component methods | |||
|- | |||
! Name !! Returns !! Description | |||
|- | |||
| <code>:read(integer:count)</code>|| <code>string?</code>|| Reads a string from the handle's current position. Reads as much as possible, but at most <code>count</code> characters. If count is set to <code>-1</code>, as many chracters as possible are returned. | |||
|- | |||
|<code>:write(string:s)</code> | |||
|<code>void</code> | |||
|Writes the given string to the handle's current position. | |||
|- style="white-space: nowrap;" | | |||
|<code>:seek(string:relativeTo, integer:offset)</code> | |||
|<code>integer</code> | |||
|style="white-space: wrap;" |Adjusts the handle's current position as specified by <code>relativeTo</code> and <code>offset</code>. Valid values for relativeTo are <code>start</code>, <code>end</code> and <code>relative</code>. | |||
|- | |||
|<code>:flush()</code> | |||
|<code>void</code> | |||
|Writes all changes to the host filesystem. | |||
|- | |||
|<code>:close()</code> | |||
|<code>void</code> | |||
|Closes the handle, automatically flushing. | |||
|} | |} | ||
{{Navbox content}} | {{Navbox content}} | ||
Latest revision as of 02:26, 27 August 2026
The ManagedMassStorageUD component is what backs Hard Disk Drives and Floppy Disks. This virtual component offers the following properties:
| Name | Type | Read/Write | Description |
|---|---|---|---|
totalCapacityBytes |
integer |
READ | Total capacity of this drive (capacity is currently not limited, so this is not meaningful currently). |
storageFamilyName
|
string
|
READ | A string representing the type of storage medium, e.g. hdd or floppy.
|
storageApiType
|
string
|
READ | Simply managed for now. UnmanagedMassStorage would state unmanaged instead.
|
diskId
|
integer
|
READ | The unique id of this disk. |
| Name | Returns | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
:open(string:filePath[, string:mode=r]) |
LuaFsFileUD |
| ||||||||||||
:list(string:path)
|
string[]
|
Returns a list of file and directory names in the given directory. Directory names are indicated by a trailing slash. | ||||||||||||
:fileExists(string:path)
|
boolean
|
Returns whether the given path exists and represents a file | ||||||||||||
:directoryExists(string:path)
|
string[]
|
Returns whether the given path exists and represents a directory | ||||||||||||
:delete(string:path)
|
void
|
Deletes the specified file or directory. Directories are deleted recursively. | ||||||||||||
:move(string:srcPath, string:destPath)
|
void
|
Moves the specified file or directory to the destination path. | ||||||||||||
:makeDirection(string:path)
|
void
|
Creates a new directory at the specified path. | ||||||||||||
:spaceUsed([string:path="/"])
|
long
|
Returns the amount of space used on this storage device. If a path is given, only the space in this directory is measured. |
LuaFsFileUD
| Name | Returns | Description |
|---|---|---|
:read(integer:count) |
string? |
Reads a string from the handle's current position. Reads as much as possible, but at most count characters. If count is set to -1, as many chracters as possible are returned.
|
:write(string:s)
|
void
|
Writes the given string to the handle's current position. |
:seek(string:relativeTo, integer:offset)
|
integer
|
Adjusts the handle's current position as specified by relativeTo and offset. Valid values for relativeTo are start, end and relative.
|
:flush()
|
void
|
Writes all changes to the host filesystem. |
:close()
|
void
|
Closes the handle, automatically flushing. |