#[non_exhaustive]pub enum TimestampBound {
Strong(bool),
MinReadTimestamp(Box<Timestamp>),
MaxStaleness(Box<Duration>),
ReadTimestamp(Box<Timestamp>),
ExactStaleness(Box<Duration>),
}Expand description
How to choose the timestamp for the read-only transaction.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Strong(bool)
Read at a timestamp where all previously committed transactions are visible.
MinReadTimestamp(Box<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(Box<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(Box<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 is blocked 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(Box<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 from_strong(value: impl Into<bool>) -> Self
pub fn from_strong(value: impl Into<bool>) -> Self
Initializes the enum to the Strong branch.
Sourcepub fn from_min_read_timestamp(value: impl Into<Box<Timestamp>>) -> Self
pub fn from_min_read_timestamp(value: impl Into<Box<Timestamp>>) -> Self
Initializes the enum to the MinReadTimestamp branch.
Sourcepub fn from_max_staleness(value: impl Into<Box<Duration>>) -> Self
pub fn from_max_staleness(value: impl Into<Box<Duration>>) -> Self
Initializes the enum to the MaxStaleness branch.
Sourcepub fn from_read_timestamp(value: impl Into<Box<Timestamp>>) -> Self
pub fn from_read_timestamp(value: impl Into<Box<Timestamp>>) -> Self
Initializes the enum to the ReadTimestamp branch.
Sourcepub fn from_exact_staleness(value: impl Into<Box<Duration>>) -> Self
pub fn from_exact_staleness(value: impl Into<Box<Duration>>) -> Self
Initializes the enum to the ExactStaleness branch.
Trait Implementations§
Source§impl Clone for TimestampBound
impl Clone for TimestampBound
Source§fn clone(&self) -> TimestampBound
fn clone(&self) -> TimestampBound
1.0.0 (const: unstable) · 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 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 UnsafeUnpin 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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<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