Table

Struct Table 

Source
#[non_exhaustive]
pub struct Table { pub name: String, pub cluster_states: HashMap<String, ClusterState>, pub column_families: HashMap<String, ColumnFamily>, pub granularity: TimestampGranularity, pub restore_info: Option<RestoreInfo>, pub change_stream_config: Option<ChangeStreamConfig>, pub deletion_protection: bool, pub row_key_schema: Option<Struct>, pub automated_backup_config: Option<AutomatedBackupConfig>, /* private fields */ }
Expand description

A collection of user data indexed by row, column, and timestamp. Each table is served using the resources of its parent cluster.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§name: String

The unique name of the table. Values are of the form projects/{project}/instances/{instance}/tables/[_a-zA-Z0-9][-_.a-zA-Z0-9]*. Views: NAME_ONLY, SCHEMA_VIEW, REPLICATION_VIEW, FULL

§cluster_states: HashMap<String, ClusterState>

Output only. Map from cluster ID to per-cluster table state. If it could not be determined whether or not the table has data in a particular cluster (for example, if its zone is unavailable), then there will be an entry for the cluster with UNKNOWN replication_status. Views: REPLICATION_VIEW, ENCRYPTION_VIEW, FULL

§column_families: HashMap<String, ColumnFamily>

The column families configured for this table, mapped by column family ID. Views: SCHEMA_VIEW, STATS_VIEW, FULL

§granularity: TimestampGranularity

Immutable. The granularity (i.e. MILLIS) at which timestamps are stored in this table. Timestamps not matching the granularity will be rejected. If unspecified at creation time, the value will be set to MILLIS. Views: SCHEMA_VIEW, FULL.

§restore_info: Option<RestoreInfo>

Output only. If this table was restored from another data source (e.g. a backup), this field will be populated with information about the restore.

§change_stream_config: Option<ChangeStreamConfig>

If specified, enable the change stream on this table. Otherwise, the change stream is disabled and the change stream is not retained.

§deletion_protection: bool

Set to true to make the table protected against data loss. i.e. deleting the following resources through Admin APIs are prohibited:

  • The table.
  • The column families in the table.
  • The instance containing the table.

Note one can still delete the data stored in the table through Data APIs.

§row_key_schema: Option<Struct>

The row key schema for this table. The schema is used to decode the raw row key bytes into a structured format. The order of field declarations in this schema is important, as it reflects how the raw row key bytes are structured. Currently, this only affects how the key is read via a GoogleSQL query from the ExecuteQuery API.

For a SQL query, the _key column is still read as raw bytes. But queries can reference the key fields by name, which will be decoded from _key using provided type and encoding. Queries that reference key fields will fail if they encounter an invalid row key.

For example, if _key = “some_id#2024-04-30#\x00\x13\x00\xf3” with the following schema: { fields { field_name: “id” type { string { encoding: utf8_bytes {} } } } fields { field_name: “date” type { string { encoding: utf8_bytes {} } } } fields { field_name: “product_code” type { int64 { encoding: big_endian_bytes {} } } } encoding { delimited_bytes { delimiter: “#” } } }

The decoded key parts would be: id = “some_id”, date = “2024-04-30”, product_code = 1245427 The query “SELECT _key, product_code FROM table” will return two columns: /——————————————————\

_keyproduct_code
“some_id#2024-04-30#\x00\x13\x00\xf3”1245427
-—————————————————–/

The schema has the following invariants: (1) The decoded field values are order-preserved. For read, the field values will be decoded in sorted mode from the raw bytes. (2) Every field in the schema must specify a non-empty name. (3) Every field must specify a type with an associated encoding. The type is limited to scalar types only: Array, Map, Aggregate, and Struct are not allowed. (4) The field names must not collide with existing column family names and reserved keywords “_key” and “_timestamp”.

The following update operations are allowed for row_key_schema:

  • Update from an empty schema to a new schema.
  • Remove the existing schema. This operation requires setting the ignore_warnings flag to true, since it might be a backward incompatible change. Without the flag, the update request will fail with an INVALID_ARGUMENT error. Any other row key schema update operation (e.g. update existing schema columns names or types) is currently unsupported.
§automated_backup_config: Option<AutomatedBackupConfig>

Implementations§

Source§

impl Table

Source

pub fn new() -> Self

Source

pub fn set_name<T: Into<String>>(self, v: T) -> Self

Sets the value of name.

§Example
let x = Table::new().set_name("example");
Source

pub fn set_cluster_states<T, K, V>(self, v: T) -> Self
where T: IntoIterator<Item = (K, V)>, K: Into<String>, V: Into<ClusterState>,

Sets the value of cluster_states.

§Example
use google_cloud_bigtable_admin_v2::model::table::ClusterState;
let x = Table::new().set_cluster_states([
    ("key0", ClusterState::default()/* use setters */),
    ("key1", ClusterState::default()/* use (different) setters */),
]);
Source

