Skip to content

Check available disk space before writing objects #7

@deepjoy

Description

@deepjoy

Description

The filesystem storage backend does not currently verify that there is enough disk space before writing an object. Large uploads could fail partway through, leaving partial files on disk.

Location

  • src/storage/filesystem.rs:152

Details

The put() method should check available disk space before starting a write and reject the request with an appropriate S3 error if the object would not fit.

Things to consider:

  • Use statvfs or equivalent to check free space
  • Account for the incoming Content-Length header
  • Consider a configurable low-watermark threshold
  • Handle the case where Content-Length is unknown (chunked uploads)
  • Clean up partial writes on failure (may already be handled)

Acceptance Criteria

  • Check available disk space before starting a write in put()
  • Return an appropriate S3 error (e.g., InsufficientStorage or similar) when space is low
  • Add configurable low-watermark threshold
  • Ensure partial files are cleaned up on failure

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions