Provides minisql common diagnostics facilities for this project.
Package: minisql.common.diagnostics
Reachable from entry: yes
minisql/common/endian.mlasendian→ src/minisql/common/endian.mlminisql/common/uuid.mlasuuid→ src/minisql/common/uuid.mlminisql/platform/file.mlasfile_api→ src/minisql/platform/file.mlstd/time.mlastime_api→../MiniLangCompilerML/std/time.ml— external dependency
function appendAudit(log, eventType, outcome, sessionId, principalId, detail)Appends the audit. Inputs: log, eventType, outcome, sessionId, principalId, detail. Returns the produced value or propagates a structured error from validation or delegated operations.
| Parameter | Type | Default | Description |
|---|---|---|---|
log |
dynamic |
— | log value consumed by this operation. |
eventType |
dynamic |
— | eventType value consumed by this operation. |
outcome |
dynamic |
— | outcome value consumed by this operation. |
sessionId |
dynamic |
— | Identifier of session. |
principalId |
dynamic |
— | Identifier of principal. |
detail |
dynamic |
— | detail value consumed by this operation. |
const AUDIT_BACKUP = 6Defines the audit backup constant used by the minisql common diagnostics module.
const AUDIT_DCL = 4Defines the audit dcl constant used by the minisql common diagnostics module.
const AUDIT_DDL = 3Defines the audit ddl constant used by the minisql common diagnostics module.
const AUDIT_FAILURE = 0Defines the audit failure constant used by the minisql common diagnostics module.
const AUDIT_HASH_BYTES = 32Defines the audit hash bytes constant used by the minisql common diagnostics module.
const AUDIT_HEADER_BYTES = 120Defines the audit header bytes constant used by the minisql common diagnostics module.
const AUDIT_KEY_BYTES = 32Defines the audit key bytes constant used by the minisql common diagnostics module.
const AUDIT_LOGIN = 1Defines the audit login constant used by the minisql common diagnostics module.
const AUDIT_LOGOUT = 2Defines the audit logout constant used by the minisql common diagnostics module.
const AUDIT_MAINTENANCE = 5Defines the audit maintenance constant used by the minisql common diagnostics module.
const AUDIT_REPLICATION = 8Defines the audit replication constant used by the minisql common diagnostics module.
const AUDIT_RESTORE = 7Defines the audit restore constant used by the minisql common diagnostics module.
const AUDIT_ROTATION = 10Defines the audit rotation constant used by the minisql common diagnostics module.
const AUDIT_SERVER = 9Defines the audit server constant used by the minisql common diagnostics module.
const AUDIT_SUCCESS = 1Defines the audit success constant used by the minisql common diagnostics module.
const AUDIT_VERSION = 1Defines the audit version constant used by the minisql common diagnostics module.
function auditAnchorPath(databasePath)Performs the audit anchor path operation for this module. Inputs: databasePath. Returns the produced value or propagates a structured error from validation or delegated operations.
| Parameter | Type | Default | Description |
|---|---|---|---|
databasePath |
dynamic |
— | Path associated with database. |
function auditKeyPath(databasePath)Performs the audit key path operation for this module. Inputs: databasePath. Returns the produced value or propagates a structured error from validation or delegated operations.
| Parameter | Type | Default | Description |
|---|---|---|---|
databasePath |
dynamic |
— | Path associated with database. |
- minisql.common.diagnostics.AuditLog — struct
function auditMagic()Performs the audit magic operation for this module. Takes no caller-supplied inputs. Returns the produced value or propagates a structured error from validation or delegated operations.
function auditPreviousAnchorPath(databasePath)Performs the audit previous anchor path operation for this module. Inputs: databasePath. Returns the produced value or propagates a structured error from validation or delegated operations.
| Parameter | Type | Default | Description |
|---|---|---|---|
databasePath |
dynamic |
— | Path associated with database. |
function auditPreviousPath(databasePath)Performs the audit previous path operation for this module. Inputs: databasePath. Returns the produced value or propagates a structured error from validation or delegated operations.
| Parameter | Type | Default | Description |
|---|---|---|---|
databasePath |
dynamic |
— | Path associated with database. |
- minisql.common.diagnostics.AuditScan — struct
function bytesEqual(left, right)Performs the bytesEqual operation for the minisql common diagnostics module. Inputs: left, right. Returns the produced value or propagates a structured error from validation or delegated operations.
| Parameter | Type | Default | Description |
|---|---|---|---|
left |
dynamic |
— | left value consumed by this operation. |
right |
dynamic |
— | right value consumed by this operation. |
function closeAudit(log)Closes the audit. Inputs: log. Returns the operation result and propagates validation, storage, or platform errors unchanged.
| Parameter | Type | Default | Description |
|---|---|---|---|
log |
dynamic |
— | log value consumed by this operation. |
const CLOSED_HANDLE = 9008Defines the closed handle constant used by the minisql common diagnostics module.
function componentName()Performs the componentName operation for the minisql common diagnostics module. Takes no caller-supplied inputs. Returns the produced value or propagates a structured error from validation or delegated operations.
function copyExact(destination, destinationOffset, source, sourceOffset, count)Performs the copyExact operation for the minisql common diagnostics module. Inputs: destination, destinationOffset, source, sourceOffset, count. Returns the produced value or propagates a structured error from validation or delegated operations.
| Parameter | Type | Default | Description |
|---|---|---|---|
destination |
dynamic |
— | destination value consumed by this operation. |
destinationOffset |
dynamic |
— | destinationOffset 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. |
const CORRUPT_DATA = 9004Defines the corrupt data constant used by the minisql common diagnostics module.
function encodeAuditRecord(key, sequence, timestamp, eventType, outcome, sessionId, principalId, previousHash, detail)Encodes the audit record. Inputs: key, sequence, timestamp, eventType, outcome, sessionId, principalId, previousHash, detail. Returns the produced value or propagates a structured error from validation or delegated operations.
| Parameter | Type | Default | Description |
|---|---|---|---|
key |
dynamic |
— | key value consumed by this operation. |
sequence |
dynamic |
— | sequence value consumed by this operation. |
timestamp |
dynamic |
— | timestamp value consumed by this operation. |
eventType |
dynamic |
— | eventType value consumed by this operation. |
outcome |
dynamic |
— | outcome value consumed by this operation. |
sessionId |
dynamic |
— | Identifier of session. |
principalId |
dynamic |
— | Identifier of principal. |
previousHash |
dynamic |
— | previousHash value consumed by this operation. |
detail |
dynamic |
— | detail value consumed by this operation. |
function ensureAuditKey(databasePath)Ensures the audit key. Inputs: databasePath. Returns success after all invariants hold; violations are reported as structured errors.
| Parameter | Type | Default | Description |
|---|---|---|---|
databasePath |
dynamic |
— | Path associated with database. |
function ensureDirectory(path)Ensures the directory. Inputs: path. Returns success after all invariants hold; violations are reported as structured errors.
| Parameter | Type | Default | Description |
|---|---|---|---|
path |
dynamic |
— | Path of the file or directory used by the operation. |
function fail(code, operation, message)Performs the fail operation for the minisql common diagnostics module. Inputs: code, operation, message. Returns the produced value or propagates a structured error from validation or delegated operations.
| 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. |
const INVALID_ARGUMENT = 9001Tamper-evident diagnostics and audit-log storage. Each record incorporates
const IO_FAILURE = 9005Defines the io failure constant used by the minisql common diagnostics module.
function isImplemented()Returns whether implemented satisfies the condition required by the minisql common diagnostics module. Takes no caller-supplied inputs. Returns a boolean result; invalid input or delegated failures are reported as structured errors.
function make(code, severity, message)Constructs the requested value. Inputs: code, severity, message. Returns the produced value or propagates a structured error from validation or delegated operations.
| Parameter | Type | Default | Description |
|---|---|---|---|
code |
dynamic |
— | code value consumed by this operation. |
severity |
dynamic |
— | severity value consumed by this operation. |
message |
dynamic |
— | Human-readable message associated with the operation. |
const MAX_AUDIT_DETAIL_BYTES = 4096Defines the max audit detail bytes constant used by the minisql common diagnostics module.
const MAX_AUDIT_FILE_BYTES = 4294967295Audit v1 snapshots are processed through one U32-sized byte buffer. Keep the
function openAudit(databasePath)Opens the audit. Inputs: databasePath. Returns the produced value or propagates a structured error from validation or delegated operations.
| Parameter | Type | Default | Description |
|---|---|---|---|
databasePath |
dynamic |
— | Path associated with database. |
function readAuditKey(databasePath)Reads the audit key. Inputs: databasePath. Returns the produced value or propagates a structured error from validation or delegated operations.
| Parameter | Type | Default | Description |
|---|---|---|---|
databasePath |
dynamic |
— | Path associated with database. |
function readWhole(path, maximum)Reads whole for the minisql common diagnostics workflow. Inputs: path, maximum. Returns the produced value or propagates a structured error from validation or delegated operations.
| Parameter | Type | Default | Description |
|---|---|---|---|
path |
dynamic |
— | Path of the file or directory used by the operation. |
maximum |
dynamic |
— | maximum value consumed by this operation. |
function recordDigest(key, header, detailBytes)Performs the record digest operation for this module. Inputs: key, header, detailBytes. Returns the produced value or propagates a structured error from validation or delegated operations.
| Parameter | Type | Default | Description |
|---|---|---|---|
key |
dynamic |
— | key value consumed by this operation. |
header |
dynamic |
— | header value consumed by this operation. |
detailBytes |
dynamic |
— | detailBytes value consumed by this operation. |
function rotateAudit(log, databasePath, sessionId, principalId)Performs the rotate audit operation for this module. Inputs: log, databasePath, sessionId, principalId. Returns the produced value or propagates a structured error from validation or delegated operations.
| Parameter | Type | Default | Description |
|---|---|---|---|
log |
dynamic |
— | log value consumed by this operation. |
databasePath |
dynamic |
— | Path associated with database. |
sessionId |
dynamic |
— | Identifier of session. |
principalId |
dynamic |
— | Identifier of principal. |
function scanAuditBytes(source, key, expectedPreviousHash, allowTornTail)Scans the audit bytes. Inputs: source, key, expectedPreviousHash, allowTornTail. Returns the produced value or propagates a structured error from validation or delegated operations.
| Parameter | Type | Default | Description |
|---|---|---|---|
source |
dynamic |
— | source value consumed by this operation. |
key |
dynamic |
— | key value consumed by this operation. |
expectedPreviousHash |
dynamic |
— | expectedPreviousHash value consumed by this operation. |
allowTornTail |
dynamic |
— | allowTornTail value consumed by this operation. |
function scanAuditBytesFromSequence(source, key, expectedPreviousHash, expectedPreviousSequence, allowTornTail)Scans the audit bytes from sequence. Inputs: source, key, expectedPreviousHash, expectedPreviousSequence, allowTornTail. Returns the produced value or propagates a structured error from validation or delegated operations.
| Parameter | Type | Default | Description |
|---|---|---|---|
source |
dynamic |
— | source value consumed by this operation. |
key |
dynamic |
— | key value consumed by this operation. |
expectedPreviousHash |
dynamic |
— | expectedPreviousHash value consumed by this operation. |
expectedPreviousSequence |
dynamic |
— | expectedPreviousSequence value consumed by this operation. |
allowTornTail |
dynamic |
— | allowTornTail value consumed by this operation. |
function snapshotAuditBytes(log, maximum)Performs the snapshot audit bytes operation for this module. Inputs: log, maximum. Returns the produced value or propagates a structured error from validation or delegated operations.
| Parameter | Type | Default | Description |
|---|---|---|---|
log |
dynamic |
— | log value consumed by this operation. |
maximum |
dynamic |
— | maximum value consumed by this operation. |
function snapshotAuditKey(log)Performs the snapshot audit key operation for this module. Inputs: log. Returns the produced value or propagates a structured error from validation or delegated operations.
| Parameter | Type | Default | Description |
|---|---|---|---|
log |
dynamic |
— | log value consumed by this operation. |
function targetMilestone()Performs the targetMilestone operation for the minisql common diagnostics module. Takes no caller-supplied inputs. Returns the produced value or propagates a structured error from validation or delegated operations.
function validateAuditOpen(log, operation)Validates the audit open. Inputs: log, operation. Returns success after all invariants hold; violations are reported as structured errors.
| Parameter | Type | Default | Description |
|---|---|---|---|
log |
dynamic |
— | log value consumed by this operation. |
operation |
dynamic |
— | operation value consumed by this operation. |
function validateDetail(detail, operation)Validates the detail. Inputs: detail, operation. Returns success after all invariants hold; violations are reported as structured errors.
| Parameter | Type | Default | Description |
|---|---|---|---|
detail |
dynamic |
— | detail value consumed by this operation. |
operation |
dynamic |
— | operation value consumed by this operation. |
function verifyAudit(databasePath)Verifies the audit. Inputs: databasePath. Returns a boolean result; invalid input or delegated failures are reported as structured errors.
| Parameter | Type | Default | Description |
|---|---|---|---|
databasePath |
dynamic |
— | Path associated with database. |
function writeWholeDurable(path, data)Writes the whole durable. Inputs: path, data. Returns the operation result and propagates validation, storage, or platform errors unchanged.
| Parameter | Type | Default | Description |
|---|---|---|---|
path |
dynamic |
— | Path of the file or directory used by the operation. |
data |
dynamic |
— | Input data consumed by the operation. |
function zeroHash()Performs the zero hash operation for this module. Takes no caller-supplied inputs. Returns the produced value or propagates a structured error from validation or delegated operations.