Replace lockfile with reference lock
Updates content service to handle lock errors and return them to the client. The client remote handler has been updated to retry when a resource is locked until the resource is unlocked or the expected resource exists. Signed-off-by: Derek McGowan <derek@mcgstyle.net>
This commit is contained in:
@@ -21,6 +21,12 @@ var (
|
||||
// Use IsExists(err) to detect this condition.
|
||||
ErrExists = errors.New("content: exists")
|
||||
|
||||
// ErrLocked is returned when content is actively being uploaded, this
|
||||
// indicates that another process is attempting to upload the same content.
|
||||
//
|
||||
// Use IsLocked(err) to detect this condition.
|
||||
ErrLocked = errors.New("content: locked")
|
||||
|
||||
bufPool = sync.Pool{
|
||||
New: func() interface{} {
|
||||
return make([]byte, 1<<20)
|
||||
@@ -107,3 +113,7 @@ func IsNotFound(err error) bool {
|
||||
func IsExists(err error) bool {
|
||||
return errors.Cause(err) == ErrExists
|
||||
}
|
||||
|
||||
func IsLocked(err error) bool {
|
||||
return errors.Cause(err) == ErrLocked
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user