Struct google_api_proto::google::spanner::executor::v1::StartBatchTransactionAction
source · pub struct StartBatchTransactionAction {
pub cloud_database_role: String,
pub param: Option<Param>,
}
Expand description
Starts a batch read-only transaction in executor. Successful outcomes of this action will contain batch_txn_id–the identificator that can be used to start the same transaction in other Executors to parallelize partition processing.
Example of a batch read flow:
- Start batch transaction with a timestamp (StartBatchTransactionAction)
- Generate database partitions for a read or query (GenerateDbPartitionsForReadAction/GenerateDbPartitionsForQueryAction)
- Call ExecutePartitionAction for some or all partitions, process rows
- Clean up the transaction (CloseBatchTransactionAction).
More sophisticated example, with parallel processing:
- Start batch transaction with a timestamp (StartBatchTransactionAction), note the returned BatchTransactionId
- Generate database partitions for a read or query (GenerateDbPartitionsForReadAction/GenerateDbPartitionsForQueryAction)
- Distribute the partitions over a pool of workers, along with the transaction ID.
In each worker: 4-1. StartBatchTransactionAction with the given transaction ID 4-2. ExecutePartitionAction for each partition it got, process read results 4-3. Close (not cleanup) the transaction (CloseBatchTransactionAction).
When all workers are done: 5. Cleanup the transaction (CloseBatchTransactionAction). This can be done either by the last worker to finish the job, or by the main Executor that initialized this transaction in the first place. It is also possible to clean it up with a brand new Executor – just execute StartBatchTransactionAction with the ID, then clean it up right away.
Cleaning up is optional, but recommended.
Fields§
§cloud_database_role: String
Database role to assume while performing this action. Setting the database_role will enforce additional role-based access checks on this action.
param: Option<Param>
To start a new transaction, specify an exact timestamp. Alternatively, an existing batch transaction ID can be used. Either one of two must be set.
Trait Implementations§
source§impl Clone for StartBatchTransactionAction
impl Clone for StartBatchTransactionAction
source§fn clone(&self) -> StartBatchTransactionAction
fn clone(&self) -> StartBatchTransactionAction
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for StartBatchTransactionAction
impl Debug for StartBatchTransactionAction
source§impl Message for StartBatchTransactionAction
impl Message for StartBatchTransactionAction
source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
source§fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
source§fn encode_to_vec(&self) -> Vec<u8>where
Self: Sized,
fn encode_to_vec(&self) -> Vec<u8>where
Self: Sized,
source§fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
source§fn encode_length_delimited_to_vec(&self) -> Vec<u8>where
Self: Sized,
fn encode_length_delimited_to_vec(&self) -> Vec<u8>where
Self: Sized,
source§fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
source§fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
source§fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self
. Read moresource§fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self
.source§impl PartialEq for StartBatchTransactionAction
impl PartialEq for StartBatchTransactionAction
source§fn eq(&self, other: &StartBatchTransactionAction) -> bool
fn eq(&self, other: &StartBatchTransactionAction) -> bool
self
and other
values to be equal, and is used
by ==
.impl StructuralPartialEq for StartBatchTransactionAction
Auto Trait Implementations§
impl !Freeze for StartBatchTransactionAction
impl RefUnwindSafe for StartBatchTransactionAction
impl Send for StartBatchTransactionAction
impl Sync for StartBatchTransactionAction
impl Unpin for StartBatchTransactionAction
impl UnwindSafe for StartBatchTransactionAction
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