pub fn set_column_families<T, K, V>(self, v: T) -> Self
where T: IntoIterator<Item = (K, V)>, K: Into<String>, V: Into<ColumnFamily>,

Sets the value of column_families.

§Example
use google_cloud_bigtable_admin_v2::model::ColumnFamily;
let x = Table::new().set_column_families([
    ("key0", ColumnFamily::default()/* use setters */),
    ("key1", ColumnFamily::default()/* use (different) setters */),
]);
Source

pub fn set_granularity<T: Into<TimestampGranularity>>(self, v: T) -> Self

Sets the value of granularity.

§Example
use google_cloud_bigtable_admin_v2::model::table::TimestampGranularity;
let x0 = Table::new().set_granularity(TimestampGranularity::Millis);
Source

pub fn set_restore_info<T>(self, v: T) -> Self
where T: Into<RestoreInfo>,

Sets the value of restore_info.

§Example
use google_cloud_bigtable_admin_v2::model::RestoreInfo;
let x = Table::new().set_restore_info(RestoreInfo::default()/* use setters */);
Source

pub fn set_or_clear_restore_info<T>(self, v: Option<T>) -> Self
where T: Into<RestoreInfo>,

Sets or clears the value of restore_info.

§Example
use google_cloud_bigtable_admin_v2::model::RestoreInfo;
let x = Table::new().set_or_clear_restore_info(Some(RestoreInfo::default()/* use setters */));
let x = Table::new().set_or_clear_restore_info(None::<RestoreInfo>);
Source

pub fn set_change_stream_config<T>(self, v: T) -> Self

Sets the value of change_stream_config.

§Example
use google_cloud_bigtable_admin_v2::model::ChangeStreamConfig;
let x = Table::new().set_change_stream_config(ChangeStreamConfig::default()/* use setters */);
Source

pub fn set_or_clear_change_stream_config<T>(self, v: Option<T>) -> Self

Sets or clears the value of change_stream_config.

§Example
use google_cloud_bigtable_admin_v2::model::ChangeStreamConfig;
let x = Table::new().set_or_clear_change_stream_config(Some(ChangeStreamConfig::default()/* use setters */));
let x = Table::new().set_or_clear_change_stream_config(None::<ChangeStreamConfig>);
Source

pub fn set_deletion_protection<T: Into<bool>>(self, v: T) -> Self

Sets the value of deletion_protection.

§Example
let x = Table::new().set_deletion_protection(true);
Source

pub fn set_row_key_schema<T>(self, v: T) -> Self
where T: Into<Struct>,

Sets the value of row_key_schema.

§Example
use google_cloud_bigtable_admin_v2::model::r#type::Struct;
let x = Table::new().set_row_key_schema(Struct::default()/* use setters */);
Source

pub fn set_or_clear_row_key_schema<T>(self, v: Option<T>) -> Self
where T: Into<Struct>,

Sets or clears the value of row_key_schema.

§Example
use google_cloud_bigtable_admin_v2::model::r#type::Struct;
let x = Table::new().set_or_clear_row_key_schema(Some(Struct::default()/* use setters */));
let x = Table::new().set_or_clear_row_key_schema(None::<Struct>);
Source

pub fn set_automated_backup_config<T: Into<Option<AutomatedBackupConfig>>>( self, v: T, ) -> Self

Sets the value of automated_backup_config.

Note that all the setters affecting automated_backup_config are mutually exclusive.

§Example
use google_cloud_bigtable_admin_v2::model::table::AutomatedBackupPolicy;
let x = Table::new().set_automated_backup_config(Some(
    google_cloud_bigtable_admin_v2::model::table::AutomatedBackupConfig::AutomatedBackupPolicy(AutomatedBackupPolicy::default().into())));
Source

pub fn automated_backup_policy(&self) -> Option<&Box<AutomatedBackupPolicy>>

The value of automated_backup_config if it holds a AutomatedBackupPolicy, None if the field is not set or holds a different branch.

Source

pub fn set_automated_backup_policy<T: Into<Box<AutomatedBackupPolicy>>>( self, v: T, ) -> Self

Sets the value of automated_backup_config to hold a AutomatedBackupPolicy.

Note that all the setters affecting automated_backup_config are mutually exclusive.

§Example
use google_cloud_bigtable_admin_v2::model::table::AutomatedBackupPolicy;
let x = Table::new().set_automated_backup_policy(AutomatedBackupPolicy::default()/* use setters */);
assert!(x.automated_backup_policy().is_some());

Trait Implementations§

Source§

impl Clone for Table

Source§

fn clone(&self) -> Table

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Table

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Table

Source§

fn default() -> Table

Returns the “default value” for a type. Read more
Source§

impl Message for Table

Source§

fn typename() -> &'static str

The typename of this message.
Source§

impl PartialEq for Table

Source§

fn eq(&self, other: &Table) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for Table

Auto Trait Implementations§

§

impl Freeze for Table

§

impl RefUnwindSafe for Table

§

impl Send for Table

§

impl Sync for Table

§

impl Unpin for Table

§

impl UnwindSafe for Table

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,