Repository navigation
Conversation
Co-authored-by: Dhruvil <hey@mdhruvil.com>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile SummaryAdded comprehensive documentation for a hybrid storage architecture that addresses current DOFS limitations. The document proposes using R2 for large object storage and DO SQLite for metadata/indexes, which would reduce storage costs by 10x and enable unlimited repository sizes. Key Changes:
Documentation Quality: Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Client as Git Client
participant Worker as Cloudflare Worker
participant DO as Durable Object<br/>(SQLite)
participant R2 as R2 Bucket
Note over Client,R2: Git Push Flow (receive-pack)
Client->>Worker: POST /git-receive-pack<br/>(packfile data)
Worker->>DO: Forward packfile
DO->>R2: PUT packfile<br/>({owner}/{repo}/packs/{pack_id}.pack)
R2-->>DO: Success
DO->>DO: Index packfile<br/>(parse object offsets)
DO->>DO: INSERT packfiles metadata
loop For each object in packfile
DO->>DO: INSERT INTO objects<br/>(oid, type, size, pack_id, offset)
end
DO->>DO: UPDATE refs<br/>(branch pointer)
DO-->>Worker: Report status
Worker-->>Client: Success response
Note over Client,R2: Git Fetch Flow (upload-pack)
Client->>Worker: POST /git-upload-pack<br/>(wants/haves)
Worker->>DO: Forward request
DO->>DO: SELECT * FROM objects<br/>WHERE oid IN (wants)
alt Small inline object (<64KB)
DO->>DO: Read from objects.data
DO-->>Worker: Object data
else Large loose object
DO->>R2: GET r2_key
R2-->>DO: Object data
DO-->>Worker: Object data
else Packfile object
DO->>R2: GET pack with range<br/>(offset, length)
R2-->>DO: Object bytes
DO->>DO: Decompress object
DO-->>Worker: Object data
end
Worker-->>Client: Packfile stream
Note over Client,R2: Object Write (loose object)
Client->>DO: Write object (>64KB, <1MB blob)
alt Inline storage
DO->>DO: INSERT INTO objects<br/>(data=blob, storage_type='inline')
else R2 loose storage
DO->>R2: PUT {owner}/{repo}/objects/{oid}
R2-->>DO: Success
DO->>DO: INSERT INTO objects<br/>(r2_key, storage_type='r2_loose')
end
DO-->>Client: OID
|
Summary
Implemented a hybrid storage strategy for Gitflare using R2 and Durable Object SQLite to address current storage limitations:
Key improvements: