Skip to content

docs: improve storage structure to eliminate redundancy #100

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 7, 2025

Conversation

nullcoder
Copy link
Owner

Summary

Improve the R2 storage structure to eliminate redundancy by storing all blobs in the versions/ directory rather than duplicating the current version in a separate blobs/ directory.

Changes

  • 📁 Updated storage structure to use only metadata/ and versions/ directories
  • 🔧 Added current_version field to metadata to track the active version timestamp
  • 📝 Updated API documentation to reflect blob fetching from versions directory
  • ✨ Enhanced version history documentation with implementation details
  • 📚 Added storage design notes explaining the benefits

Benefits

  1. No redundancy - Each blob stored only once
  2. Simpler updates - Just add new timestamp file and update metadata pointer
  3. Atomic operations - No need to copy/move files between directories
  4. Better consistency - Single source of truth for all content
  5. Easier cleanup - When pruning old versions, just delete timestamp files

Implementation Impact

When this design is implemented:

  • GET /api/blobs/{id} will read metadata first to get current_version, then fetch from versions/{id}/{current_version}.bin
  • PUT /api/gists/{id} will create new file at versions/{id}/{new-timestamp}.bin and update metadata
  • No migration needed for new projects, but existing projects would need to move blobs from blobs/ to versions/

🤖 Generated with Claude Code

- Remove separate blobs/ directory, store everything under versions/
- Track current version via metadata.current_version field
- Eliminate need to copy/move blobs when creating versions
- Simplify update operations - just add new timestamp file
- Add storage design notes explaining the benefits
@nullcoder nullcoder merged commit 1e97b70 into main Jun 7, 2025
1 check was pending
@nullcoder nullcoder deleted the docs/improve-storage-structure branch June 7, 2025 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant