From ab8d9242f54e2c570f86a45a509b9420911a4d44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Sat, 28 Jun 2014 06:39:38 +0200 Subject: Introduce reference transactions A transaction allows you to lock multiple references and set up changes for them before applying the changes all at once (or as close as the backend supports). This can be used for replication purposes, or for making sure some operations run when the reference is locked and thus cannot be changed. --- include/git2/sys/refdb_backend.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'include/git2/sys/refdb_backend.h') diff --git a/include/git2/sys/refdb_backend.h b/include/git2/sys/refdb_backend.h index 3b216a287..d943e550f 100644 --- a/include/git2/sys/refdb_backend.h +++ b/include/git2/sys/refdb_backend.h @@ -153,6 +153,19 @@ struct git_refdb_backend { * Remove a reflog. */ int (*reflog_delete)(git_refdb_backend *backend, const char *name); + + /** + * Lock a reference. The opaque parameter will be passed to the unlock function + */ + int (*lock)(void **payload_out, git_refdb_backend *backend, const char *refname); + + /** + * Unlock a reference. Only one of target or symbolic_target + * will be set. success indicates whether to update the + * reference or discard the lock (if it's false) + */ + int (*unlock)(git_refdb_backend *backend, void *payload, int success, int update_reflog, + const git_reference *ref, const git_signature *sig, const char *message); }; #define GIT_REFDB_BACKEND_VERSION 1 -- cgit v1.2.1