diff options
author | Carlos Martín Nieto <cmn@dwim.me> | 2013-12-18 19:41:01 +0100 |
---|---|---|
committer | Carlos Martín Nieto <cmn@dwim.me> | 2013-12-18 19:41:01 +0100 |
commit | cc098a7994a56a515311255ea7e4d0412b514879 (patch) | |
tree | 77760f362e42c07a32e06bb7ea3e7dea10d54890 /include/git2/sys/refdb_backend.h | |
parent | a7ecd1a9e36df5d6843c1863542c02d777e9e8b5 (diff) | |
download | libgit2-cmn/ref-txn.tar.gz |
wipcmn/ref-txn
Diffstat (limited to 'include/git2/sys/refdb_backend.h')
-rw-r--r-- | include/git2/sys/refdb_backend.h | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/include/git2/sys/refdb_backend.h b/include/git2/sys/refdb_backend.h index 9cf5073fb..c61b9d642 100644 --- a/include/git2/sys/refdb_backend.h +++ b/include/git2/sys/refdb_backend.h @@ -56,6 +56,34 @@ struct git_reference_iterator { git_reference_iterator *iter); }; +/** + * A transaction for a single reference + * + * Any function returning a transaction must set the ref and (if + * available) reflog pointers. + */ +struct git_reference_transaction { + git_refdb *db; + + git_reference *ref; + git_reflog *reflog; + + /** + * Apply the changes to the backend + */ + int (*commit)(git_reference_transaction *txn); + + /** + * Ignore any changes made in the transaction. + */ + int (*rollback)(git_reference_transaction *txn); + + /** + * Free the transaction + */ + void (*free)(git_reference_transaction *txn); +} + /** An instance for a custom backend */ struct git_refdb_backend { unsigned int version; @@ -139,6 +167,16 @@ struct git_refdb_backend { * Remove a reflog. */ int (*reflog_delete)(git_refdb_backend *backend, const char *name); + + /** + * Create a new transaction + */ + int (*transaction_new)(git_reference_transaction *out, git_refdb_backend *backend, const char *name); + + /** + * Commit the changes made in a transaction + */ + int (*transaction_commit)(git_refdb_backend *backend, git_reference_transaction *txn); }; #define GIT_REFDB_BACKEND_VERSION 1 |