Skip to content

[DEV] merge or simplify storage interfaces #24

@rainest

Description

@rainest

Short Description
Either merge the DistributedLockProvider interface functions into the StorageProvider interface or remove duplicate functions from `DistributedLockProvider).

Definition of Done
Either:

  1. StorageProvider has the GetDuration(), DistributedTimedLock(), and Unlock() functions currently in DistributedLockProvider. The DistributedLockProvider interface has been removed and functions that accept it now use StorageProvider instead.
  2. DistributedLockProvider no longer includes Init(), InitFromStorage(), or Ping() functions.

My preference is to merge the interfaces.

Additional context
AFAICT DistributedLockProvider has no reason to be separate. There are no StorageProvider implementations that are not also DistributedLockProvider implementations, and I do not expect we will ever have reason to implement a StorageProvider only in the future.

At present their separation leads to unnecessary duplication of Init() and Ping() code and the weird InitFromStorage() partial copy via prayer and abuse of interface{} method.

If the interfaces remain separate, we'll need to remove some calls to Ping() that are superfluous (the functions also ping the storage engine already).

If we expect implementations that do not implement distributed locks (for a either single PCS instance or PCS instance groups with only one leader), we can make the distributed lock functions no-ops in those implementations.

On further review, we have no need for GetDuration(); it should be removed regardless. It's only used in its own test, and provides no functionality other than echoing an ephemeral function parameter(a lock grab timeout).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions