pub struct Oliphaunt { /* private fields */ }Expand description
Primary entry point for interacting with the embedded Postgres runtime.
Implementations§
Source§impl Oliphaunt
impl Oliphaunt
Sourcepub fn builder() -> OliphauntBuilder
pub fn builder() -> OliphauntBuilder
Create a builder for opening persistent or temporary Oliphaunt databases.
Sourcepub fn open(root: impl AsRef<Path>) -> Result<Self>
pub fn open(root: impl AsRef<Path>) -> Result<Self>
Open a persistent Oliphaunt database rooted at root, installing and initializing it if needed.
Sourcepub fn open_app(app_id: (&str, &str, &str)) -> Result<Self>
pub fn open_app(app_id: (&str, &str, &str)) -> Result<Self>
Open a persistent Oliphaunt database under the platform data directory for app_id.
Sourcepub fn temporary() -> Result<Self>
pub fn temporary() -> Result<Self>
Create an ephemeral Oliphaunt database whose files are removed when the instance is dropped.
Sourcepub fn preload() -> Result<()>
pub fn preload() -> Result<()>
Warm the runtime module and bundled AOT artifact cache without opening a database.
Sourcepub fn refresh_array_types(&mut self) -> Result<()>
pub fn refresh_array_types(&mut self) -> Result<()>
Refresh direct API array parser and serializer registrations.
This mirrors upstream Oliphaunt’s refreshArrayTypes() escape hatch. Most
applications should not need it because built-in arrays are registered
statically and runtime custom arrays are discovered lazily when possible.
Sourcepub fn query(
&mut self,
sql: &str,
params: &[Value],
options: Option<&QueryOptions>,
) -> Result<Results>
pub fn query( &mut self, sql: &str, params: &[Value], options: Option<&QueryOptions>, ) -> Result<Results>
Execute a SQL query using the extended protocol.
Sourcepub fn engine_capabilities(&self) -> EngineCapabilities
pub fn engine_capabilities(&self) -> EngineCapabilities
Return the capabilities of the active embedded engine.
Sourcepub fn dump_data_dir(&mut self) -> Result<Vec<u8>>
pub fn dump_data_dir(&mut self) -> Result<Vec<u8>>
Dump the physical PGDATA directory to a gzipped tar archive.
The archive is intended to be loaded back into oliphaunt-wasix/Oliphaunt with
the same PostgreSQL/Oliphaunt version. Use dump_sql for
logical backups across versions.
Sourcepub fn dump_data_dir_with_format(
&mut self,
format: DataDirArchiveFormat,
) -> Result<Vec<u8>>
pub fn dump_data_dir_with_format( &mut self, format: DataDirArchiveFormat, ) -> Result<Vec<u8>>
Dump the physical PGDATA directory with the selected archive format.
Sourcepub fn try_clone(&mut self) -> Result<Self>
pub fn try_clone(&mut self) -> Result<Self>
Clone this database into a new temporary Oliphaunt instance.
Sourcepub fn exec(
&mut self,
sql: &str,
options: Option<&QueryOptions>,
) -> Result<Vec<Results>>
pub fn exec( &mut self, sql: &str, options: Option<&QueryOptions>, ) -> Result<Vec<Results>>
Execute a simple SQL statement that may contain multiple commands.
Sourcepub fn listen<F>(
&mut self,
channel: &str,
callback: F,
) -> Result<ListenerHandle>
pub fn listen<F>( &mut self, channel: &str, callback: F, ) -> Result<ListenerHandle>
Register a listener for LISTEN channel. Returns a handle that can be used to unlisten.
Sourcepub fn unlisten(&mut self, handle: ListenerHandle) -> Result<()>
pub fn unlisten(&mut self, handle: ListenerHandle) -> Result<()>
Remove a listener corresponding to the provided handle.
Sourcepub fn unlisten_channel(&mut self, channel: &str) -> Result<()>
pub fn unlisten_channel(&mut self, channel: &str) -> Result<()>
Remove all listeners for the specified channel.
Sourcepub fn on_notification<F>(&mut self, callback: F) -> GlobalListenerHandle
pub fn on_notification<F>(&mut self, callback: F) -> GlobalListenerHandle
Register a global notification callback.
Sourcepub fn off_notification(&mut self, handle: GlobalListenerHandle)
pub fn off_notification(&mut self, handle: GlobalListenerHandle)
Deregister a previously registered global notification callback.
Sourcepub fn describe_query(
&mut self,
sql: &str,
options: Option<&QueryOptions>,
) -> Result<DescribeQueryResult>
pub fn describe_query( &mut self, sql: &str, options: Option<&QueryOptions>, ) -> Result<DescribeQueryResult>
Describe the parameter and result metadata for a SQL query.
Sourcepub fn transaction<F, T>(&mut self, callback: F) -> Result<T>
pub fn transaction<F, T>(&mut self, callback: F) -> Result<T>
Run a closure within an SQL transaction (BEGIN .. COMMIT/ROLLBACK).
Sourcepub fn sync_to_fs(&mut self) -> Result<()>
pub fn sync_to_fs(&mut self) -> Result<()>
Flush runtime writes to the underlying filesystem.
The WASIX backend uses host-mounted files and PostgreSQL’s own fsync/WAL
behavior for durability. Adding an unconditional host directory
sync_all after every direct query is both expensive and weaker than the
database’s file-level fsyncs, so the Rust-level hook remains a no-op.
Sourcepub fn exec_protocol(
&mut self,
message: &[u8],
options: ExecProtocolOptions,
) -> Result<ExecProtocolResult>
pub fn exec_protocol( &mut self, message: &[u8], options: ExecProtocolOptions, ) -> Result<ExecProtocolResult>
Execute raw PostgreSQL frontend protocol bytes and parse backend protocol messages.
Sourcepub fn exec_protocol_raw(
&mut self,
message: &[u8],
options: ExecProtocolOptions,
) -> Result<Vec<u8>>
pub fn exec_protocol_raw( &mut self, message: &[u8], options: ExecProtocolOptions, ) -> Result<Vec<u8>>
Execute raw PostgreSQL frontend protocol bytes and return raw backend protocol bytes.
Sourcepub fn exec_protocol_raw_stream<F>(
&mut self,
message: &[u8],
options: ExecProtocolOptions,
on_data: F,
) -> Result<()>
pub fn exec_protocol_raw_stream<F>( &mut self, message: &[u8], options: ExecProtocolOptions, on_data: F, ) -> Result<()>
Execute raw protocol bytes and pass the returned backend bytes to
on_data.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Oliphaunt
impl !Send for Oliphaunt
impl !Sync for Oliphaunt
impl !UnwindSafe for Oliphaunt
impl Freeze for Oliphaunt
impl Unpin for Oliphaunt
impl UnsafeUnpin for Oliphaunt
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.