summaryrefslogtreecommitdiff
path: root/src/filelock.c
Commit message (Collapse)AuthorAgeFilesLines
* Rewrite all file IO for more performanceVicent Marti2011-02-211-132/+0
| | | | | | | | | | | | | | | | | | | | The new `git_filebuf` structure provides atomic high-performance writes to disk by using a write cache, and optionally a double-buffered scheme through a worker thread (not enabled yet). Writes can be done 3-layered, like in git.git (user code -> write cache -> disk), or 2-layered, by writing directly on the cache. This makes index writing considerably faster. The `git_filebuf` structure contains all the old functionality of `git_filelock` for atomic file writes and reads. The `git_filelock` structure has been removed. Additionally, the `git_filebuf` API allows to automatically hash (SHA1) all the data as it is written to disk (hashing is done smartly on big chunks to improve performance). Signed-off-by: Vicent Marti <tanoku@gmail.com>
* Small source code readability improvements.nulltoken2010-12-051-3/+3
| | | | Replaced magic number "0" with GIT_SUCCESS constant wherever it made sense.
* Add support for atomic file lockingVicent Marti2010-08-121-0/+132
The struct 'git_filelock' represents an atomically-locked file, git-style. Locked files can be modified atomically through the new file lock interface: int git_filelock_init(git_filelock *lock, const char *path); int git_filelock_lock(git_filelock *lock, int append); void git_filelock_unlock(git_filelock *lock); int git_filelock_commit(git_filelock *lock); int git_filelock_write(git_filelock *lock, const char *buffer, size_t length); Signed-off-by: Vicent Marti <tanoku@gmail.com>