Trait git_odb::Write [−][src]
pub trait Write { type Error: Error + From<Error>; fn write_stream(
&self,
kind: Kind,
size: u64,
from: impl Read,
hash: Kind
) -> Result<ObjectId, Self::Error>; fn write(
&self,
object: &Object,
hash: Kind
) -> Result<ObjectId, Self::Error> { ... } fn write_buf(
&self,
object: Kind,
from: &[u8],
hash: Kind
) -> Result<ObjectId, Self::Error> { ... } }
Describe the capability to write git objects into an object store.
Associated Types
type Error: Error + From<Error>
[src]
The error type used for all trait methods.
Note the default implementations require the From<io::Error>
bound.
Required methods
fn write_stream(
&self,
kind: Kind,
size: u64,
from: impl Read,
hash: Kind
) -> Result<ObjectId, Self::Error>
[src]
&self,
kind: Kind,
size: u64,
from: impl Read,
hash: Kind
) -> Result<ObjectId, Self::Error>
As write
, but takes an input stream.
This is commonly used for writing blobs directly without reading them to memory first.
Provided methods
fn write(&self, object: &Object, hash: Kind) -> Result<ObjectId, Self::Error>
[src]
Write object
using the given kind of hash
into the database,
returning id to reference it in subsequent reads.
fn write_buf(
&self,
object: Kind,
from: &[u8],
hash: Kind
) -> Result<ObjectId, Self::Error>
[src]
&self,
object: Kind,
from: &[u8],
hash: Kind
) -> Result<ObjectId, Self::Error>
As write
, but takes an object
kind along with its encoded bytes.
Implementors
impl Write for git_odb::compound::Db
[src]
impl Write for git_odb::compound::Db
[src]type Error = Error
fn write(&self, object: &Object, hash: Kind) -> Result<ObjectId, Self::Error>
[src]
fn write_buf(
&self,
object: Kind,
from: &[u8],
hash: Kind
) -> Result<ObjectId, Self::Error>
[src]
&self,
object: Kind,
from: &[u8],
hash: Kind
) -> Result<ObjectId, Self::Error>
fn write_stream(
&self,
kind: Kind,
size: u64,
from: impl Read,
hash: Kind
) -> Result<ObjectId, Self::Error>
[src]
&self,
kind: Kind,
size: u64,
from: impl Read,
hash: Kind
) -> Result<ObjectId, Self::Error>
impl Write for git_odb::linked::Db
[src]
impl Write for git_odb::linked::Db
[src]type Error = Error
fn write(&self, object: &Object, hash: Kind) -> Result<ObjectId, Self::Error>
[src]
fn write_buf(
&self,
object: Kind,
from: &[u8],
hash: Kind
) -> Result<ObjectId, Self::Error>
[src]
&self,
object: Kind,
from: &[u8],
hash: Kind
) -> Result<ObjectId, Self::Error>
fn write_stream(
&self,
kind: Kind,
size: u64,
from: impl Read,
hash: Kind
) -> Result<ObjectId, Self::Error>
[src]
&self,
kind: Kind,
size: u64,
from: impl Read,
hash: Kind
) -> Result<ObjectId, Self::Error>
impl Write for git_odb::loose::Db
[src]
impl Write for git_odb::loose::Db
[src]type Error = Error
fn write_buf(
&self,
kind: Kind,
from: &[u8],
hash: Kind
) -> Result<ObjectId, Self::Error>
[src]
&self,
kind: Kind,
from: &[u8],
hash: Kind
) -> Result<ObjectId, Self::Error>
Write the given buffer in from
to disk in one syscall at best.
This will cost at least 4 IO operations.
fn write_stream(
&self,
kind: Kind,
size: u64,
from: impl Read,
hash: Kind
) -> Result<ObjectId, Self::Error>
[src]
&self,
kind: Kind,
size: u64,
from: impl Read,
hash: Kind
) -> Result<ObjectId, Self::Error>
Write the given stream in from
to disk with at least one syscall.
This will cost at least 4 IO operations.