mirror of
https://git.proxmox.com/git/libgit2
synced 2026-08-26 18:40:39 +00:00
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.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user