pub struct LocalSecretManager {
secrets: RwLock<HashMap<SecretId, Vec<u8>>>,
secret_file_dir: PathBuf,
}Fields§
§secrets: RwLock<HashMap<SecretId, Vec<u8>>>§secret_file_dir: PathBufThe local directory used to write secrets into file, so that it can be passed into some libraries
Implementations§
Source§impl LocalSecretManager
impl LocalSecretManager
Sourcepub fn init(temp_file_dir: String, cluster_id: String, worker_id: WorkerId)
pub fn init(temp_file_dir: String, cluster_id: String, worker_id: WorkerId)
Initialize the secret manager with the given temp file path, cluster id, and encryption key.
§Panics
Panics if fail to create the secret file directory.
Sourcepub fn global() -> &'static LocalSecretManager
pub fn global() -> &'static LocalSecretManager
pub fn add_secret(&self, secret_id: SecretId, secret: Vec<u8>)
pub fn update_secret(&self, secret_id: SecretId, secret: Vec<u8>)
pub fn init_secrets(&self, secrets: Vec<PbSecret>)
pub fn get_secret(&self, secret_id: SecretId) -> Option<Vec<u8>>
pub fn remove_secret(&self, secret_id: SecretId)
pub fn fill_secrets( &self, options: BTreeMap<String, String>, secret_refs: BTreeMap<String, PbSecretRef>, ) -> SecretResult<BTreeMap<String, String>>
pub fn fill_secret(&self, secret_ref: PbSecretRef) -> SecretResult<String>
fn fill_secret_inner( &self, secret_ref: PbSecretRef, secret_guard: &RwLockReadGuard<'_, RawRwLock, HashMap<SecretId, Vec<u8>>>, ) -> SecretResult<String>
Sourcefn get_or_init_secret_file(
&self,
secret_id: SecretId,
secret_bytes: Vec<u8>,
) -> SecretResult<String>
fn get_or_init_secret_file( &self, secret_id: SecretId, secret_bytes: Vec<u8>, ) -> SecretResult<String>
Get the secret file for the given secret id and return the path string. If the file does not exist, create it. WARNING: This method should be called only when the secret manager is locked.
Sourcefn remove_secret_file_if_exist(&self, secret_id: &SecretId)
fn remove_secret_file_if_exist(&self, secret_id: &SecretId)
WARNING: This method should be called only when the secret manager is locked.
fn get_secret_value(pb_secret_bytes: &[u8]) -> SecretResult<Vec<u8>>
Sourcepub fn get_pb_secret_backend(
pb_secret_bytes: &[u8],
) -> SecretResult<SecretBackend>
pub fn get_pb_secret_backend( pb_secret_bytes: &[u8], ) -> SecretResult<SecretBackend>
Get the secret backend from the given decrypted secret bytes.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for LocalSecretManager
impl !RefUnwindSafe for LocalSecretManager
impl Send for LocalSecretManager
impl Sync for LocalSecretManager
impl Unpin for LocalSecretManager
impl UnwindSafe for LocalSecretManager
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
§impl<T> Downcast for Twhere
T: AsAny + ?Sized,
impl<T> Downcast for Twhere
T: AsAny + ?Sized,
§fn downcast_ref<T>(&self) -> Option<&T>where
T: AsAny,
fn downcast_ref<T>(&self) -> Option<&T>where
T: AsAny,
Forward to the method defined on the type
Any.§fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: AsAny,
fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: AsAny,
Forward to the method defined on the type
Any.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
Converts
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>
Converts
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request