lockid_t Class Reference

List of all members.

Detailed Description

The means of identifying a desired or held lock.

Lock manager requests (acquire, release, query) take an argument of this kind to identify the entity to be locked. Not all lockids refer to anything extant.

The structure of the lockid_t is such that several entity types are inferred, and the lockid_t has constructors from these entities' identifier classes, as well as methods to modify the lockid while retaining its inferred-entity type. The enumerator type name_space_t identifies the entity type of the lock_id, and is returned by the method space:

Attention:
The enumeration values of name_space_t have functional significance; they are use to compute parents in the hierarchy, so modify them with care!
The user-defined entity types are for use by a server; they offer a hierarchy.
Examples:

lockid_test.cpp.

Definition at line 213 of file lock_s.h.

Public Types

typedef uint4_t page_bits_t
enum  name_space_t
enum  
enum  

Public Member Functions

bool operator< (lockid_t const &p) const
 comparison operator for lockid_t, used by lock manager
bool operator== (const lockid_t &p) const
 equality operator for lockid_t
bool operator!= (const lockid_t &p) const
 inequality operator for lockid_t
uint4_t hash () const
 Used by lock cache.
void zero ()
 clear out the lockid - initialize to mean nothing
name_space_t lspace () const
 return the kind of entity this describes
vid_t vid () const
 extract volume id lockid whose lspace() == t_vol or has parent with lspace() == t_vol
const snum_tstore () const
 extract store number lockid whose lspace() == t_store or has parent with lspace() == t_store
const extnum_t & extent () const
 extract extent number lockid whose lspace() == t_extent
const shpid_t & page () const
 extract short page number lockid whose lspace() == t_page or has parent with lspace()==t_page
slotid_t slot () const
 extract slot number lockid whose lspace() == t_record
uint2_t u1 () const
 extract uint2_t from whose lspace() == t_user1
uint4_t u2 () const
 extract uint4_t from whose lspace() == t_user2
uint4_t u3 () const
 extract uint4_t from whose lspace() == t_user3
uint4_t u4 () const
 extract uint4_t from whose lspace() == t_user4
void set_ext_has_page_alloc (bool value)
 for extent locks only, used by volume manager
bool ext_has_page_alloc () const
 for extent locks only, used by lock manager
NORET lockid_t (const vid_t &vid)
 construct from volume id
NORET lockid_t (const extid_t &extid)
 construct from full extent id
NORET lockid_t (const stid_t &stid)
 construct from full store id
NORET lockid_t (const lpid_t &lpid)
 construct from full page id
NORET lockid_t (const rid_t &rid)
 construct from full record id
NORET lockid_t (const kvl_t &kvl)
 construct from kvl_t (hash of key,value, from vec_t)
NORET lockid_t (const lockid_t &i)
 copy constructor
NORET lockid_t (const user1_t &u)
 construct from user1_t
NORET lockid_t (const user2_t &u)
 construct from user2_t
NORET lockid_t (const user3_t &u)
 construct from user3_t
NORET lockid_t (const user4_t &u)
 construct from user4_t
void extract_extent (extid_t &e) const
 extract a full extent id from an extent lock
void extract_stid (stid_t &s) const
 extract a full store id from a store, page, or record lock
void extract_lpid (lpid_t &p) const
 extract a full page id from a page or record lock
void extract_rid (rid_t &r) const
 extract a full record id from a record lock
void extract_kvl (kvl_t &k) const
 extract a kvl_t (hash of key,value) from a key-value lock
void extract_user1 (user1_t &u) const
 extract a user1_t from user-defined entity 1, 2, 3, or 4
void extract_user2 (user2_t &u) const
 extract a user2_t from user-defined entity 2, 3, or 4
void extract_user3 (user3_t &u) const
 extract a user3_t from user-defined entity 3 or 4
void extract_user4 (user4_t &u) const
 extract a user3_t from user-defined entity 4
bool is_user_lock () const
 Return true if type is t_user1, t_user2, t_user3 or t_user4.
w_rc_t truncate (name_space_t space)
 Nullify all parts of the lockid that apply to children in the hierarchy.
lockid_toperator= (const lockid_t &i)
 copy operator

Static Public Attributes

static const int cached_granularity = t_page

Classes

struct  user1_t
 User-defined entity 1. More...
struct  user2_t
 User-defined entity 2. More...
struct  user3_t
 User-defined entity 3. More...
struct  user4_t
 User-defined entity 4. More...


Member Function Documentation

void lockid_t::set_ext_has_page_alloc ( bool  value  ) 

for extent locks only, used by volume manager

Set to true when the extent contains an uncommitted allocated page. This is done when a page is allocated in the extent; it is used for special handling of extent locks in the lock manager.

The special handling requires a little background:

The special handling is this:

When at the end of transaction, lock_m::release_duration() is called, the lock manager returns eFOUNDEXTTOFREE when it encounters an extent lock with this bit set.

bool lockid_t::ext_has_page_alloc (  )  const

for extent locks only, used by lock manager

Returns true when the extent contains an uncommitted allocated page. See discussion in set_ext_has_page_alloc, above.

w_rc_t lockid_t::truncate ( name_space_t  space  ) 

Nullify all parts of the lockid that apply to children in the hierarchy.

If the given space isn't in the hierarchy, this generates a fatal error.


The documentation for this class was generated from the following file:
Generated on Wed Jul 7 17:22:43 2010 for Shore Storage Manager by  doxygen 1.4.7