Struct pravega_client::sync::synchronizer::Update
source · pub struct Update { /* private fields */ }
Expand description
The Update contains a nested map and a version map, which are the same map in synchronizer but will be updated instantly when caller calls Insert or Remove method. It is used to update the server side of table and its updates will be applied to synchronizer once the updates are successfully stored on the server side.
Implementations§
source§impl Update
impl Update
pub fn new( map: HashMap<String, HashMap<String, Value>>, map_version: HashMap<String, Value>, insert: Vec<Insert>, remove: Vec<Remove> ) -> Self
sourcepub fn insert(
&mut self,
outer_key: String,
inner_key: String,
type_id: String,
new_value: Box<dyn ValueData>
)
pub fn insert( &mut self, outer_key: String, inner_key: String, type_id: String, new_value: Box<dyn ValueData> )
insert method needs an outer_key and an inner_key to find a value. It will update the map inside the Table.
sourcepub fn insert_tombstone(
&mut self,
outer_key: String,
inner_key: String
) -> Result<(), SynchronizerError>
pub fn insert_tombstone( &mut self, outer_key: String, inner_key: String ) -> Result<(), SynchronizerError>
insert_tombstone method replaces the original value with a tombstone, which means that this key value pair is invalid and will be removed later. The reason of adding a tombstone is to guarantee the atomicity of a remove-and-insert operation.
sourcepub fn retain(&mut self, outer_key: String)
pub fn retain(&mut self, outer_key: String)
retain a specific map to make sure it’s not altered by other processes when an update is being made that depends on it. Notice that this method only needs to be called when this dependent map is not being updated, since any modifications to a map on server side will use a version to make sure the update is based on the latest change.
sourcepub fn get(&self, outer_key: &str, inner_key: &str) -> Option<&Value>
pub fn get(&self, outer_key: &str, inner_key: &str) -> Option<&Value>
get method will take an outer_key and an inner_key and return the valid value. It will not return value hinted by tombstone.
sourcepub fn get_inner_map(&self, outer_key: &str) -> HashMap<String, Value>
pub fn get_inner_map(&self, outer_key: &str) -> HashMap<String, Value>
get_inner_map method will take an outer_key return the outer map. The returned outer map will not contain value hinted by tombstone.
sourcepub fn contains_key(&self, outer_key: &str, inner_key: &str) -> bool
pub fn contains_key(&self, outer_key: &str, inner_key: &str) -> bool
Check if an inner key exists. The tombstoned value will return a false.
sourcepub fn contains_outer_key(&self, outer_key: &str) -> bool
pub fn contains_outer_key(&self, outer_key: &str) -> bool
Check if an outer_key exists. The tombstoned value will return a false.
pub fn is_empty(&self) -> bool
Auto Trait Implementations§
impl Freeze for Update
impl RefUnwindSafe for Update
impl Send for Update
impl Sync for Update
impl Unpin for Update
impl UnwindSafe for Update
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
§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> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§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>
T
in a tonic::Request