pub trait WritableObjectStore: ObjectStore {
// Required methods
fn write(
&self,
kind: ObjectKind,
data: &[u8],
options: WriteOptions,
) -> Result<ObjectId>;
fn freshen(&self, oid: &ObjectId) -> Result<bool>;
// Provided method
fn write_stream(
&self,
kind: ObjectKind,
size: u64,
reader: &mut dyn Read,
options: WriteOptions,
) -> Result<ObjectId> { ... }
}Expand description
Object storage that supports inserting new objects.
Required Methods§
Sourcefn write(
&self,
kind: ObjectKind,
data: &[u8],
options: WriteOptions,
) -> Result<ObjectId>
fn write( &self, kind: ObjectKind, data: &[u8], options: WriteOptions, ) -> Result<ObjectId>
Store canonical object bytes and return the object id.
If the object already exists, returns the existing id without replacing stored bytes (Git loose-store idempotence).
§Errors
Returns I/O, hashing, or validation errors from the backend.
Provided Methods§
Sourcefn write_stream(
&self,
kind: ObjectKind,
size: u64,
reader: &mut dyn Read,
options: WriteOptions,
) -> Result<ObjectId>
fn write_stream( &self, kind: ObjectKind, size: u64, reader: &mut dyn Read, options: WriteOptions, ) -> Result<ObjectId>
Store an object from a byte stream of known uncompressed size.
Default implementation reads the stream into memory and calls Self::write.
§Errors
Same as Self::write, plus stream read failures.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".