pub struct LocalSecretManager {
secrets: RwLock<HashMap<u32, Vec<u8>>>,
secret_file_dir: PathBuf,
}
Fields§
§secrets: RwLock<HashMap<u32, Vec<u8>>>
§secret_file_dir: PathBuf
The local directory used to write secrets into file, so that it can be passed into some libararies
Implementations§
source§impl LocalSecretManager
impl LocalSecretManager
sourcepub fn init(temp_file_dir: String, cluster_id: String, worker_id: u32)
pub fn init(temp_file_dir: String, cluster_id: String, worker_id: u32)
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: u32, secret: Vec<u8>)
pub fn init_secrets(&self, secrets: Vec<PbSecret>)
pub fn get_secret(&self, secret_id: u32) -> Option<Vec<u8>>
pub fn remove_secret(&self, secret_id: u32)
pub fn fill_secrets( &self, options: BTreeMap<String, String>, secret_refs: BTreeMap<String, PbSecretRef>, ) -> SecretResult<BTreeMap<String, String>>
sourcefn get_or_init_secret_file(
&self,
secret_id: u32,
secret_bytes: Vec<u8>,
) -> SecretResult<String>
fn get_or_init_secret_file( &self, secret_id: u32, 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: &u32)
fn remove_secret_file_if_exist(&self, secret_id: &u32)
WARNING: This method should be called only when the secret manager is locked.
fn get_secret_value(pb_secret_bytes: &[u8]) -> SecretResult<Vec<u8>>
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> 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> 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