[bugfix] Fix possible race condition in federatingdb (#490)

Signed-off-by: kim <grufwub@gmail.com>
This commit is contained in:
kim 2022-04-28 10:18:27 +01:00 committed by GitHub
commit cc5f2e98b7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 131 additions and 220 deletions

View file

@ -19,12 +19,7 @@ type Database interface {
// processes require tight loops acquiring and releasing locks.
//
// Used to ensure race conditions in multiple requests do not occur.
Lock(c context.Context, id *url.URL) error
// Unlock makes the lock for the object at the specified id available.
// If an error is returned, the lock must have still been freed.
//
// Used to ensure race conditions in multiple requests do not occur.
Unlock(c context.Context, id *url.URL) error
Lock(c context.Context, id *url.URL) (unlock func(), err error)
// InboxContains returns true if the OrderedCollection at 'inbox'
// contains the specified 'id'.
//