Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

ShortIdImpl.C File Reference

#include <sys/types.h>
#include <dirent.h>
#include <pthread.h>
#include <time.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <ctype.h>
#include <VestaConfig.H>
#include <Thread.H>
#include "ShortIdImpl.H"
#include "VestaLog.H"
#include "Recovery.H"
#include "ReadersWritersLock.H"
#include "ShortIdKey.H"
#include "FdCache.H"
#include "VRConcurrency.H"
#include "logging.H"
#include "lock_timing.H"

Go to the source code of this file.

Defines

#define USE_RANDOM_R   1

Typedefs

typedef Table< ShortIdKey,
ShortIdBlockInfo * >::Default 
BlockInfoTable
typedef Table< ShortIdKey,
ShortIdBlockInfo * >::Iterator 
BlockInfoIter

Functions

int _Preaddir_r (DIR *, struct dirent *, struct dirent **)
void AcquireShortIdBlock (ShortIdBlock &bk, bool leafflag, bool local) throw ()
bool RenewShortIdBlock (ShortIdBlock &bk) throw ()
void ReleaseShortIdBlock (ShortIdBlock &bk, bool local) throw ()
void * LandlordThread (void *arg)
void ShortIdBlockCheckpoint (fstream &ckpt) throw ()
int DeleteAllShortIdsBut (ShortIdsFile sidfile, time_t lease) throw ()
void ShortIdServerInit ()
void ShortIdServerInit2 ()

Variables

const int LEASE_PERIOD = 60*60*24
const int LANDLORD_SLEEP = 60*60
const int LANDLORD_WORKLIST_SIZE = 128
random_data randDat
int randState [32]


Define Documentation

#define USE_RANDOM_R   1
 

Definition at line 63 of file ShortIdImpl.C.


Typedef Documentation

typedef Table<ShortIdKey, ShortIdBlockInfo*>::Iterator BlockInfoIter
 

Definition at line 70 of file ShortIdImpl.C.

typedef Table<ShortIdKey, ShortIdBlockInfo*>::Default BlockInfoTable
 

Definition at line 69 of file ShortIdImpl.C.


Function Documentation

int _Preaddir_r DIR *  ,
struct dirent *  ,
struct dirent ** 
 

void AcquireShortIdBlock ShortIdBlock bk,
bool  leafflag,
bool  local
throw ()
 

Definition at line 96 of file ShortIdImpl.C.

References ReadersWritersLock::acquireWrite(), closedir(), VestaLog::commit(), Table< K, V >::Default::Get(), ShortIdBlock::leafFlag, LEASE_PERIOD, ShortIdBlockInfo::leaseExpires, ShortIdBlock::leaseNonexpiring, Basics::mutex::lock(), NEW, NullShortId, opendir(), PathnameSep, Table< K, V >::Default::Put(), VestaLog::put(), randDat, ReadersWritersLock::releaseWrite(), RWLOCK_LOCKED_REASON, ShortIdBlock::shortIdToName(), ShortIdBlock::size, StableLock, VestaLog::start(), Basics::mutex::unlock(), and VRLog.

Referenced by ShortIdBlock::acquire(), and ShortIdReceptionist().

int DeleteAllShortIdsBut ShortIdsFile  sidfile,
time_t  lease
throw ()
 

Definition at line 578 of file ShortIdImpl.C.

References Text::cchars(), DBG_ALWAYS, Repos::dprintf(), and SourceOrDerived::open().

Referenced by DoDeletions().

void* LandlordThread void *  arg  ) 
 

Definition at line 292 of file ShortIdImpl.C.

References ReadersWritersLock::acquireWrite(), LANDLORD_SLEEP, LANDLORD_WORKLIST_SIZE, ShortIdBlockInfo::leaseExpires, Basics::mutex::lock(), Table< K, V >::Iterator::Next(), ReadersWritersLock::releaseWrite(), RWLOCK_LOCKED_REASON, ShortIdKey::sid, StableLock, and Basics::mutex::unlock().

Referenced by ShortIdServerInit2().

void ReleaseShortIdBlock ShortIdBlock bk,
bool  local
throw ()
 

Definition at line 263 of file ShortIdImpl.C.

References ReadersWritersLock::acquireWrite(), Basics::mutex::lock(), ReadersWritersLock::releaseWrite(), RWLOCK_LOCKED_REASON, StableLock, and Basics::mutex::unlock().

Referenced by ShortIdBlock::release(), and ShortIdReceptionist().

bool RenewShortIdBlock ShortIdBlock bk  )  throw ()
 

Definition at line 204 of file ShortIdImpl.C.

References ReadersWritersLock::acquireWrite(), VestaLog::commit(), Table< K, V >::Default::Delete(), LEASE_PERIOD, ShortIdBlockInfo::leaseExpires, Basics::mutex::lock(), Table< K, V >::Default::Put(), VestaLog::put(), ReadersWritersLock::releaseWrite(), RWLOCK_LOCKED_REASON, StableLock, VestaLog::start(), Basics::mutex::unlock(), and VRLog.

Referenced by ShortIdReceptionist().

void ShortIdBlockCheckpoint fstream &  ckpt  )  throw ()
 

Definition at line 381 of file ShortIdImpl.C.

References ShortIdBlockInfo::leaseExpires, Basics::mutex::lock(), Table< K, V >::Iterator::Next(), ShortIdKey::sid, and Basics::mutex::unlock().

Referenced by CheckpointServer().

void ShortIdServerInit  ) 
 

Definition at line 603 of file ShortIdImpl.C.

References DBG_ALWAYS, Repos::dprintf(), VestaConfig::get(), randDat, randState, and RegisterRecoveryCallback().

Referenced by main().

void ShortIdServerInit2  ) 
 

Definition at line 633 of file ShortIdImpl.C.

References Basics::thread::fork(), and LandlordThread().

Referenced by main().


Variable Documentation

const int LANDLORD_SLEEP = 60*60
 

Definition at line 74 of file ShortIdImpl.C.

Referenced by LandlordThread().

const int LANDLORD_WORKLIST_SIZE = 128
 

Definition at line 75 of file ShortIdImpl.C.

Referenced by LandlordThread().

const int LEASE_PERIOD = 60*60*24
 

Definition at line 73 of file ShortIdImpl.C.

Referenced by AcquireShortIdBlock(), and RenewShortIdBlock().

struct random_data randDat
 

Definition at line 80 of file ShortIdImpl.C.

Referenced by AcquireShortIdBlock(), and ShortIdServerInit().

int randState[32]
 

Definition at line 81 of file ShortIdImpl.C.

Referenced by ShortIdServerInit().


Generated on Mon May 8 00:49:04 2006 for Vesta by  doxygen 1.4.2