Commit caa39a5d authored by Klaus Aehlig's avatar Klaus Aehlig
Browse files

Add a type for the entity owning a lock

While it is unlikely that lock owners will ever be represented by
something different than a job id or, exceptionally, a string, this
type will still improves type checking. Additionally, it will allow
us to make it a separate instance of JSON and thus simplify the
parts of WConfD related to communication.
Signed-off-by: default avatarKlaus Aehlig <>
Reviewed-by: default avatarPetr Pudlak <>
parent 665a9ddc
......@@ -28,6 +28,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
module Ganeti.Locking.Locks
( GanetiLocks(..)
, lockName
, ClientType(..)
, ClientId(..)
, GanetiLockAllocation
, loadLockAllocation
......@@ -186,6 +187,14 @@ instance Lock GanetiLocks where
lockImplications ConfigLock = []
lockImplications _ = []
-- | Type of entities capable of owning locks. Usually, locks are owned
-- by jobs. However, occassionally other tasks need locks (currently, e.g.,
-- to lock the configuration). These are identified by a unique name,
-- reported to WConfD as a strig.
data ClientType = ClientOther String
| ClientJob JobId
deriving (Ord, Eq, Show)
-- | A client is identified as a job id, thread id and path to its process
-- identifier file.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment