1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
// Copyright 2025 LunaOS Contributors
// SPDX-License-Identifier: Apache-2.0
//! # S3 Gateway
//!
//! Native S3-compatible API gateway for LCPFS. Exposes datasets as S3 buckets
//! with full support for common S3 operations.
//!
//! ## Overview
//!
//! The S3 Gateway provides a minimal, standards-compliant S3 interface that allows
//! existing S3-compatible tools and applications to interact with LCPFS storage.
//! Each LCPFS dataset can be exposed as an S3 bucket with versioning backed by
//! snapshots.
//!
//! ## Features
//!
//! - **Bucket Operations**: ListBuckets, CreateBucket, DeleteBucket, HeadBucket
//! - **Object Operations**: PutObject, GetObject, DeleteObject, HeadObject, CopyObject
//! - **Multipart Uploads**: CreateMultipartUpload, UploadPart, CompleteMultipartUpload
//! - **Listing**: ListObjectsV2 with prefix/delimiter support
//! - **Versioning**: Object versions via LCPFS snapshots
//! - **Authentication**: AWS Signature Version 4 (SigV4)
//!
//! ## Architecture
//!
//! ```text
//! ┌─────────────────────────────────────────────────────────────┐
//! │ S3 Gateway │
//! │ ┌─────────────┐ ┌─────────────┐ ┌─────────────────┐ │
//! │ │ HTTP Server │──│ S3 Parser │──│ SigV4 Auth │ │
//! │ └─────────────┘ └─────────────┘ └─────────────────┘ │
//! │ │ │ │
//! │ ▼ ▼ │
//! │ ┌─────────────────────────────────────────────────────┐ │
//! │ │ S3 Operations Handler │ │
//! │ │ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌────────┐ │ │
//! │ │ │ Buckets │ │ Objects │ │Multipart│ │ XML │ │ │
//! │ │ └─────────┘ └─────────┘ └─────────┘ └────────┘ │ │
//! │ └─────────────────────────────────────────────────────┘ │
//! │ │ │
//! └────────────────────────────┼────────────────────────────────┘
//! ▼
//! ┌─────────────────────────────────────────────────────────────┐
//! │ StorageProvider │
//! │ (Maps S3 operations to LCPFS datasets/snapshots/files) │
//! └─────────────────────────────────────────────────────────────┘
//! ```
//!
//! ## Usage
//!
//! ```rust,ignore
//! use lcpfs::s3::{S3Gateway, S3GatewayConfig, StorageProvider, NetworkProvider};
//!
//! // Implement StorageProvider for your LCPFS pool
//! struct LcpfsStorage { /* pool reference */ }
//! impl StorageProvider for LcpfsStorage {
//! // Map buckets to datasets, objects to files
//! }
//!
//! // Implement NetworkProvider for your network stack
//! struct MyNetwork { /* ... */ }
//! impl NetworkProvider for MyNetwork {
//! // Provide TCP listener
//! }
//!
//! // Create and run the gateway
//! let config = S3GatewayConfig {
//! bind_addr: [0, 0, 0, 0],
//! port: 9000,
//! access_key: "minioadmin".into(),
//! secret_key: "minioadmin".into(),
//! region: "us-east-1".into(),
//! ..Default::default()
//! };
//!
//! let gateway = S3Gateway::new(storage, network, config);
//! gateway.run()?;
//! ```
//!
//! ## AWS CLI Compatibility
//!
//! ```bash
//! # Configure AWS CLI to use the gateway
//! aws configure set aws_access_key_id minioadmin
//! aws configure set aws_secret_access_key minioadmin
//!
//! # List buckets
//! aws --endpoint-url http://localhost:9000 s3 ls
//!
//! # Upload a file
//! aws --endpoint-url http://localhost:9000 s3 cp file.txt s3://mybucket/
//!
//! # List objects
//! aws --endpoint-url http://localhost:9000 s3 ls s3://mybucket/
//! ```
//!
//! ## MinIO Client Compatibility
//!
//! ```bash
//! # Configure mc alias
//! mc alias set lcpfs http://localhost:9000 minioadmin minioadmin
//!
//! # Basic operations
//! mc ls lcpfs
//! mc mb lcpfs/newbucket
//! mc cp file.txt lcpfs/newbucket/
//! ```
// Re-export core types
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;