diff options
author | Carlos Martín Nieto <cmn@dwim.me> | 2015-06-01 19:17:03 +0200 |
---|---|---|
committer | Carlos Martín Nieto <cmn@dwim.me> | 2015-08-12 04:09:09 +0200 |
commit | b1667039640ba3464ea0e2d13ad28c9244d80b4d (patch) | |
tree | e394808939d7545258ee1a757358a286d281a124 /include/git2 | |
parent | 3ce9e4d23572718deeab438ce149013eece57371 (diff) | |
download | libgit2-b1667039640ba3464ea0e2d13ad28c9244d80b4d.tar.gz |
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/git2')
-rw-r--r-- | include/git2/sys/config.h | 14 |
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 |