Skip to main content

Vault

Trait Vault 

Source
pub trait Vault: Send + Sync {
    // Required methods
    fn get_or_create(
        &self,
        scope: &ScopeId,
        kind: &EntityKind,
        value: &str,
    ) -> Result<u64, VaultError>;
    fn lookup(
        &self,
        scope: &ScopeId,
        kind: &EntityKind,
        n: u64,
    ) -> Result<Option<String>, VaultError>;
    fn reserve(
        &self,
        scope: &ScopeId,
        kind: &EntityKind,
        n: u64,
    ) -> Result<(), VaultError>;
}
Expand description

Where the engine keeps which value each placeholder stands for.

These are the only three operations redaction and restoration need. Storage, expiry and admin operations belong to the implementation; the veil-vault crate has an encrypted one on disk.

Required Methods§

Source

fn get_or_create( &self, scope: &ScopeId, kind: &EntityKind, value: &str, ) -> Result<u64, VaultError>

Returns the placeholder number for value, creating one if needed. The same value of the same kind in the same scope always gets the same number.

Source

fn lookup( &self, scope: &ScopeId, kind: &EntityKind, n: u64, ) -> Result<Option<String>, VaultError>

Returns the value behind placeholder number n, if this scope knows it.

Source

fn reserve( &self, scope: &ScopeId, kind: &EntityKind, n: u64, ) -> Result<(), VaultError>

Makes sure number n is never handed out for a new value. Used for placeholder-shaped text the user wrote themselves.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§