Commit 97f9a5f0 by Edward Thomson

odb: provide length and type with streaming read

The streaming read functionality should provide the length and the type
of the object, like the normal read functionality does.
parent c74e9271
......@@ -357,11 +357,18 @@ GIT_EXTERN(void) git_odb_stream_free(git_odb_stream *stream);
* @see git_odb_stream
*
* @param out pointer where to store the stream
* @param len pointer where to store the length of the object
* @param type pointer where to store the type of the object
* @param db object database where the stream will read from
* @param oid oid of the object the stream will read from
* @return 0 if the stream was created; error code otherwise
*/
GIT_EXTERN(int) git_odb_open_rstream(git_odb_stream **out, git_odb *db, const git_oid *oid);
GIT_EXTERN(int) git_odb_open_rstream(
git_odb_stream **out,
size_t *len,
git_otype *type,
git_odb *db,
const git_oid *oid);
/**
* Open a stream for writing a pack file to the ODB.
......
......@@ -56,7 +56,8 @@ struct git_odb_backend {
git_odb_stream **, git_odb_backend *, git_off_t, git_otype);
int (* readstream)(
git_odb_stream **, git_odb_backend *, const git_oid *);
git_odb_stream **, size_t *, git_otype *,
git_odb_backend *, const git_oid *);
int (* exists)(
git_odb_backend *, const git_oid *);
......
......@@ -1396,7 +1396,12 @@ void git_odb_stream_free(git_odb_stream *stream)
stream->free(stream);
}
int git_odb_open_rstream(git_odb_stream **stream, git_odb *db, const git_oid *oid)
int git_odb_open_rstream(
git_odb_stream **stream,
size_t *len,
git_otype *type,
git_odb *db,
const git_oid *oid)
{
size_t i, reads = 0;
int error = GIT_ERROR;
......@@ -1409,7 +1414,7 @@ int git_odb_open_rstream(git_odb_stream **stream, git_odb *db, const git_oid *oi
if (b->readstream != NULL) {
++reads;
error = b->readstream(stream, b, oid);
error = b->readstream(stream, len, type, b, oid);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment