Struct delta_sharing_server::manager::dynamo::DynamoShareReader
source · pub struct DynamoShareReader { /* private fields */ }Expand description
ASSUMPTION: the writer only uses transactions to guarantee the consistency of the shared securables (i.e. share -> schema -> table).
| SHARE#ALL | share1 | … | SHARE#ALL | share2 | … | SHARE#share1 | schema1 | … | SHARE#share1 | schema2 | … | SHARE#share2 | schema1#table1 | … TableManager using AWS DynamoDB to store shared objects.
Table layout
| PK | SK | share_id | storage_path | table_id SHARE#{share_name}#SCHEMA#ALL#TABLE#ALL | SHARE | share1_id SHARE#{share_name}#SCHEMA#{schema_name}#TABLE#ALL | SCHEMA | SHARE#{share_name}#SCHEMA#{schema_name}#TABLE#{table_name} | TABLE | share1_id | s3://my-data-bucket/my-table-root/ | table1_id
Key
- KEY: PK+SK
- GSI: SK+PK
Implemented query patterns
- QUERY on GSI with SK = SHARE
- GET on KEY with PK = SHARE#{share_name}#SCHEMA#ALL#TABLE#ALL
- QUERY on GSI with SK = SCHEMA AND PK begins_with(SHARE#{share_name})
- QUERY on GSI with type = TABLE and SK begins_with(SHARE#{share_name}#SCHEMA#{schema_name})
- QUERY on GSI with type = TABLE and SK begins_with(SHARE#{share_name})
- GET on KEY with PK = SHARE#{share_name}#SCHEMA#{schema_name}#TABLE#{table_name} AND SK = TABLE
Query patterns
- Get a table by share_name, schema_name and table_name
- Get a share by share_name
- List all shares
- List all schemas in a share
- List all tables in a share
- List all tables in a schema
Implementations§
sourcepub fn new(client: Client, table_name: String, index_name: String) -> Self
pub fn new(client: Client, table_name: String, index_name: String) -> Self
Create a new TableManager using the AWS DynamoDB client along with table_name and GSI index name.
sourcepub fn create_table(&self) -> Result<(), DynamoError>
pub fn create_table(&self) -> Result<(), DynamoError>
Create a new DynamoDB table to store shares, schemas and tables.
Add a new share to the share store.
Retrieve a share from the share store.
Retrieve a list of shares from the share store.
sourcepub async fn put_schema(&self, schema: Schema) -> Result<Schema, DynamoError>
pub async fn put_schema(&self, schema: Schema) -> Result<Schema, DynamoError>
Add a new schema to the share store.
sourcepub async fn get_schema(
&self,
share_name: &str,
schema_name: &str
) -> Result<Schema, DynamoError>
pub async fn get_schema( &self, share_name: &str, schema_name: &str ) -> Result<Schema, DynamoError>
Retrieve a schema from the share store.
sourcepub async fn query_schemas(
&self,
share_name: &str,
cursor: &ListCursor
) -> Result<List<Schema>, DynamoError>
pub async fn query_schemas( &self, share_name: &str, cursor: &ListCursor ) -> Result<List<Schema>, DynamoError>
Retrieve a list of schemas from the share store.
sourcepub async fn put_table(&self, table: Table) -> Result<Table, DynamoError>
pub async fn put_table(&self, table: Table) -> Result<Table, DynamoError>
Add a new table to the share store.
sourcepub async fn get_table(
&self,
share_name: &str,
schema_name: &str,
table_name: &str
) -> Result<Table, DynamoError>
pub async fn get_table( &self, share_name: &str, schema_name: &str, table_name: &str ) -> Result<Table, DynamoError>
Retrieve a table from the share store.
Retrieve a list of tables from the share store.
sourcepub async fn query_tables_in_schema(
&self,
share_name: &str,
schema_name: &str,
cursor: &ListCursor
) -> Result<List<Table>, DynamoError>
pub async fn query_tables_in_schema( &self, share_name: &str, schema_name: &str, cursor: &ListCursor ) -> Result<List<Table>, DynamoError>
Retrieve a list of tables from the share store.