-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
S3 Conditional Operations
chrislusf edited this page Aug 23, 2025
·
1 revision
SeaweedFS supports AWS S3-compatible conditional headers for safe concurrent access patterns, optimistic locking, and efficient conditional operations.
| Header | Applies To | Condition | Use Case |
|---|---|---|---|
| If-Match | GET, PUT, COPY | ETag matches | Ensure object hasn't changed |
| If-None-Match | GET, PUT, COPY | ETag doesn't match | Prevent overwrites, caching |
| If-Modified-Since | GET, COPY | Modified after date | Conditional downloads |
| If-Unmodified-Since | GET, PUT, COPY | Not modified after date | Safe modifications |
# First, get the object and note its ETag
curl -I "http://localhost:8333/mybucket/myfile.txt"
# Response: ETag: "d41d8cd98f00b204e9800998ecf8427e"
# Conditional GET - only download if object changed
curl -H "If-None-Match: \"d41d8cd98f00b204e9800998ecf8427e\"" \
"http://localhost:8333/mybucket/myfile.txt"# Safe update - only modify if object hasn't changed
curl -X PUT -H "If-Match: \"d41d8cd98f00b204e9800998ecf8427e\"" \
-H "Content-Type: text/plain" \
--data "Updated content" \
"http://localhost:8333/mybucket/myfile.txt"
# Prevent overwrites - only create if object doesn't exist
curl -X PUT -H "If-None-Match: *" \
-H "Content-Type: text/plain" \
--data "New file content" \
"http://localhost:8333/mybucket/newfile.txt"# Only download if modified after specific date
curl -H "If-Modified-Since: Wed, 15 Jan 2024 10:00:00 GMT" \
"http://localhost:8333/mybucket/log-file.txt"# Update only if not modified since last read
curl -X PUT \
-H "If-Unmodified-Since: Wed, 15 Jan 2024 10:00:00 GMT" \
-H "Content-Type: text/plain" \
--data "Updated content" \
"http://localhost:8333/mybucket/document.txt"# Copy only if source object hasn't changed
curl -X PUT \
-H "x-amz-copy-source: /source-bucket/source-file.txt" \
-H "x-amz-copy-source-if-match: \"source-etag\"" \
"http://localhost:8333/dest-bucket/dest-file.txt"| Status Code | Condition | Meaning |
|---|---|---|
| 200 OK | Condition met | Operation succeeded |
| 304 Not Modified | If-None-Match matched | Object unchanged (GET only) |
| 412 Precondition Failed | Condition not met | Operation blocked by condition |
- Replication
- Store file with a Time To Live
- Failover Master Server
- Erasure coding for warm storage
- Server Startup via Systemd
- Environment Variables
- Filer Setup
- Directories and Files
- File Operations Quick Reference
- Data Structure for Large Files
- Filer Data Encryption
- Filer Commands and Operations
- Filer JWT Use
- TUS Resumable Uploads
- Filer Cassandra Setup
- Filer Redis Setup
- Super Large Directories
- Path-Specific Filer Store
- Choosing a Filer Store
- Customize Filer Store
- Migrate to Filer Store
- Add New Filer Store
- Filer Store Replication
- Filer Active Active cross cluster continuous synchronization
- Filer as a Key-Large-Value Store
- Path Specific Configuration
- Filer Change Data Capture
- Cloud Drive Benefits
- Cloud Drive Architecture
- Configure Remote Storage
- Mount Remote Storage
- Cache Remote Storage
- Cloud Drive Quick Setup
- Gateway to Remote Object Storage
- Amazon S3 API
- S3 Conditional Operations
- S3 CORS
- S3 Object Lock and Retention
- S3 Object Versioning
- S3 API Benchmark
- S3 API FAQ
- S3 Bucket Quota
- S3 Rate Limiting
- S3 API Audit log
- S3 Nginx Proxy
- Docker Compose for S3
- S3 Configuration - Start Here
-
S3 Credentials (
-s3.config) -
OIDC Integration (
-s3.iam.config) - Amazon IAM API
- AWS IAM CLI
- AWS CLI with SeaweedFS
- s3cmd with SeaweedFS
- rclone with SeaweedFS
- restic with SeaweedFS
- nodejs with Seaweed S3
- Hadoop Compatible File System
- run Spark on SeaweedFS
- run HBase on SeaweedFS
- run Presto on SeaweedFS
- Hadoop Benchmark
- HDFS via S3 connector
- Async Replication to another Filer [Deprecated]
- Async Backup
- Async Filer Metadata Backup
- Async Replication to Cloud [Deprecated]
- Kubernetes Backups and Recovery with K8up
- Structured Data Lake with SMQ and SQL
- Seaweed Message Queue
- SQL Queries on Message Queue
- SQL Quick Reference
- PostgreSQL-compatible Server weed db
- Pub-Sub to SMQ to SQL
- Kafka to Kafka Gateway to SMQ to SQL
- Large File Handling
- Optimization
- Volume Management
- Tiered Storage
- Cloud Tier
- Cloud Monitoring
- Load Command Line Options from a file
- SRV Service Discovery
- Volume Files Structure