pub enum TimestampBound {
Strong(bool),
MinReadTimestamp(Timestamp),
MaxStaleness(Duration),
ReadTimestamp(Timestamp),
ExactStaleness(Duration),
}
Expand description
How to choose the timestamp for the read-only transaction.
Variants§
Strong(bool)
Read at a timestamp where all previously committed transactions are visible.
MinReadTimestamp(Timestamp)
Executes all reads at a timestamp >= min_read_timestamp
.
This is useful for requesting fresher data than some previous read, or data that is fresh enough to observe the effects of some previously committed transaction whose timestamp is known.
Note that this option can only be used in single-use transactions.
A timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds.
Example: "2014-10-02T15:01:23.045123456Z"
.
MaxStaleness(Duration)
Read data at a timestamp >= NOW - max_staleness
seconds. Guarantees that all writes that have committed more
than the specified number of seconds ago are visible. Because
Cloud Spanner chooses the exact timestamp, this mode works even if
the client’s local clock is substantially skewed from Cloud Spanner
commit timestamps.
Useful for reading the freshest data available at a nearby replica, while bounding the possible staleness if the local replica has fallen behind.
Note that this option can only be used in single-use transactions.
ReadTimestamp(Timestamp)
Executes all reads at the given timestamp. Unlike other modes, reads at a specific timestamp are repeatable; the same read at the same timestamp always returns the same data. If the timestamp is in the future, the read will block until the specified timestamp, modulo the read’s deadline.
Useful for large scale consistent reads such as mapreduces, or for coordinating many reads against a consistent snapshot of the data.
A timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds.
Example: "2014-10-02T15:01:23.045123456Z"
.
ExactStaleness(Duration)
Executes all reads at a timestamp that is exact_staleness
old. The timestamp is chosen soon after the read is started.
Guarantees that all writes that have committed more than the specified number of seconds ago are visible. Because Cloud Spanner chooses the exact timestamp, this mode works even if the client’s local clock is substantially skewed from Cloud Spanner commit timestamps.
Useful for reading at nearby replicas without the distributed
timestamp negotiation overhead of max_staleness
.
Implementations§
source§impl TimestampBound
impl TimestampBound
sourcepub fn merge(
field: &mut Option<TimestampBound>,
tag: u32,
wire_type: WireType,
buf: &mut impl Buf,
ctx: DecodeContext,
) -> Result<(), DecodeError>
pub fn merge( field: &mut Option<TimestampBound>, tag: u32, wire_type: WireType, buf: &mut impl Buf, ctx: DecodeContext, ) -> Result<(), DecodeError>
Decodes an instance of the message from a buffer, and merges it into self.
sourcepub fn encoded_len(&self) -> usize
pub fn encoded_len(&self) -> usize
Returns the encoded length of the message without a length delimiter.
Trait Implementations§
source§impl Clone for TimestampBound
impl Clone for TimestampBound
source§fn clone(&self) -> TimestampBound
fn clone(&self) -> TimestampBound
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for TimestampBound
impl Debug for TimestampBound
source§impl PartialEq for TimestampBound
impl PartialEq for TimestampBound
source§fn eq(&self, other: &TimestampBound) -> bool
fn eq(&self, other: &TimestampBound) -> bool
self
and other
values to be equal, and is used
by ==
.impl Copy for TimestampBound
impl StructuralPartialEq for TimestampBound
Auto Trait Implementations§
impl Freeze for TimestampBound
impl RefUnwindSafe for TimestampBound
impl Send for TimestampBound
impl Sync for TimestampBound
impl Unpin for TimestampBound
impl UnwindSafe for TimestampBound
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> 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