Commit ec44d893 authored by Guido Trotter's avatar Guido Trotter
Browse files

locking: add/fix @type information



This patch missing @type information for all public methods, modifies
one to conform to the rest, and removes some information from @param
when it's been expressed in @type.
Signed-off-by: default avatarGuido Trotter <ultrotter@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent 154b9580
......@@ -600,7 +600,7 @@ class SharedLock(object):
def acquire(self, shared=0, timeout=None, test_notify=None):
"""Acquire a shared lock.
@type shared: int
@type shared: integer (0/1) used as a boolean
@param shared: whether to acquire in shared mode; by default an
exclusive lock will be acquired
@type timeout: float
......@@ -713,6 +713,7 @@ class LockSet:
def __init__(self, members=None):
"""Constructs a new LockSet.
@type members: list of strings
@param members: initial members of the set
"""
......@@ -811,8 +812,10 @@ class LockSet:
def acquire(self, names, timeout=None, shared=0, test_notify=None):
"""Acquire a set of resource locks.
@type names: list of strings (or string)
@param names: the names of the locks which shall be acquired
(special lock names, or instance/node names)
@type shared: integer (0/1) used as a boolean
@param shared: whether to acquire in shared mode; by default an
exclusive lock will be acquired
@type timeout: float or None
......@@ -968,6 +971,7 @@ class LockSet:
You must have acquired the locks, either in shared or in exclusive mode,
before releasing them.
@type names: list of strings, or None
@param names: the names of the locks which shall be released
(defaults to all the locks acquired at that level).
......@@ -1001,8 +1005,11 @@ class LockSet:
def add(self, names, acquired=0, shared=0):
"""Add a new set of elements to the set
@type names: list of strings
@param names: names of the new elements to add
@type acquired: integer (0/1) used as a boolean
@param acquired: pre-acquire the new resource?
@type shared: integer (0/1) used as a boolean
@param shared: is the pre-acquisition shared?
"""
......@@ -1062,6 +1069,7 @@ class LockSet:
You can either not hold anything in the lockset or already hold a superset
of the elements you want to delete, exclusively.
@type names: list of strings
@param names: names of the resource to remove.
@return: a list of locks which we removed; the list is always
......@@ -1227,10 +1235,12 @@ class GanetiLockManager:
def acquire(self, level, names, timeout=None, shared=0):
"""Acquire a set of resource locks, at the same level.
@param level: the level at which the locks shall be acquired;
it must be a member of LEVELS.
@type level: member of locking.LEVELS
@param level: the level at which the locks shall be acquired
@type names: list of strings (or string)
@param names: the names of the locks which shall be acquired
(special lock names, or instance/node names)
@type shared: integer (0/1) used as a boolean
@param shared: whether to acquire in shared mode; by default
an exclusive lock will be acquired
@type timeout: float
......@@ -1261,8 +1271,9 @@ class GanetiLockManager:
You must have acquired the locks, either in shared or in exclusive
mode, before releasing them.
@param level: the level at which the locks shall be released;
it must be a member of LEVELS
@type level: member of locking.LEVELS
@param level: the level at which the locks shall be released
@type names: list of strings, or None
@param names: the names of the locks which shall be released
(defaults to all the locks acquired at that level)
......@@ -1281,10 +1292,13 @@ class GanetiLockManager:
def add(self, level, names, acquired=0, shared=0):
"""Add locks at the specified level.
@param level: the level at which the locks shall be added;
it must be a member of LEVELS_MOD.
@type level: member of locking.LEVELS_MOD
@param level: the level at which the locks shall be added
@type names: list of strings
@param names: names of the locks to acquire
@type acquired: integer (0/1) used as a boolean
@param acquired: whether to acquire the newly added locks
@type shared: integer (0/1) used as a boolean
@param shared: whether the acquisition will be shared
"""
......@@ -1301,8 +1315,9 @@ class GanetiLockManager:
You must either already own the locks you are trying to remove
exclusively or not own any lock at an upper level.
@param level: the level at which the locks shall be removed;
it must be a member of LEVELS_MOD
@type level: member of locking.LEVELS_MOD
@param level: the level at which the locks shall be removed
@type names: list of strings
@param names: the names of the locks which shall be removed
(special lock names, or instance/node names)
......
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