Skip to content

Mid-stage locking support#1769

Merged
technoweenie merged 40 commits into
masterfrom
locking-master
Dec 16, 2016
Merged

Mid-stage locking support#1769
technoweenie merged 40 commits into
masterfrom
locking-master

Conversation

@sinbad

@sinbad sinbad commented Dec 14, 2016

Copy link
Copy Markdown
Contributor

This simply aggregates the following PRs:

This is a stable midpoint so is safe for master; locking-master will continue afterwards with further review-friendly staging PRs on locking until more is ready for prime-time.

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.
Locking: move lock funcs to own package
This removes another implicit dependency on global config from API pkg
Locking / API package config usage refactor
@ttaylorr

Copy link
Copy Markdown
Contributor

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 api vs locking package situation. Both of them have Lock structs, and api knows how to interact with HTTP stuff. I think locking should own everything up until making a network request.

I'm having the same concerns about my work in the tq package, so I am just about to start 🍐-ing with @technoweenie to figure out where things should go moving forward.

@sinbad

sinbad commented Dec 14, 2016

Copy link
Copy Markdown
Contributor Author

Yeah I knew I needed to have a Lock struct in locking, and I pared it down to the fields I know we need (client-facing), whereas internally there may be more info we need to deal with edge cases - you had a stab at that in the api package but right now I don't know if those will be the exact ones we'll have in the end. Perhaps we just standardise on the locking version for the moment and accept that the api fields will change (and can be implemented via composition or conversion as fits best) once we've fully explored what's needed for the full workflow.

@technoweenie technoweenie left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@technoweenie technoweenie merged commit bb8b02f into master Dec 16, 2016
chrisd8088 added a commit to chrisd8088/git-lfs that referenced this pull request Apr 26, 2026
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.
chrisd8088 added a commit to chrisd8088/git-lfs that referenced this pull request Apr 26, 2026
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.
chrisd8088 added a commit to chrisd8088/git-lfs that referenced this pull request Apr 26, 2026
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants