Skip to content

Commit 2c4e071

Browse files
committed
added tables support v2
1 parent 1af531d commit 2c4e071

File tree

177 files changed

+3446
-952
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

177 files changed

+3446
-952
lines changed

S3_TABLES_POC.md

Lines changed: 450 additions & 0 deletions
Large diffs are not rendered by default.

TABLES_ARCHITECTURE_DECISION.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ The subdirectory approach keeps related code together and makes it easier to und
9191

9292
Developers can easily distinguish:
9393
- **S3 operations**: `use minio::s3::{MinioClient, builders::*}`
94-
- **Tables operations**: `use minio::s3::tables::{TablesClient, builders::*}`
94+
- **Tables operations**: `use minio::s3tables::{TablesClient, builders::*}`
9595

9696
The import paths immediately convey which API surface is being used.
9797

TABLES_HTTP_IMPLEMENTATION_GUIDE.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ pub enum Error {
201201
// ... existing variants ...
202202

203203
#[error("Tables API error: {0}")]
204-
TablesError(#[from] crate::s3::tables::error::TablesError),
204+
TablesError(#[from] crate::s3tables::error::TablesError),
205205
}
206206
```
207207

@@ -300,7 +300,7 @@ Create `tests/tables_integration_test.rs`:
300300
#[cfg(test)]
301301
mod integration {
302302
use minio::s3::{MinioClient, creds::StaticProvider, http::BaseUrl};
303-
use minio::s3::tables::TablesClient;
303+
use minio::s3tables::TablesClient;
304304
use minio::s3::types::S3Api;
305305

306306
async fn get_client() -> TablesClient {
@@ -394,8 +394,8 @@ Create `examples/tables_basic.rs`:
394394

395395
```rust
396396
use minio::s3::{MinioClient, creds::StaticProvider, http::BaseUrl};
397-
use minio::s3::tables::TablesClient;
398-
use minio::s3::tables::iceberg::{Schema, Field, FieldType, PrimitiveType};
397+
use minio::s3tables::TablesClient;
398+
use minio::s3tables::iceberg::{Schema, Field, FieldType, PrimitiveType};
399399
use minio::s3::types::S3Api;
400400

401401
#[tokio::main]

TABLES_IMPLEMENTATION_PLAN.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ impl TablesClient {
286286
/// # Example
287287
/// ```no_run
288288
/// use minio::s3::MinioClient;
289-
/// use minio::s3::tables::TablesClient;
289+
/// use minio::s3tables::TablesClient;
290290
/// use minio::s3::creds::StaticProvider;
291291
/// use minio::s3::http::BaseUrl;
292292
///
@@ -441,7 +441,7 @@ pub struct ErrorModel {
441441

442442
**`src/s3/tables/builders/create_warehouse.rs`**:
443443
```rust
444-
use crate::s3::tables::{TablesClient, TablesRequest, ToTablesRequest, TablesApi};
444+
use crate::s3tables::{TablesClient, TablesRequest, ToTablesRequest, TablesApi};
445445
use crate::s3::error::ValidationErr;
446446
use http::Method;
447447
use typed_builder::TypedBuilder;
@@ -457,7 +457,7 @@ pub struct CreateWarehouse {
457457
}
458458

459459
impl TablesApi for CreateWarehouse {
460-
type TablesResponse = crate::s3::tables::response::CreateWarehouseResponse;
460+
type TablesResponse = crate::s3tables::response::CreateWarehouseResponse;
461461
}
462462

463463
pub type CreateWarehouseBldr = CreateWarehouseBuilder<((TablesClient,), (String,), ())>;
@@ -490,14 +490,14 @@ impl ToTablesRequest for CreateWarehouse {
490490

491491
**`src/s3/tables/client/create_warehouse.rs`**:
492492
```rust
493-
use crate::s3::tables::{TablesClient, builders::CreateWarehouseBldr};
493+
use crate::s3tables::{TablesClient, builders::CreateWarehouseBldr};
494494

495495
impl TablesClient {
496496
/// Creates a warehouse (table bucket)
497497
///
498498
/// # Example
499499
/// ```no_run
500-
/// use minio::s3::tables::TablesClient;
500+
/// use minio::s3tables::TablesClient;
501501
/// use minio::s3::types::S3Api;
502502
///
503503
/// # async fn example(client: TablesClient) {
@@ -511,7 +511,7 @@ impl TablesClient {
511511
/// # }
512512
/// ```
513513
pub fn create_warehouse<S: Into<String>>(&self, warehouse: S) -> CreateWarehouseBldr {
514-
crate::s3::tables::builders::CreateWarehouse::builder()
514+
crate::s3tables::builders::CreateWarehouse::builder()
515515
.client(self.clone())
516516
.warehouse_name(warehouse)
517517
}
@@ -520,7 +520,7 @@ impl TablesClient {
520520

521521
**`src/s3/tables/response/create_warehouse.rs`**:
522522
```rust
523-
use crate::s3::tables::{TablesRequest, FromTablesResponse};
523+
use crate::s3tables::{TablesRequest, FromTablesResponse};
524524
use crate::s3::error::Error;
525525

526526
#[derive(Debug, Clone, serde::Deserialize)]
@@ -1062,7 +1062,7 @@ mod transaction_tests;
10621062

10631063
// tests/tables/warehouse_tests.rs
10641064
use minio::s3::MinioClient;
1065-
use minio::s3::tables::TablesClient;
1065+
use minio::s3tables::TablesClient;
10661066

10671067
#[tokio::test]
10681068
async fn test_warehouse_lifecycle() {
@@ -1126,7 +1126,7 @@ Create `examples/tables/` directory:
11261126
```rust
11271127
// examples/tables/create_table.rs
11281128
use minio::s3::MinioClient;
1129-
use minio::s3::tables::{TablesClient, iceberg::*};
1129+
use minio::s3tables::{TablesClient, iceberg::*};
11301130
use minio::s3::creds::StaticProvider;
11311131
use minio::s3::http::BaseUrl;
11321132
use minio::s3::types::S3Api;
@@ -1214,7 +1214,7 @@ Add comprehensive rustdoc comments:
12141214
/// # Examples
12151215
///
12161216
/// ```no_run
1217-
/// use minio::s3::tables::TablesClient;
1217+
/// use minio::s3tables::TablesClient;
12181218
/// use minio::s3::types::S3Api;
12191219
///
12201220
/// # async fn example(tables: TablesClient) {
@@ -1258,7 +1258,7 @@ execute ACID transactions on structured data.
12581258

12591259
\`\`\`rust
12601260
use minio::s3::{MinioClient, creds::StaticProvider, http::BaseUrl};
1261-
use minio::s3::tables::TablesClient;
1261+
use minio::s3tables::TablesClient;
12621262

12631263
let base_url = "http://localhost:9000/".parse()?;
12641264
let provider = StaticProvider::new("minioadmin", "minioadmin", None);
@@ -1280,7 +1280,7 @@ tables.create_namespace("analytics", "sales").build().send().await?;
12801280

12811281
#### Create a Table
12821282
\`\`\`rust
1283-
use minio::s3::tables::iceberg::*;
1283+
use minio::s3tables::iceberg::*;
12841284

12851285
let schema = Schema {
12861286
schema_id: 0,
@@ -1312,7 +1312,7 @@ tables
13121312
MinIO AIStor supports atomic transactions across multiple tables:
13131313

13141314
\`\`\`rust
1315-
use minio::s3::tables::iceberg::{Requirement, Update};
1315+
use minio::s3tables::iceberg::{Requirement, Update};
13161316

13171317
tables
13181318
.commit_multi_table_transaction("warehouse")

TABLES_README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ All phases (1-11) of the Tables API implementation are complete, providing a ful
4444

4545
```rust
4646
use minio::s3::{MinioClient, creds::StaticProvider, http::BaseUrl};
47-
use minio::s3::tables::{TablesApi, TablesClient};
48-
use minio::s3::tables::iceberg::{Schema, Field, FieldType, PrimitiveType};
47+
use minio::s3tables::{TablesApi, TablesClient};
48+
use minio::s3tables::iceberg::{Schema, Field, FieldType, PrimitiveType};
4949

5050
#[tokio::main]
5151
async fn main() -> Result<(), Box<dyn std::error::Error>> {

examples/tables_quickstart.rs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636
use minio::s3::MinioClient;
3737
use minio::s3::creds::StaticProvider;
3838
use minio::s3::http::BaseUrl;
39-
use minio::s3::tables::iceberg::{Field, FieldType, PrimitiveType, Schema};
40-
use minio::s3::tables::{TablesApi, TablesClient};
39+
use minio::s3tables::iceberg::{Field, FieldType, PrimitiveType, Schema};
40+
use minio::s3tables::{TablesApi, TablesClient};
4141

4242
#[tokio::main]
4343
async fn main() -> Result<(), Box<dyn std::error::Error>> {
@@ -113,8 +113,9 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
113113
.send()
114114
.await?;
115115

116-
println!(" Found {} table(s):", list_response.identifiers.len());
117-
for table_id in &list_response.identifiers {
116+
let identifiers = list_response.identifiers()?;
117+
println!(" Found {} table(s):", identifiers.len());
118+
for table_id in &identifiers {
118119
println!(
119120
" - {}.{}",
120121
table_id.namespace_schema.join("."),
@@ -130,10 +131,10 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
130131
.build()
131132
.send()
132133
.await?;
134+
let table_result = table_meta.table_result()?;
133135
println!(
134136
" ✓ Metadata location: {}",
135-
table_meta
136-
.0
137+
table_result
137138
.metadata_location
138139
.unwrap_or_else(|| "N/A".to_string())
139140
);
@@ -146,10 +147,10 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
146147
.build()
147148
.send()
148149
.await?;
149-
println!(" Row count: {}", metrics.row_count);
150-
println!(" Size: {} bytes", metrics.size_bytes);
151-
println!(" Files: {}", metrics.file_count);
152-
println!(" Snapshots: {}", metrics.snapshot_count);
150+
println!(" Row count: {}", metrics.row_count()?);
151+
println!(" Size: {} bytes", metrics.size_bytes()?);
152+
println!(" Files: {}", metrics.file_count()?);
153+
println!(" Snapshots: {}", metrics.snapshot_count()?);
153154
println!();
154155

155156
// Step 9: Cleanup

src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
#![allow(clippy::result_large_err)]
6464
#![allow(clippy::too_many_arguments)]
6565
pub mod s3;
66+
pub mod s3tables;
6667

6768
#[cfg(test)]
6869
#[macro_use]

src/s3/client.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -773,7 +773,7 @@ impl MinioClient {
773773
let body_text = response.text().await.map_err(NetworkError::ReqwestError)?;
774774

775775
if let Ok(error_resp) =
776-
serde_json::from_str::<crate::s3::tables::error::TablesErrorResponse>(&body_text)
776+
serde_json::from_str::<crate::s3tables::error::TablesErrorResponse>(&body_text)
777777
{
778778
return Err(Error::TablesError(error_resp.into()));
779779
}

src/s3/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ pub enum Error {
337337
Validation(#[from] ValidationErr),
338338

339339
#[error("Tables API error: {0}")]
340-
TablesError(#[from] crate::s3::tables::error::TablesError),
340+
TablesError(#[from] crate::s3tables::error::TablesError),
341341
}
342342

343343
// region message helpers

src/s3/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ pub mod response;
2929
pub mod segmented_bytes;
3030
pub mod signer;
3131
pub mod sse;
32-
pub mod tables;
3332
pub mod types;
3433
pub mod utils;
3534

0 commit comments

Comments
 (0)