Documentation
¶
Overview ¶
Package memless bridges the memless C ABI through purego, without cgo.
The cdylib is found, in this order, through MEMLESS_LIB, a trusted (ideally absolute) path; the library a released module bundles for this platform, extracted once into the user cache directory and checked against its SHA-256 before every load; or, inside a checked-out workspace, under target/release then target/debug. MEMLESS_LIB loads arbitrary native code, like any FFI library path.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FaultError ¶
FaultError is a boundary or internal fault (InvalidArgument or Internal), not a file refusal. errors.As tells it apart from a RefusalError.
func (*FaultError) Error ¶
func (e *FaultError) Error() string
type Instance ¶
type Instance struct {
// contains filtered or unexported fields
}
Instance is a live memless instance behind an opaque handle.
func Load ¶
Load loads the file at path. It returns a RefusalError when the file is refused, and a FaultError on a boundary or internal fault. No instance is returned on any error.
func (*Instance) Begin ¶
Begin opens a transaction on the instance. Writes then apply to a working state the file does not yet reflect, and a query sees them. A second Begin returns a RefusalError.
func (*Instance) Commit ¶
Commit validates the open transaction and rewrites the file once when the working state differs. With no open transaction it returns a RefusalError; a failed validation leaves memory and the file at the before-state.
func (*Instance) Execute ¶
Execute runs a write sql against the instance and returns the affected row count. It returns a RefusalError on a validation or disk failure, and a FaultError on a boundary or internal fault.
func (*Instance) Query ¶
Query runs sql against the instance and returns its rows. It returns a RefusalError when the query is refused, and a FaultError on a boundary or internal fault. The result is read and released before returning.
func (*Instance) Release ¶
func (i *Instance) Release()
Release releases the instance once. A second call, a zero-value instance, or an unknown handle is ignored.
func (*Instance) Reload ¶
Reload re-reads the file the instance was loaded on and replaces the in-memory state with it, exactly as Load would build it. It returns a RefusalError while a transaction is open, or when the file would be refused by Load; the instance's state is left intact either way and stays usable.
type RefusalError ¶
type RefusalError struct {
Message string
}
RefusalError carries the domain message verbatim (D13); errors.As tells it apart from a boundary fault.
func (*RefusalError) Error ¶
func (e *RefusalError) Error() string
Source Files
¶
- atomic_write.go
- bundle_for.go
- cache_dir.go
- cached_copy.go
- cell.go
- cstring.go
- current_plan.go
- detect_libc.go
- doc.go
- embed_linux_amd64.go
- embedded_library.go
- execute.go
- fault_error.go
- ffi.go
- file_exists.go
- interpret.go
- libc_from_ldd.go
- libc_from_loaders.go
- library_plan.go
- memless.go
- module_version.go
- path.go
- platform_library.go
- query.go
- refusal_error.go
- reload.go
- resolve.go
- rows.go
- same_content.go
- transaction.go
- write_and_close.go