Struct rustyspanner::database::BatchSnapshot [−][src]
pub struct BatchSnapshot<'a> { /* fields omitted */ }
Wrapper for generating and processing read/query batches.
Methods
impl<'a> BatchSnapshot<'a>
[src]
impl<'a> BatchSnapshot<'a>
pub fn new(
database: &'a mut Database<'a>,
read_timestamp: Option<DateTime<Utc>>,
exact_staleness: Option<DateTime<Utc>>
) -> Self
[src]
pub fn new(
database: &'a mut Database<'a>,
read_timestamp: Option<DateTime<Utc>>,
exact_staleness: Option<DateTime<Utc>>
) -> Self
Initializes a new BatchSnapshot
Arguments
-
database
- Database to use. -
read_timestamp
- (Optional) Execute all reads at the given timestamp. -
exact_staleness
- (Optional) Execute all reads at a timestamp that isexact_staleness
old.
Return value
A BatchSnapshot
.
ⓘImportant traits for StreamedResultSet<'a>pub fn read(
&'a mut self,
table: String,
columns: Vec<String>,
keyset: KeySet,
index: Option<String>,
limit: Option<i64>,
partition: Option<Vec<u8>>
) -> StreamedResultSet
[src]
pub fn read(
&'a mut self,
table: String,
columns: Vec<String>,
keyset: KeySet,
index: Option<String>,
limit: Option<i64>,
partition: Option<Vec<u8>>
) -> StreamedResultSet
Convenience method: perform read operation via snapshot.
See method read
ⓘImportant traits for StreamedResultSet<'a>pub fn execute_sql(
&'a mut self,
sql: String,
params: Option<HashMap<String, Value>>,
param_types: Option<HashMap<String, Type>>,
query_mode: Option<QueryMode>,
partition: Option<Vec<u8>>
) -> StreamedResultSet
[src]
pub fn execute_sql(
&'a mut self,
sql: String,
params: Option<HashMap<String, Value>>,
param_types: Option<HashMap<String, Type>>,
query_mode: Option<QueryMode>,
partition: Option<Vec<u8>>
) -> StreamedResultSet
Convenience method: perform query operation via snapshot.
See method execute_sql
pub fn generate_read_batches(
&'a mut self,
table: String,
columns: Vec<String>,
keyset: KeySet,
index: Option<String>,
partition_size_bytes: Option<i64>,
max_partitions: Option<i64>
) -> Vec<BatchType>
[src]
pub fn generate_read_batches(
&'a mut self,
table: String,
columns: Vec<String>,
keyset: KeySet,
index: Option<String>,
partition_size_bytes: Option<i64>,
max_partitions: Option<i64>
) -> Vec<BatchType>
Start a partitioned batch read operation.
Uses the PartitionRead
API request to initiate the partitioned
read. Returns a list of batch information needed to perform the
actual read.
Arguments
-
table
- Name of the table from which to fetch data. -
columns
- Names of columns to be retrieved. -
keyset
- AKeySet
containing keys/ranges identifying rows to be retrieved. -
index
- (Optional) Name of index to use, rather than the table's primary key. -
partition_size_bytes
- (Optional) Desired size for each partition generated. The service uses this as a hint, th actual partition size may differ. -
max_partitions
- (Optional) Desired maximum number of partitions generated. The service uses this as a hint, the actual number of partitions may differ.
Return value
A vector of PartitionRead
.
ⓘImportant traits for StreamedResultSet<'a>pub fn process_read_batch(
&'a mut self,
batch: PartitionRead
) -> StreamedResultSet
[src]
pub fn process_read_batch(
&'a mut self,
batch: PartitionRead
) -> StreamedResultSet
Process a single, partitioned read.
Arguments
batch
- One of thePartitionRead
returned from an earlier call to methodgenerate_read_batches
Return value
A StreamedResultSet
instance which can be used to consume rows.
pub fn generate_query_batches(
&'a mut self,
sql: String,
params: Option<HashMap<String, Value>>,
param_types: Option<HashMap<String, Type>>,
partition_size_bytes: Option<i64>,
max_partitions: Option<i64>
) -> Vec<BatchType>
[src]
pub fn generate_query_batches(
&'a mut self,
sql: String,
params: Option<HashMap<String, Value>>,
param_types: Option<HashMap<String, Type>>,
partition_size_bytes: Option<i64>,
max_partitions: Option<i64>
) -> Vec<BatchType>
Start a partitioned batch query operation.
Uses the PartitionQuery
API request to start a partitioned
query operation. Returns a list of batch information needed to perform the
perform the actual queries.
Arguments
-
sql
- SQL query statement. -
params
- Values for parameter replacement. Keys must match the names used insql
. -
param_types
- (Optional) Maps explicit types for one or more param values; required if parameters are passed. -
partition_size_bytes
- (Optional) Desired size for each partition generated. The service uses this as a hint, th actual partition size may differ. -
max_partitions
- (Optional) Desired maximum number of partitions generated. The service uses this as a hint, the actual number of partitions may differ.
Return value
A vector of PartitionQuery
.
ⓘImportant traits for StreamedResultSet<'a>pub fn process_query_batch(
&'a mut self,
batch: PartitionQuery
) -> StreamedResultSet
[src]
pub fn process_query_batch(
&'a mut self,
batch: PartitionQuery
) -> StreamedResultSet
Process a single, partitioned query.
Arguments
batch
- One of thePartitionQuery
returned from an earlier call to methodgenerate_query_batches
Return value
A StreamedResultSet
instance which can be used to consume rows.
ⓘImportant traits for StreamedResultSet<'a>pub fn process(&'a mut self, batch: BatchType) -> StreamedResultSet
[src]
pub fn process(&'a mut self, batch: BatchType) -> StreamedResultSet
Process a single, partitioned query or read.
Arguments
batch
- One of theBatchType
returned from an earlier call to methodgenerate_query_batches
or methodgenerate_read_batches
.
Return value
A StreamedResultSet
instance which can be used consume rows.
pub fn close(&'a mut self)
[src]
pub fn close(&'a mut self)
Clean up underlying session.
If the transaction has been shared across multiples machines, calling this on any machine would invalidate the transaction everywhere. Ideally this would be called when data has been read from all partitions.
Auto Trait Implementations
impl<'a> Send for BatchSnapshot<'a>
impl<'a> Send for BatchSnapshot<'a>
impl<'a> Sync for BatchSnapshot<'a>
impl<'a> Sync for BatchSnapshot<'a>