Mid-stage locking support#1769
Conversation
Could do this automatically using reflection? This is faster for now.
Some refactoring to make it cleaner when doing this
This actually didn’t cause any decoding issues to leave old data at the end, but we should be efficient with on-disk data.
Key value store
Locking: move lock funcs to own package
This removes another implicit dependency on global config from API pkg
Locking / API package config usage refactor
API version currently has some fields which may go away, or which may be solely internal in future. For now only expose the fields which are always useful.
Implement local lock cache, support querying it
|
Thanks for opening this. All of the individual PRs in this series have looked good to me, but before we ship this package I want to figure out the I'm having the same concerns about my work in the |
|
Yeah I knew I needed to have a |
technoweenie
left a comment
There was a problem hiding this comment.
I think we should go ahead and ship this to master. I too want to rethink how the api package works, but I don't want to keep both this and tq-master up in the air for too long.
In PR git-lfs#1769 we first developed our "locking" package, and in commit 4910706 of that PR we introduced the package's NewClient() function to initialize and return a Client structure. At the conclusion of PR git-lfs#1769, the NewClient() function invoked both the NewLockCache() function, which was also located in the "locking" package, and the MkdirAll() function from the "os" package of the Go standard library. The NewClient() function called these functions in order to create the "lockcache.db" file we store in the ".git/lfs" directory. Both the NewLockCache() and MkdirAll() functions could return error conditions, and so might return non-nil "error" values. The NewClient() function checked for these possibilities, and in the case of an error, would itself return a non-nil "error" value. However, in commit a998543 of PR git-lfs#1839 we revised the NewClient() function so that it did not create a lock cache file. Instead, this became the responsibility of a new Client structure method named SetupFileCache(). We also added a function to our "commands" package which first calls the "locking" package's NewClient() function, and then invokes the SetupFileCache() method on the newly initialized Client structure. As a result, none of the remaining initialization steps in the NewClient() function of the "locking" package could encounter an error condition, and so there was no specific need for the function to continue to return an "error" value. As this remains the case, we can simplify the NewClient() function in our "locking" package by just eliminating its "error" return value. We then update all the callers of this function, including those in our Go test functions, as they no longer need to check for an "error" return value from the function.
In PR git-lfs#1769 we first developed our "locking" package, and in commit 4910706 of that PR we introduced the package's NewClient() function to initialize and return a Client structure. At the conclusion of PR git-lfs#1769, the NewClient() function invoked both the NewLockCache() function, which was also located in the "locking" package, and the MkdirAll() function from the "os" package of the Go standard library. The NewClient() function called these functions in order to create the "lockcache.db" file we store in the ".git/lfs" directory. Both the NewLockCache() and MkdirAll() functions could return error conditions, and so might return non-nil "error" values. The NewClient() function checked for these possibilities, and in the case of an error, would itself return a non-nil "error" value. However, in commit a998543 of PR git-lfs#1839 we revised the NewClient() function so that it did not create a lock cache file. Instead, this became the responsibility of a new Client structure method named SetupFileCache(). We also added a function to our "commands" package which first calls the "locking" package's NewClient() function, and then invokes the SetupFileCache() method on the newly initialized Client structure. As a result, none of the remaining initialization steps in the NewClient() function of the "locking" package could encounter an error condition, and so there was no specific need for the function to continue to return an "error" value. As this remains the case, we can simplify the NewClient() function in our "locking" package by just eliminating its "error" return value. We then update all the callers of this function, including those in our Go test functions, as they no longer need to check for an "error" return value from the function.
In PR git-lfs#1769 we first developed our "locking" package, and in commit 4910706 of that PR we introduced the package's NewClient() function to initialize and return a Client structure. At the conclusion of PR git-lfs#1769, the NewClient() function invoked both the NewLockCache() function, which was also located in the "locking" package, and the MkdirAll() function from the "os" package of the Go standard library. The NewClient() function called these functions in order to create the "lockcache.db" file we store in the ".git/lfs" directory. Both the NewLockCache() and MkdirAll() functions could return error conditions, and so might return non-nil "error" values. The NewClient() function checked for these possibilities, and in the case of an error, would itself return a non-nil "error" value. However, in commit a998543 of PR git-lfs#1839 we revised the NewClient() function so that it did not create a lock cache file. Instead, this became the responsibility of a new Client structure method named SetupFileCache(). We also added a function to our "commands" package which first calls the "locking" package's NewClient() function, and then invokes the SetupFileCache() method on the newly initialized Client structure. As a result, none of the remaining initialization steps in the NewClient() function of the "locking" package could encounter an error condition, and so there was no specific need for the function to continue to return an "error" value. As this remains the case, we can simplify the NewClient() function in our "locking" package by just eliminating its "error" return value. We then update all the callers of this function, including those in our Go test functions, as they no longer need to check for an "error" return value from the function.
This simply aggregates the following PRs:
This is a stable midpoint so is safe for
master;locking-masterwill continue afterwards with further review-friendly staging PRs on locking until more is ready for prime-time.