Added IBucket.open_write() - #148
Conversation
|
Caution Review failedThe pull request is closed. 📝 WalkthroughSummary by CodeRabbit
WalkthroughAdds a new streaming write API open_write across the bucket interface and implementations. IBucket introduces the abstract method and stricter validation base. FSBucket implements atomic temp-file writes. MemoryBucket implements in-memory sink. MinioBucket implements streaming multipart uploads via a background thread. CachedImmutableBucket exposes open_write but raises UnsupportedOperation. Tests expanded to cover open_write (incl. Parquet). Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Client
participant IBucket as IBucket (interface)
participant SyncWrap as AbstractAppendOnlySynchronizedBucket
participant Impl as Base Bucket Impl
Client->>IBucket: open_write(name)
note over IBucket: Implemented by SyncWrap or concrete bucket
IBucket->>SyncWrap: open_write(name)
SyncWrap->>SyncWrap: acquire per-object lock
SyncWrap->>Impl: exists(name)?
alt exists
SyncWrap-->>Client: raise FileExistsError
SyncWrap->>SyncWrap: release lock
else not exists
SyncWrap->>Impl: open_write(name)
Impl-->>SyncWrap: Context-managed BinaryIO
SyncWrap-->>Client: yield sink
Client-->>SyncWrap: close context
SyncWrap->>SyncWrap: release lock
end
sequenceDiagram
autonumber
actor Client
participant MinioB as MinioBucket
participant Writer as _QueueWriter
participant Uploader as Uploader Thread
participant MinIO as MinIO Server
Client->>MinioB: open_write(name)
MinioB->>Uploader: start(_uploader with _QueueReader)
MinioB-->>Client: yield Writer (BinaryIO)
loop while writing
Client->>Writer: write(data chunk)
Writer->>Uploader: enqueue chunk
end
Client->>Writer: close()
Writer->>Uploader: signal EOF
Uploader->>MinIO: put_object(length=-1, part_size=MIN_PART_SIZE, stream=reader)
alt upload success
Uploader-->>MinioB: ok
else upload error
Uploader-->>MinioB: propagate exception on exit
end
sequenceDiagram
autonumber
actor Client
participant FSB as FSBucket
participant FS as Filesystem
Client->>FSB: open_write(name)
FSB->>FS: create tmp file in .bucketbase_tmp/
FSB-->>Client: yield binary sink to tmp file
Client-->>FSB: close context
FSB->>FS: flush/close tmp
FSB->>FS: atomic rename tmp -> final
alt error
FSB->>FS: remove tmp
FSB-->>Client: raise
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Poem
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. 📜 Recent review detailsConfiguration used: CodeRabbit UI 💡 Knowledge Base configuration:
You can enable these sources in your CodeRabbit configuration. ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (11)
✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
No description provided.