libgit2

git_odb_stream

Version:

A stream to read/write from a backend.

This represents a stream of data being written to or read from a backend. When writing, the frontend functions take care of calculating the object's id and all finalize_write needs to do is store the object with the id it is passed.

Signature

typedef struct git_odb_stream { git_odb_backend *backend unsigned int mode void *hash_ctx git_off_t declared_size git_off_t received_bytes int (*)(git_odb_stream *, char *, size_t) read int (*)(git_odb_stream *, const char *, size_t) write int (*)(git_odb_stream *, const git_oid *) finalize_write void (*)(git_odb_stream *) free };

Members

unsigned int
mode
void *
hash_ctx
declared_size
received_bytes
int (*)(git_odb_stream *, char *, size_t)
read

Write at most len bytes into buffer and advance the stream.

int (*)(git_odb_stream *, const char *, size_t)
write

Write len bytes from buffer into the stream.

int (*)(git_odb_stream *, const git_oid *)
finalize_write

Store the contents of the stream as an object with the id specified in oid.

This method might not be invoked if:

  • an error occurs earlier with the write callback,
  • the object referred to by oid already exists in any backend, or
  • the final number of received bytes differs from the size declared with git_odb_open_wstream()
void (*)(git_odb_stream *)
free

Free the stream's memory.

This method might be called without a call to finalize_write if an error occurs or if the object is already present in the ODB.

Parameter To

Versions