Add Resource Locking Service

Description

The Resource Locking Service can be used to mark a specific resource key as locked. Other instances of epm can check if the resource is locked. The service only acts as information resource and does not check anything automatically. Clients have to actively check the lock status and do the error handling themselves. The service information is always in realtime.

Use-Cases

  • The $locks service is available
  • A lock(string $resource, string $user): bool method is available.
    • The user is whoever is trying to lock the resource
    • It returns false if the resource is already locked
  • A isLocked(string $resource): bool method is available to check if a resource is locked
  • A getLock(string $resource): ?array method is available
    • It retuns the user, the resource name and the time when the resource was locked
  • A unlock(string $resource, bool $force = false): bool method is available
    • The method unlocks the resource automatically if it has been locked by the current epm instance
    • The force flag must be used if some other instance locked the resource. Otherwise flase is returned.
  • The lock service replaces the current .epm.lock

Todo

  • Wiki updated