Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2015-06-01 20:17:03 +0300
committerCarlos Martín Nieto <cmn@dwim.me>2015-08-12 05:09:09 +0300
commitb1667039640ba3464ea0e2d13ad28c9244d80b4d (patch)
treee394808939d7545258ee1a757358a286d281a124 /include
parent3ce9e4d23572718deeab438ce149013eece57371 (diff)
config: implement basic transactional support
When a configuration file is locked, any updates made to it will be done to the in-memory copy of the file. This allows for multiple updates to happen while we hold the lock, preventing races during complex config-file manipulation.
Diffstat (limited to 'include')
-rw-r--r--include/git2/sys/config.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/git2/sys/config.h b/include/git2/sys/config.h
index 044e34417..4dad6da42 100644
--- a/include/git2/sys/config.h
+++ b/include/git2/sys/config.h
@@ -67,6 +67,20 @@ struct git_config_backend {
int (*iterator)(git_config_iterator **, struct git_config_backend *);
/** Produce a read-only version of this backend */
int (*snapshot)(struct git_config_backend **, struct git_config_backend *);
+ /**
+ * Lock this backend.
+ *
+ * Prevent any writes to the data store backing this
+ * backend. Any updates must not be visible to any other
+ * readers.
+ */
+ int (*lock)(struct git_config_backend *);
+ /**
+ * Unlock the data store backing this backend. If success is
+ * true, the changes should be committed, otherwise rolled
+ * back.
+ */
+ int (*unlock)(struct git_config_backend *, int success);
void (*free)(struct git_config_backend *);
};
#define GIT_CONFIG_BACKEND_VERSION 1