-
Notifications
You must be signed in to change notification settings - Fork 251
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
Object store iface #165
Object store iface #165
Conversation
262d8a6
to
5a7a618
Compare
75a4af1
to
175f3dc
Compare
175f3dc
to
e248c28
Compare
This needs tests but I'd like feedback too. |
e248c28
to
cf4976b
Compare
} | ||
|
||
/// Prepare an object with the given key to be written. See `object-writer`. | ||
get-object: function(key: string) -> expected<object-reader, error> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought we were going to have a store
resource rather than putting the object accessors directly on the storage interface? I know we are skipping multiple store implementations on day one but it would be good to have the design aligned to the eventual plan so as to minimise change and avoid baking in assumptions.
use crate::wit::spin_object_store; | ||
use cap_std::{ambient_authority, fs::OpenOptions}; | ||
|
||
pub type FileObjectStoreData = ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't quite get the different roles of FOS and FOSData - are clearer names available or is this an artefact of the bindgen stuff? (I vaguely recall being puzzled by something similar in HTTP so maybe the latter?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly an artifact of wit-bindgen, though we could organize them better.
crates/object-store/src/file.rs
Outdated
let size = file.read(buf).map_err(|err| err.to_string())?; | ||
u64::try_from(size).map_err(|err| err.to_string()) | ||
} | ||
None => Err("file closed".to_string()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Context or anything else to help with diagnostics, or does that belong at a higher level?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above for this specific error, but for errors in general they are being passed to the guest so have to pass through the wasm barrier. I went for string errors for simplicity.
cf4976b
to
0810702
Compare
d1498a6
to
5edb438
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking forward to playing around with this, thanks!
I think this needs a rebase, but LGTM.
- Includes a simple file-based implementation.
re: #48