Skip to content

Latest commit

 

History

History
629 lines (394 loc) · 22.4 KB

File metadata and controls

629 lines (394 loc) · 22.4 KB

src/minisql/platform/file_linux.ml

Home · Files

Provides minisql platform file linux facilities for this project.

Package: minisql.platform.file_linux

Reachable from entry: no

Imports

  • std/io/file.ml as portable../MiniLangCompilerML/std/io/file.ml — external dependency

Declarations

closeNative

function closeNative(handle)

Closes the portable descriptor after its caller has released any lock.

Parameter Type Default Description
handle dynamic Native or runtime handle used by the operation.

View source

componentName

function componentName()

Returns the stable diagnostic name used by the module catalog.

View source

convert

function convert(result, operation)

Converts a portable file result to MiniSQL's stable storage error codes.

Parameter Type Default Description
result dynamic Result object populated or inspected by the operation.
operation dynamic operation value consumed by this operation.

View source

CREATE_ALWAYS

const CREATE_ALWAYS = 2

Defines the create always constant used by the minisql platform file linux module.

View source

CREATE_NEW

const CREATE_NEW = 1

Defines the create new constant used by the minisql platform file linux module.

View source

createDirectory

function createDirectory(path)

Creates one directory and retains the failing path in diagnostic errors.

Parameter Type Default Description
path dynamic Path of the file or directory used by the operation.

View source

deletePath

function deletePath(path)

Deletes one file-system path.

Parameter Type Default Description
path dynamic Path of the file or directory used by the operation.

View source

directoryExists

function directoryExists(path)

Reports whether a directory exists at the path.

Parameter Type Default Description
path dynamic Path of the file or directory used by the operation.

View source

fail

function fail(code, operation, message)

Creates a MiniSQL platform error with consistent Linux component context.

Parameter Type Default Description
code dynamic code value consumed by this operation.
operation dynamic operation value consumed by this operation.
message dynamic Human-readable message associated with the operation.

View source

FILE_ATTRIBUTE_DIRECTORY

const FILE_ATTRIBUTE_DIRECTORY = 16

Defines the file attribute directory constant used by the minisql platform file linux module.

View source

FILE_SHARE_DELETE

const FILE_SHARE_DELETE = 4

Defines the file share delete constant used by the minisql platform file linux module.

View source

FILE_SHARE_READ

const FILE_SHARE_READ = 1

Defines the file share read constant used by the minisql platform file linux module.

View source

FILE_SHARE_WRITE

const FILE_SHARE_WRITE = 2

Defines the file share write constant used by the minisql platform file linux module.

View source

fileExists

function fileExists(path)

Reports whether a regular file exists at the path.

Parameter Type Default Description
path dynamic Path of the file or directory used by the operation.

View source

flush

function flush(handle)

Forces writable data and metadata to stable storage.

Parameter Type Default Description
handle dynamic Native or runtime handle used by the operation.

View source

GENERIC_READ

const GENERIC_READ = 2147483648

Defines the generic read constant used by the minisql platform file linux module.

View source

GENERIC_WRITE

const GENERIC_WRITE = 1073741824

Defines the generic write constant used by the minisql platform file linux module.

View source

INVALID_ARGUMENT

const INVALID_ARGUMENT = 9001

POSIX adapter matching the historical file_win32 contract. Keeping this

View source

INVALID_FILE_ATTRIBUTES

const INVALID_FILE_ATTRIBUTES = 4294967295

Defines the invalid file attributes constant used by the minisql platform file linux module.

View source

IO_FAILURE

const IO_FAILURE = 9005

Defines the io failure constant used by the minisql platform file linux module.

View source

isImplemented

function isImplemented()

Reports that the Linux backend is complete.

View source

LOCK_CONFLICT

const LOCK_CONFLICT = 9007

Defines the lock conflict constant used by the minisql platform file linux module.

View source

lockWhole

function lockWhole(handle, exclusive, failImmediately)

Acquires a shared or exclusive whole-file lock.

Parameter Type Default Description
handle dynamic Native or runtime handle used by the operation.
exclusive dynamic exclusive value consumed by this operation.
failImmediately dynamic failImmediately value consumed by this operation.

View source

movePath

function movePath(source, destination, replaceExisting)

Atomically renames a path and optionally replaces the destination.

Parameter Type Default Description
source dynamic source value consumed by this operation.
destination dynamic destination value consumed by this operation.
replaceExisting dynamic replaceExisting value consumed by this operation.

