Struct optra::InsertOperation
[−]
[src]
pub struct InsertOperation { /* fields omitted */ }
Represents an operation which inserts data into a file
Methods
impl InsertOperation
[src]
fn new(
position: u64,
value: Vec<u8>,
timestamp: u32,
site_id: u32
) -> InsertOperation
position: u64,
value: Vec<u8>,
timestamp: u32,
site_id: u32
) -> InsertOperation
Creates a new InsertOperation
that will insert the bytes represented by value
in a file at location position
fn get_value(&self) -> &[u8]
Gets the bytes that will be inserted when this operation is applied
fn compress_to<W: Write>(
&self,
writer: &mut W,
include_site_id: bool
) -> Result<()>
&self,
writer: &mut W,
include_site_id: bool
) -> Result<()>
Compress this operation and write to writer
. The output can then be expanded
back into an equivilent operation using expand_from()
. If include_site_id
is set to true
Then the site id is saved alongside everyhting else. If this is the case, then when expanding
a timestamp lookup should not be passed in.
fn expand_from<R: Read>(
reader: &mut R,
timestamp_lookup: Option<&BTreeMap<u32, (u32, u32)>>
) -> Result<InsertOperation>
reader: &mut R,
timestamp_lookup: Option<&BTreeMap<u32, (u32, u32)>>
) -> Result<InsertOperation>
Expand this operation from previously compressed data in reader
. The data in reader
should have been written using compress_to()
Trait Implementations
impl PartialEq for InsertOperation
[src]
fn eq(&self, __arg_0: &InsertOperation) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &InsertOperation) -> bool
This method tests for !=
.
impl Eq for InsertOperation
[src]
impl Clone for InsertOperation
[src]
fn clone(&self) -> InsertOperation
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl Operation for InsertOperation
[src]
fn get_position(&self) -> u64
Gets the position this operation will be perfomed at
fn get_increment(&self) -> i64
Gets the size change this operation will perform. For insert operations, it's the length of the data they will insert. For delete operations, it's the length of the data they will delete Read more
fn get_timestamp(&self) -> u32
Gets the current local timestamp of this operation
fn set_timestamp(&mut self, new_timestamp: u32)
Sets the local timestamp of this operation