pub struct AtomicFileWriteGuard<'a, T> { /* private fields */ }

Implementations§

source§

impl<'a, T: Serialize> AtomicFileWriteGuard<'a, T>

source

pub fn save(&mut self) -> Result<()>

Saves the current value of T to the file.

If another process calls save concurrently, then one will block waiting for the other to finish. Note that in this case one process will overwrite the value written by the other, but whichever value is contained in the file after both have finished is internally consistent.

Trait Implementations§

source§

impl<'a, T> Deref for AtomicFileWriteGuard<'a, T>

§

type Target = T

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl<'a, T> DerefMut for AtomicFileWriteGuard<'a, T>

source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.

Auto Trait Implementations§

§

impl<'a, T> RefUnwindSafe for AtomicFileWriteGuard<'a, T>where T: RefUnwindSafe,

§

impl<'a, T> !Send for AtomicFileWriteGuard<'a, T>

§

impl<'a, T> Sync for AtomicFileWriteGuard<'a, T>where T: Sync,

§

impl<'a, T> Unpin for AtomicFileWriteGuard<'a, T>

§

impl<'a, T> UnwindSafe for AtomicFileWriteGuard<'a, T>where T: RefUnwindSafe,

Blanket Implementations§

§

impl<T, A, P> Access<T> for Pwhere A: Access<T>, P: Deref<Target = A>,

§

type Guard = <A as Access<T>>::Guard

A guard object containing the value and keeping it alive. Read more
§

fn load(&self) -> <P as Access<T>>::Guard

The loading method. Read more
source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T, P> CredStore for Pwhere T: CredStore + ?Sized, P: Deref<Target = T>,

§

type CredHandle = <T as CredStore>::CredHandle

The type of the credential handle returned by this store.
§

type ExportedCreds = <T as CredStore>::ExportedCreds

The type of the exported credentials returned by this store.
source§

fn node_creds(&self) -> Result<<P as CredStore>::CredHandle, Error>

Returns the node credentials. If credentials haven’t been generated, they are generated stored and returned.
source§

fn root_creds( &self, password: &str ) -> Result<<P as CredStore>::CredHandle, Error>

Returns the root credentials. If no root credentials have been generated, or the provided password is incorrect, then an error is returned.
source§

fn storage_key(&self) -> Result<AsymKey<Public, Encrypt>, Error>

Returns a public key which can be used to encrypt data intended only to be accessed by this node. The returned key can be given as the new_parent parameter to the CredStore::export_root_creds method.
source§

fn export_root_creds( &self, root_creds: &<P as CredStore>::CredHandle, password: &str, new_parent: &AsymKey<Public, Encrypt> ) -> Result<<P as CredStore>::ExportedCreds, Error>

Exports the root credentials. These can be serialized and persisted external to the application and later loaded and deserialized and passed to the CredStoreMut::import_root_creds method. The password argument must match the value provided when the CredStore::root_creds method was called. The new_parent argument is the public key of the node that is to import the root key, which can be obtained using the CredStoreMut::gen_root_creds method on the importing node.
source§

impl<T, P> CredStoreMut for Pwhere T: CredStoreMut + ?Sized, P: Deref<Target = T>,

source§

fn gen_root_creds( &self, password: &str ) -> Result<<T as CredStore>::CredHandle, Error>

Generates the root credentials and protects them using the given password. If the root credentials have already been generated then an error is returned.
source§

fn import_root_creds( &self, password: &str, exported: <P as CredStore>::ExportedCreds ) -> Result<<P as CredStore>::CredHandle, Error>

Imports root credentials that were previously created with CredStore::export_root_creds. The provided password must match the value that was given to that method.
source§

fn assign_node_writecap( &self, handle: &mut <P as CredStore>::CredHandle, writecap: Writecap ) -> Result<(), Error>

Assigns the given Writecap to the node credentials referred to by the given handle. This method is responsible for committing the given Writecap to durable storage.
source§

fn assign_root_writecap( &self, handle: &mut <P as CredStore>::CredHandle, writecap: Writecap ) -> Result<(), Error>

Assigns writecap to the root credentials referred to by handle. This method is responsible for committing the given Writecap to durable storage.
source§

fn provision_root( &self, password: &str, expires: Epoch ) -> Result<Self::CredHandle>

Generates new root credentials protected by password and issues them a self-signed Writecap which expires after valid_for. The newly generated root credentials are returned.
source§

fn provision_node_start(&self) -> Result<Principal>

Begin the provisioning process for a node by generating a new set of node credentials. The Principal of the newly generated credentials is returned. This Principal may then be transmitted to a root node which can use it to issue a Writecap to this node.
source§

fn provision_node_finish(&self, writecap: Writecap) -> Result<Self::CredHandle>

Assigns the given Writecap to the node credentials and commits it to durable storage. A handle to the node credentials is returned.
source§

impl<T, P> Decrypter for Pwhere T: Decrypter + ?Sized, P: Deref<Target = T>,

source§

fn decrypt(&self, slice: &[u8]) -> Result<Vec<u8, Global>, Error>

source§

impl<T> DecrypterExt for Twhere T: Decrypter + ?Sized,

§

impl<T, A> DynAccess<T> for Awhere A: Access<T>, <A as Access<T>>::Guard: 'static,

§

fn load(&self) -> DynGuard<T>

The equivalent of [Access::load].
source§

impl<T, P> Encrypter for Pwhere T: Encrypter + ?Sized, P: Deref<Target = T>,

source§

fn encrypt(&self, slice: &[u8]) -> Result<Vec<u8, Global>, Error>

source§

impl<T> EncrypterExt for Twhere T: Encrypter + ?Sized,

source§

fn ser_encrypt<T: Serialize>(&self, value: &T) -> Result<Ciphertext<T>>

Serializes the given value into a new vector, then encrypts it and returns the resulting ciphertext.
§

impl<T> Free for T

§

unsafe default fn free(ptr_ref: NonNull<T>)

Drops the content pointed by this pointer and frees it. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, P> Op for Pwhere T: Op + ?Sized, P: DerefMut<Target = T>,

source§

fn update(&mut self, data: &[u8]) -> Result<(), Error>

Update this operation using the given data.
source§

fn finish_into(&mut self, buf: &mut [u8]) -> Result<usize, Error>

Finish this operation and write the result into the given buffer. If the given buffer is not large enough the implementation must return Error::IncorrectSize.
source§

impl<T, P> Principaled for Pwhere T: Principaled + ?Sized, P: Deref<Target = T>,

source§

fn principal_of_kind(&self, kind: HashKind) -> Principal

Returns the Principal that owns self, using the given hash algorithm.
source§

fn principal(&self) -> Principal

Returns the Principal that owns self, using the default hash algorithm.
source§

impl<T, P> SignOp for Pwhere T: SignOp + ?Sized, P: DerefMut<Target = T>,

source§

fn scheme(&self) -> Sign

Returns the signature scheme that this operation is using.
source§

fn finish(&mut self) -> Result<Signature>

Finishes this signature operation and returns a new signature containing the result.
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T, P> VerifyOp for Pwhere T: VerifyOp + ?Sized, P: DerefMut<Target = T>,

source§

fn update(&mut self, data: &[u8]) -> Result<(), Error>

source§

fn finish(&mut self, sig: &[u8]) -> Result<(), Error>

source§

fn scheme(&self) -> Sign