How ilich956/s3_clone works
Main Components
A. API Layer
• HTTP Server (main.go)
• Request Handlers (internal/handler)
• Input Validation (internal/utils/validation)
• Response Formatting (internal/utils/response)
B. Storage Layer
• Bucket Management (internal/storage/bucket.go)
• Object Management (internal/storage/object.go)
• CSV Utilities (pkg/csvutil)
C. File System Storage
• Physical storage for buckets and objects
• Metadata storage (CSV files)
[Client Requests]
• ↓
[HTTP Server Layer]
• ↓
[Handler Layer] ←→ [Validation Layer]
• ↓
[Storage Layer] ←→ [CSV Utilities]
• ↓
[File System]
Component Details
a. Client Interface:
• Supported HTTP methods (GET, PUT, DELETE)
• Main endpoints (/, /{bucket}, /{bucket}/{object})
b. Handler Layer:
• Request routing and processing
• Error handling
• Response formatting
c. Storage Layer:
• Bucket operations (Create, List, Delete)
• Object operations (Upload, Download, Delete)
• Metadata management
d. File System Layer:
• Physical storage structure
• Metadata storage (CSV files)
Important Details to Highlight
a. API Structure:
• RESTful endpoints
• HTTP methods mapping
• Response codes
b. Validation Rules:
• Bucket naming conventions
• Object key validation
• Existence checks
c. Storage Organization:
• Bucket/object hierarchy
• Metadata structure
• CSV file usage
Implementation Notes
• Clean separation of concerns (handlers, storage, utils)
• RESTful API design
• File system interaction
• Metadata management through CSV files
• Validation and error handling flow