View source

OPEN_ALWAYS

const OPEN_ALWAYS = 4

Defines the open always constant used by the minisql platform file linux module.

View source

OPEN_EXISTING

const OPEN_EXISTING = 3

Defines the open existing constant used by the minisql platform file linux module.

View source

openNative

function openNative(path, desiredAccess, shareMode, creationDisposition, writeThrough)

Opens a portable descriptor using the established Win32-like facade contract.

Parameter Type Default Description
path dynamic Path of the file or directory used by the operation.
desiredAccess dynamic desiredAccess value consumed by this operation.
shareMode dynamic shareMode value consumed by this operation.
creationDisposition dynamic creationDisposition value consumed by this operation.
writeThrough dynamic writeThrough value consumed by this operation.

View source

openNativePositionedRead

function openNativePositionedRead(path, desiredAccess, shareMode, creationDisposition, writeThrough)

Linux descriptors already use pread for explicit-offset reads, so the positioned-read constructor is identical to the ordinary native open.

Parameter Type Default Description
path dynamic Path of the file or directory used by the operation.
desiredAccess dynamic desiredAccess value consumed by this operation.
shareMode dynamic shareMode value consumed by this operation.
creationDisposition dynamic creationDisposition value consumed by this operation.
writeThrough dynamic writeThrough value consumed by this operation.

View source

pathAttributes

function pathAttributes(path)

Returns the directory attribute bit, zero for files, or the invalid sentinel.

Parameter Type Default Description
path dynamic Path of the file or directory used by the operation.

View source

pathExists

function pathExists(path)

Reports whether either a file or directory exists at the path.

Parameter Type Default Description
path dynamic Path of the file or directory used by the operation.

View source

readAt

function readAt(handle, fileOffset, destination, destinationOffset, count)

Positioned operations avoid a shared logical cursor when database readers use the same handle concurrently.

Parameter Type Default Description
handle dynamic Native or runtime handle used by the operation.
fileOffset dynamic fileOffset value consumed by this operation.
destination dynamic destination value consumed by this operation.
destinationOffset dynamic destinationOffset value consumed by this operation.
count dynamic Number of items or units to process.

View source

readCurrent

function readCurrent(handle, destination, count)

Reads from the compatibility cursor and advances it by the transferred count.

Parameter Type Default Description
handle dynamic Native or runtime handle used by the operation.
destination dynamic destination value consumed by this operation.
count dynamic Number of items or units to process.

View source

removeDirectory

function removeDirectory(path)

Removes one empty directory, including portable error translation.

Parameter Type Default Description
path dynamic Path of the file or directory used by the operation.

View source

seek

function seek(handle, offset)

Moves the compatibility cursor without changing the native descriptor offset.

Parameter Type Default Description
handle dynamic Native or runtime handle used by the operation.
offset dynamic Zero-based offset at which processing starts.

View source

size

function size(handle)

Returns the current physical file size.

Parameter Type Default Description
handle dynamic Native or runtime handle used by the operation.

View source

targetMilestone

function targetMilestone()

Returns the first MiniSQL milestone whose file contract this adapter implements.

View source

truncate

function truncate(handle, newSize)

Changes the physical file size through the portable backend.

Parameter Type Default Description
handle dynamic Native or runtime handle used by the operation.
newSize dynamic newSize value consumed by this operation.

View source

TRUNCATE_EXISTING

const TRUNCATE_EXISTING = 5

Defines the truncate existing constant used by the minisql platform file linux module.

View source

unlockWhole

function unlockWhole(handle)

Releases the whole-file lock owned by this descriptor.

Parameter Type Default Description
handle dynamic Native or runtime handle used by the operation.

View source

writeAt

function writeAt(handle, fileOffset, source, sourceOffset, count)

Writes a source range at an explicit file offset without changing the cursor.

Parameter Type Default Description
handle dynamic Native or runtime handle used by the operation.
fileOffset dynamic fileOffset value consumed by this operation.
source dynamic source value consumed by this operation.
sourceOffset dynamic sourceOffset value consumed by this operation.
count dynamic Number of items or units to process.

View source

writeCurrent

function writeCurrent(handle, source, count)

Writes from the compatibility cursor and advances it by the transferred count.

Parameter Type Default Description
handle dynamic Native or runtime handle used by the operation.
source dynamic source value consumed by this operation.
count dynamic Number of items or units to process.

View source