Files
post3/todos/POST3-003-repository-layer.md
2026-02-27 11:38:10 +01:00

27 lines
1.1 KiB
Markdown

# POST3-003: Repository layer and Store API
**Status:** Done
**Priority:** P0
**Blocked by:** POST3-002
## Description
Implement the repository layer (raw SQL CRUD for each table) and the high-level Store API that orchestrates them with transactions and chunking logic.
## Acceptance Criteria
- [ ] `repositories/buckets.rs` — create, get_by_name, list, delete, is_empty
- [ ] `repositories/objects.rs` — upsert, get, delete, list (with prefix + pagination)
- [ ] `repositories/blocks.rs` — insert_block, get_all_blocks (ordered by block_index)
- [ ] `repositories/metadata.rs` — insert_batch, get_all (for an object_id)
- [ ] `store.rs` — Store struct with all public methods:
- create_bucket, head_bucket, delete_bucket, list_buckets
- put_object (chunking + MD5 ETag + metadata, all in a transaction)
- get_object (reassemble blocks + fetch metadata)
- head_object, delete_object, list_objects_v2
- get_object_metadata
- [ ] put_object correctly splits body into 1 MiB blocks
- [ ] get_object correctly reassembles blocks in order
- [ ] Overwriting an object deletes old blocks+metadata via CASCADE
- [ ] `cargo check -p post3` passes