pub struct BeekeeperApi { /* private fields */ }Expand description
Root handle for the Beekeeper wallet daemon.
A single BeekeeperApi owns one C++ wallet manager and zero or more
sessions; each session in turn owns zero or more wallets.
Use BeekeeperApi::new to construct and
create_session to obtain an owned
Session guard for further work.
Implementations§
Source§impl BeekeeperApi
impl BeekeeperApi
Sourcepub fn new(options: impl Into<Option<BeekeeperOptions>>) -> Self
pub fn new(options: impl Into<Option<BeekeeperOptions>>) -> Self
Construct a new beekeeper instance.
Accepts anything convertible into Option<BeekeeperOptions>:
pass a BeekeeperOptions value directly, or None to use
BeekeeperOptions::default().
When the options are not in-memory this also creates
<storage_root>/.beekeeper/ (if missing) for wallet files.
Sourcepub fn create_session(&self) -> Result<Session, BeekeeperError>
pub fn create_session(&self) -> Result<Session, BeekeeperError>
Open a new session and return it as an owned
Session guard.
The session closes itself (locking its wallets first) when dropped;
there is no explicit close call.
Sourcepub fn delete(&self) -> Result<(), BeekeeperError>
pub fn delete(&self) -> Result<(), BeekeeperError>
Close every session, flush storage, and shut the C++ holder down.
Named after the TS delete() API; there is no Rust destructor work
behind it. Calling it is useful when you want the storage flushed
deterministically before the process exits.
Any Session guard still alive is closed
here; its later Drop becomes a no-op. After calling delete the
C++ storage handle has been closed; further operations will fail.
Sourcepub fn refresh_timeout(&self)
pub fn refresh_timeout(&self)
Reset the inactivity clock to now.
Used internally after every successful unlocked-wallet operation. Call manually only if you have some other notion of activity to keep the wallet alive.
Sourcepub fn throw_if_timed_out_and_refresh(&self) -> Result<(), BeekeeperError>
pub fn throw_if_timed_out_and_refresh(&self) -> Result<(), BeekeeperError>
If the inactivity timeout has elapsed, return BeekeeperError::TimedOut.
Otherwise reset the clock.
Every UnlockedWallet operation
calls this as its first step.
Sourcepub fn is_timed_out(&self) -> bool
pub fn is_timed_out(&self) -> bool
true if the inactivity timeout is enabled and has elapsed.
unlock_timeout == 0 permanently returns false.
Sourcepub fn get_timeout_time(&self) -> SystemTime
pub fn get_timeout_time(&self) -> SystemTime
Wall-clock instant at which the wallet will auto-lock.
When the timeout is disabled this returns a far-future sentinel: the UNIX epoch plus 100 years (≈ year 2069).
Sourcepub fn list_created_wallets(&self) -> Vec<String>
pub fn list_created_wallets(&self) -> Vec<String>
Names of every wallet found in the storage directory.
Returns [] in in-memory mode, since there is nothing to scan. The
names are derived from filenames by stripping the .wallet suffix;
other files in the directory are ignored.