summaryrefslogtreecommitdiff
path: root/include/git2/sys/odb_backend.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/git2/sys/odb_backend.h')
-rw-r--r--include/git2/sys/odb_backend.h24
1 files changed, 18 insertions, 6 deletions
diff --git a/include/git2/sys/odb_backend.h b/include/git2/sys/odb_backend.h
index 8039a5b82..1fc3c3159 100644
--- a/include/git2/sys/odb_backend.h
+++ b/include/git2/sys/odb_backend.h
@@ -35,11 +35,8 @@ struct git_odb_backend {
int (* read)(
void **, size_t *, git_otype *, git_odb_backend *, const git_oid *);
- /* To find a unique object given a prefix
- * of its oid.
- * The oid given must be so that the
- * remaining (GIT_OID_HEXSZ - len)*4 bits
- * are 0s.
+ /* To find a unique object given a prefix of its oid. The oid given
+ * must be so that the remaining (GIT_OID_HEXSZ - len)*4 bits are 0s.
*/
int (* read_prefix)(
git_oid *, void **, size_t *, git_otype *,
@@ -64,6 +61,9 @@ struct git_odb_backend {
int (* exists)(
git_odb_backend *, const git_oid *);
+ int (* exists_prefix)(
+ git_oid *, git_odb_backend *, const git_oid *, size_t);
+
/**
* If the backend implements a refreshing mechanism, it should be exposed
* through this endpoint. Each call to `git_odb_refresh()` will invoke it.
@@ -81,7 +81,7 @@ struct git_odb_backend {
int (* writepack)(
git_odb_writepack **, git_odb_backend *, git_odb *odb,
- git_transfer_progress_callback progress_cb, void *progress_payload);
+ git_transfer_progress_cb progress_cb, void *progress_payload);
void (* free)(git_odb_backend *);
};
@@ -89,6 +89,18 @@ struct git_odb_backend {
#define GIT_ODB_BACKEND_VERSION 1
#define GIT_ODB_BACKEND_INIT {GIT_ODB_BACKEND_VERSION}
+/**
+ * Initializes a `git_odb_backend` with default values. Equivalent to
+ * creating an instance with GIT_ODB_BACKEND_INIT.
+ *
+ * @param opts the `git_odb_backend` struct to initialize.
+ * @param version Version the struct; pass `GIT_ODB_BACKEND_VERSION`
+ * @return Zero on success; -1 on failure.
+ */
+GIT_EXTERN(int) git_odb_init_backend(
+ git_odb_backend *backend,
+ unsigned int version);
+
GIT_EXTERN(void *) git_odb_backend_malloc(git_odb_backend *backend, size_t len);
GIT_END_DECL