Trait usiem::components::common::SiemComponentStateStorage
source · pub trait SiemComponentStateStorage: DynClone + Send {
fn get_value(&self, key: Cow<'static, str>) -> Result<String, StorageError>;
fn set_value(
&mut self,
key: Cow<'static, str>,
value: String,
replace: bool
) -> Result<(), StorageError>;
fn get_file(&self, filepath: String) -> Result<Vec<u8>, StorageError>;
fn get_file_size(&self, filepath: String) -> Result<u64, StorageError>;
fn get_file_range(
&self,
filepath: String,
start: u64,
end: u64
) -> Result<Vec<u8>, StorageError>;
fn set_file(
&mut self,
filepath: String,
content: Vec<u8>
) -> Result<(), StorageError>;
fn set_file_range(
&mut self,
filepath: String,
content: Vec<u8>,
start: u64,
end: u64
) -> Result<(), StorageError>;
fn duplicate(&self) -> Box<dyn SiemComponentStateStorage>;
}
Required Methods
sourcefn get_value(&self, key: Cow<'static, str>) -> Result<String, StorageError>
fn get_value(&self, key: Cow<'static, str>) -> Result<String, StorageError>
Read a key value from the database
sourcefn set_value(
&mut self,
key: Cow<'static, str>,
value: String,
replace: bool
) -> Result<(), StorageError>
fn set_value(
&mut self,
key: Cow<'static, str>,
value: String,
replace: bool
) -> Result<(), StorageError>
Write to the database a key/value pair
sourcefn get_file_size(&self, filepath: String) -> Result<u64, StorageError>
fn get_file_size(&self, filepath: String) -> Result<u64, StorageError>
Get the size of a file
sourcefn get_file_range(
&self,
filepath: String,
start: u64,
end: u64
) -> Result<Vec<u8>, StorageError>
fn get_file_range(
&self,
filepath: String,
start: u64,
end: u64
) -> Result<Vec<u8>, StorageError>
Get a file part
sourcefn set_file(
&mut self,
filepath: String,
content: Vec<u8>
) -> Result<(), StorageError>
fn set_file(
&mut self,
filepath: String,
content: Vec<u8>
) -> Result<(), StorageError>
Sets the content of a file
sourcefn set_file_range(
&mut self,
filepath: String,
content: Vec<u8>,
start: u64,
end: u64
) -> Result<(), StorageError>
fn set_file_range(
&mut self,
filepath: String,
content: Vec<u8>,
start: u64,
end: u64
) -> Result<(), StorageError>
Sets the content of a file