#ident "Copyright (c) 2007-2012 Tokutek Inc. All rights reserved."
#ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it."
#ifndef TOKU_LOCK_REQUEST_H
#define TOKU_LOCK_REQUEST_H
#include<db.h>
#include<toku_pthread.h>
#include<ft/fttypes.h>
#include<ft/comparator.h>
#include"locktree.h"
#include"txnid_set.h"
#include"wfg.h"
namespacetoku{
// A lock request contains the db, the key range, the lock type, and
// the transaction id that describes a potential row range lock.
//
// the typical use case is:
// - initialize a lock request
// - start to try to acquire the lock
// - do something else
// - wait for the lock request to be resolved on a timed condition
// - destroy the lock request
// a lock request is resolved when its state is no longer pending, or
// when it becomes granted, or timedout, or deadlocked. when resolved, the
// state of the lock request is changed and any waiting threads are awakened.
classlock_request{
public:
enumtype{
UNKNOWN,
READ,
WRITE
};
// effect: Initializes a lock request with a given wait time.
voidcreate(uint64_twait_time);
// effect: Destroys a lock request.
voiddestroy(void);
// effect: Resets the lock request parameters, allowing it to be reused.
// requires: Lock request was already created at some point