Struct iota_stronghold::Stronghold [−][src]
pub struct Stronghold { pub system: ActorSystem, // some fields omitted }
The main type for the Stronghold System. Used as the entry point for the actor model. Contains various pieces of metadata to interpret the data in the vault and store.
Fields
system: ActorSystem
Implementations
impl Stronghold
[src]
pub fn init_stronghold_system(
system: ActorSystem,
client_path: Vec<u8>,
_options: Vec<StrongholdFlags>
) -> Self
[src]
system: ActorSystem,
client_path: Vec<u8>,
_options: Vec<StrongholdFlags>
) -> Self
Initializes a new instance of the system. Sets up the first client actor. Accepts a ActorSystem
, the first
client_path: Vec<u8>
and any StrongholdFlags
which pertain to the first actor.
pub async fn spawn_stronghold_actor(
&mut self,
client_path: Vec<u8>,
_options: Vec<StrongholdFlags>
) -> StatusMessage
[src]
&mut self,
client_path: Vec<u8>,
_options: Vec<StrongholdFlags>
) -> StatusMessage
Spawns a new set of actors for the Stronghold system. Accepts the client_path: Vec<u8>
and the options:
StrongholdFlags
pub async fn switch_actor_target(
&mut self,
client_path: Vec<u8>
) -> StatusMessage
[src]
&mut self,
client_path: Vec<u8>
) -> StatusMessage
Switches the actor target to another actor in the system specified by the client_path: Vec<u8>
.
pub async fn write_to_vault(
&self,
location: Location,
payload: Vec<u8>,
hint: RecordHint,
_options: Vec<VaultFlags>
) -> StatusMessage
[src]
&self,
location: Location,
payload: Vec<u8>,
hint: RecordHint,
_options: Vec<VaultFlags>
) -> StatusMessage
Writes data into the Stronghold. Uses the current target actor as the client and writes to the specified
location of Location
type. The payload must be specified as a Vec<u8>
and a RecordHint
can be provided.
Also accepts VaultFlags
for when a new Vault is created.
pub async fn write_to_store(
&self,
location: Location,
payload: Vec<u8>,
lifetime: Option<Duration>
) -> StatusMessage
[src]
&self,
location: Location,
payload: Vec<u8>,
lifetime: Option<Duration>
) -> StatusMessage
Writes data into an insecure cache. This method, accepts a Location
, a Vec<u8>
and an optional Duration
.
The lifetime allows the data to be deleted after the specified duration has passed. If not lifetime is
specified, the data will persist until it is manually deleted or over-written. Note: One store is mapped to
one client. Can specify the same location across multiple clients.
pub async fn read_from_store(
&self,
location: Location
) -> (Vec<u8>, StatusMessage)
[src]
&self,
location: Location
) -> (Vec<u8>, StatusMessage)
A method that reads from an insecure cache. This method, accepts a Location
and returns the payload in the
form of a Vec<u8>
. If the location does not exist, an empty vector will be returned along with an error
StatusMessage
. Note: One store is mapped to
one client. Can specify the same location across multiple clients.
pub async fn delete_from_store(&self, location: Location) -> StatusMessage
[src]
A method to delete data from an insecure cache. This method, accepts a Location
and returns a StatusMessage
.
Note: One store is mapped to one client. Can specify the same location across multiple clients.
pub async fn delete_data(
&self,
location: Location,
should_gc: bool
) -> StatusMessage
[src]
&self,
location: Location,
should_gc: bool
) -> StatusMessage
Revokes the data from the specified location of type Location
. Revoked data is not readable and can be removed
from a vault with a call to garbage_collect
. if the should_gc
flag is set to true
, this call with
automatically cleanup the revoke. Otherwise, the data is just marked as revoked.
pub async fn garbage_collect(&self, vault_path: Vec<u8>) -> StatusMessage
[src]
Garbage collects any revokes in a Vault based on the given vault_path and the current target actor.
pub async fn list_hints_and_ids<V: Into<Vec<u8>>>(
&self,
vault_path: V
) -> (Vec<(RecordId, RecordHint)>, StatusMessage)
[src]
&self,
vault_path: V
) -> (Vec<(RecordId, RecordHint)>, StatusMessage)
Returns a list of the available records and their RecordHint
values in a vault by the given vault_path.
Records are returned as usize
based on their index if they are written with counter Locations
. Generic
Locations
will not return a readable index.
pub async fn runtime_exec(&self, control_request: Procedure) -> ProcResult
[src]
Executes a runtime command given a Procedure
. Returns a ProcResult
based off of the control_request
specified.
pub async fn record_exists(&self, location: Location) -> bool
[src]
Checks whether a record exists in the client.
pub async fn vault_exists(&self, location: Location) -> bool
[src]
checks whether a vault exists in the client.
pub async fn read_snapshot<T: Zeroize + AsRef<Vec<u8>>>(
&mut self,
client_path: Vec<u8>,
former_client_path: Option<Vec<u8>>,
keydata: &T,
filename: Option<String>,
path: Option<PathBuf>
) -> StatusMessage
[src]
&mut self,
client_path: Vec<u8>,
former_client_path: Option<Vec<u8>>,
keydata: &T,
filename: Option<String>,
path: Option<PathBuf>
) -> StatusMessage
Reads data from a given snapshot file. Can only read the data for a single client_path
at a time. If the new
actor uses a new client_path
the former client path may be passed into the function call to read the data into
that actor. Also requires keydata to unlock the snapshot. A filename and filepath can be specified. The Keydata
should implement and use Zeroize.
pub async fn write_all_to_snapshot<T: Zeroize + AsRef<Vec<u8>>>(
&mut self,
keydata: &T,
filename: Option<String>,
path: Option<PathBuf>
) -> StatusMessage
[src]
&mut self,
keydata: &T,
filename: Option<String>,
path: Option<PathBuf>
) -> StatusMessage
Writes the entire state of the Stronghold
into a snapshot. All Actors and their associated data will be
written into the specified snapshot. Requires keydata to encrypt the snapshot and a filename and path can be
specified. The Keydata should implement and use Zeroize.
pub async fn kill_stronghold(
&mut self,
client_path: Vec<u8>,
kill_actor: bool
) -> StatusMessage
[src]
&mut self,
client_path: Vec<u8>,
kill_actor: bool
) -> StatusMessage
Used to kill a stronghold actor or clear the cache of the given actor system based on the client_path. If
kill_actor
is true
both the internal actor and the client actor will be killed. Otherwise, the cache of the
current target actor will be cleared.
Auto Trait Implementations
impl !RefUnwindSafe for Stronghold
impl Send for Stronghold
impl Sync for Stronghold
impl Unpin for Stronghold
impl !UnwindSafe for Stronghold
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,