diff options
author | Vicent Marti <tanoku@gmail.com> | 2011-03-23 18:44:53 +0200 |
---|---|---|
committer | Vicent Marti <tanoku@gmail.com> | 2011-03-23 18:44:53 +0200 |
commit | f6f72d7ef8091bf1fcf19f284e1db62a43f93381 (patch) | |
tree | 24b7f1fa9bc18ab2bce72e337c3b7f6ca3b51e51 /include/git2/odb.h | |
parent | 08db1efd3d64bda358071612ff3662f4bf1aea61 (diff) | |
download | libgit2-f6f72d7ef8091bf1fcf19f284e1db62a43f93381.tar.gz |
Improve the ODB writing backend
Temporary files when doing streaming writes are now stored inside the
Objects folder, to prevent issues when moving files between
disks/partitions.
Add support for block writes to the ODB again (for those backends that
cannot implement streaming).
Diffstat (limited to 'include/git2/odb.h')
-rw-r--r-- | include/git2/odb.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/include/git2/odb.h b/include/git2/odb.h index 1a0f0e64..aa48b053 100644 --- a/include/git2/odb.h +++ b/include/git2/odb.h @@ -157,6 +157,26 @@ GIT_EXTERN(int) git_odb_read_header(size_t *len_p, git_otype *type_p, git_odb *d GIT_EXTERN(int) git_odb_exists(git_odb *db, const git_oid *id); /** + * Write an object directly into the ODB + * + * This method writes a full object straight into the ODB. + * For most cases, it is preferred to write objects through a write + * stream, which is both faster and less memory intensive, specially + * for big objects. + * + * This method is provided for compatibility with custom backends + * which are not able to support streaming writes + * + * @param oid pointer to store the OID result of the write + * @param odb object database where to store the object + * @param data buffer with the data to storr + * @param len size of the buffer + * @param type type of the data to store + * @return 0 on success; error code otherwise + */ +GIT_EXTERN(int) git_odb_write(git_oid *oid, git_odb *odb, const void *data, size_t len, git_otype type); + +/** * Open a stream to write an object into the ODB * * The type and final length of the object must be specified |