odb: wrap the stream reading and writing functions

This is in preparation for moving the hashing to the frontend, which
requires us to handle the incoming data before passing it to the
backend's stream.
odb: perform the stream hashing in the frontend

Hash the data as it's coming into the stream and tell the backend what
its name is when finalizing the write. This makes it consistent with
the way a plain git_odb_write() performs the write.
odb: remove a duplicate object header formatting function
odb: make it clearer that the id is calculated in the frontend

The frontend is in charge of calculating the id of the objects. Thus
the backends should treat it as a read-only value. The positioning in
the function signature made it seem as though it was an output
parameter.

Make the id const and move it from the front to behind the subject
(backend or stream).
odb: document git_odb_stream

Clarify the role of each function and in particular mention that there
is no need for the backend or stream to worry about the object's id,
as it will be given when `finalize_write` is called.
odb: avoid hashing twice in and edge case

If none of the backends support direct writes and we must stream the
whole file, we already know what the object's id should be; so use the
stream's functions directly, bypassing the frontend's hashing and
overwriting of our existing id.
odb: Straighten oid prefix handling
Merge pull request #1792 from libgit2/ntk/bug/prefix_size

odb: Straighten oid prefix handling
Merge pull request #1785 from libgit2/cmn/odb-hash-frontend

odb: move hashing to the frontend for streaming