Public Member Functions | Data Fields

MultiCacheBase Struct Reference

#include <P_MultiCache.h>

Inherits MultiCacheHeader.

Inherited by MultiCache< C >, and MultiCache< HostDBInfo >.

Collaboration diagram for MultiCacheBase:
Collaboration graph
[legend]

Public Member Functions

int halfspace_size ()
int lowest_level_data_size ()
int lowest_level (int bucket)
void set_lowest_level (int bucket, int lowest)
int partition_of_bucket (int b)
int first_bucket_of_partition (int p)
int last_bucket_of_partition (int p)
int buckets_of_partition (int p)
int open (Store *store, const char *config_filename, char *db_filename=NULL, int db_size=-1, bool reconfigure=false, bool fix=false, bool silent=false)
int read_config (const char *config_filename, Store &store, char *fn=NULL, int *pi=NULL, int *pbuckets=NULL)
int write_config (const char *config_filename, int nominal_size, int buckets)
int initialize (Store *store, char *filename, int elements, int buckets=0, int levels=2, int level0_elements_per_bucket=4, int level1_elements_per_bucket=32, int level2_elements_per_bucket=1)
int mmap_data (bool private_flag=false, bool zero_fill=false)
char * mmap_region (int blocks, int *fds, char *cur, size_t &total_length, bool private_flag, int zero_fill=0)
int blocks_in_level (int level)
bool verify_header ()
int unmap_data ()
void reset ()
void clear ()
void clear_but_heap ()
virtual MultiCacheBasedup ()
virtual size_t estimated_heap_bytes_per_entry () const
void print_info (FILE *fp)
int rebuild (MultiCacheBase &old, int kind=MC_REBUILD)
virtual void rebuild_element (int buck, char *elem, RebuildMC &r)
int check (const char *config_filename, bool fix=false)
ProxyMutexlock_for_bucket (int bucket)
uint64_t make_tag (uint64_t folded_md5)
int sync_all ()
int sync_heap (int part)
int sync_header ()
int sync_partition (int partition)
void sync_partitions (Continuation *cont)
 MultiCacheBase ()
virtual ~MultiCacheBase ()
virtual int get_elementsize ()
int ptr_to_partition (char *)
void * alloc (int *poffset, int size)
void update (int *poffset, int *old_poffset)
void * ptr (int *poffset, int partition)
int valid_offset (int offset)
int valid_heap_pointer (char *p)
void copy_heap_data (char *src, int s, int *pi, int partition, MultiCacheHeapGC *gc)
int halfspace_of (int o)
UnsunkPtrRegistryfixup_heap_offsets (int partition, int before_used, UnsunkPtrRegistry *r=NULL, int base=0)
virtual void copy_heap (int partition, MultiCacheHeapGC *gc)
void alloc_mutexes ()

Data Fields

Storestore
char filename [PATH_NAME_MAX+1]
MultiCacheHeadermapped_header
MultiCacheHeader header_snap
char * data
char * lowest_level_data
char * heap
int hit_stat [MULTI_CACHE_MAX_LEVELS]
int miss_stat
int buckets_per_partitionF8
UnsunkPtrRegistry unsunk [MULTI_CACHE_PARTITIONS]
PtrMutex locks [MULTI_CACHE_PARTITIONS]

Detailed Description

Definition at line 197 of file P_MultiCache.h.


Constructor & Destructor Documentation

MultiCacheBase::MultiCacheBase (  ) 

Definition at line 40 of file MultiCache.cc.

References filename, hit_stat, and unsunk.

virtual MultiCacheBase::~MultiCacheBase (  )  [inline, virtual]

Definition at line 347 of file P_MultiCache.h.

References reset().


Member Function Documentation

void * MultiCacheBase::alloc ( int *  poffset,
int  size 
)
void MultiCacheBase::alloc_mutexes (  )  [inline]

Definition at line 401 of file P_MultiCache.h.

References locks, and new_ProxyMutex().

Referenced by HostDBProcessor::start().

int MultiCacheBase::blocks_in_level ( int  level  )  [inline]

Definition at line 85 of file MultiCache.cc.

References MultiCacheHeader::buckets, MultiCacheHeader::bucketsize, and bytes_to_blocks().

Referenced by mmap_data().

int MultiCacheBase::buckets_of_partition ( int  p  )  [inline]
int MultiCacheBase::check ( const char *  config_filename,
bool  fix = false 
)
void MultiCacheBase::clear (  ) 
void MultiCacheBase::clear_but_heap (  ) 

Definition at line 495 of file MultiCache.cc.

References data, MultiCacheHeader::elementsize, mapped_header, and MultiCacheHeader::totalelements.

Referenced by rebuild().

virtual void MultiCacheBase::copy_heap ( int  partition,
MultiCacheHeapGC gc 
) [inline, virtual]

Reimplemented in MultiCache< C >, and MultiCache< HostDBInfo >.

Definition at line 392 of file P_MultiCache.h.

Referenced by MultiCacheHeapGC::startEvent().

void MultiCacheBase::copy_heap_data ( char *  src,
int  s,
int *  pi,
int  partition,
MultiCacheHeapGC gc 
)
virtual MultiCacheBase* MultiCacheBase::dup (  )  [inline, virtual]

Reimplemented in HostDBCache, MultiCache< C >, and MultiCache< HostDBInfo >.

Definition at line 283 of file P_MultiCache.h.

References ink_assert.

Referenced by check(), and open().

virtual size_t MultiCacheBase::estimated_heap_bytes_per_entry (  )  const [inline, virtual]

Reimplemented in HostDBCache.

Definition at line 289 of file P_MultiCache.h.

Referenced by initialize().

int MultiCacheBase::first_bucket_of_partition ( int  p  )  [inline]
UnsunkPtrRegistry * MultiCacheBase::fixup_heap_offsets ( int  partition,
int  before_used,
UnsunkPtrRegistry r = NULL,
int  base = 0 
)
virtual int MultiCacheBase::get_elementsize (  )  [inline, virtual]

Reimplemented in MultiCache< C >, and MultiCache< HostDBInfo >.

Definition at line 351 of file P_MultiCache.h.

References ink_assert.

Referenced by initialize().

int MultiCacheBase::halfspace_of ( int  o  )  [inline]

Definition at line 386 of file P_MultiCache.h.

References halfspace_size().

Referenced by fixup_heap_offsets().

int MultiCacheBase::halfspace_size (  )  [inline]
int MultiCacheBase::initialize ( Store store,
char *  filename,
int  elements,
int  buckets = 0,
int  levels = 2,
int  level0_elements_per_bucket = 4,
int  level1_elements_per_bucket = 32,
int  level2_elements_per_bucket = 1 
)
int MultiCacheBase::last_bucket_of_partition ( int  p  )  [inline]

Definition at line 253 of file P_MultiCache.h.

References first_bucket_of_partition().

Referenced by buckets_of_partition().

ProxyMutex* MultiCacheBase::lock_for_bucket ( int  bucket  )  [inline]
int MultiCacheBase::lowest_level ( int  bucket  )  [inline]

Definition at line 229 of file P_MultiCache.h.

References MultiCacheHeader::buckets, and lowest_level_data.

Referenced by MultiCache< C >::flush().

int MultiCacheBase::lowest_level_data_size (  )  [inline]

Definition at line 225 of file P_MultiCache.h.

References MultiCacheHeader::buckets.

Referenced by initialize().

uint64_t MultiCacheBase::make_tag ( uint64_t  folded_md5  )  [inline]
int MultiCacheBase::mmap_data ( bool  private_flag = false,
bool  zero_fill = false 
)
char * MultiCacheBase::mmap_region ( int  blocks,
int *  fds,
char *  cur,
size_t &  total_length,
bool  private_flag,
int  zero_fill = 0 
)
int MultiCacheBase::open ( Store store,
const char *  config_filename,
char *  db_filename = NULL,
int  db_size = -1,
bool  reconfigure = false,
bool  fix = false,
bool  silent = false 
)
int MultiCacheBase::partition_of_bucket ( int  b  )  [inline]
void MultiCacheBase::print_info ( FILE *  fp  ) 

Definition at line 775 of file MultiCache.cc.

References MultiCacheHeader::totalelements, and MultiCacheHeader::totalsize.

Referenced by rebuild().

void * MultiCacheBase::ptr ( int *  poffset,
int  partition 
)
int MultiCacheBase::ptr_to_partition ( char *  ptr  ) 
int MultiCacheBase::read_config ( const char *  config_filename,
Store store,
char *  fn = NULL,
int *  pi = NULL,
int *  pbuckets = NULL 
)
int MultiCacheBase::rebuild ( MultiCacheBase old,
int  kind = MC_REBUILD 
)
virtual void MultiCacheBase::rebuild_element ( int  buck,
char *  elem,
RebuildMC r 
) [inline, virtual]

Reimplemented in MultiCache< C >, and MultiCache< HostDBInfo >.

Definition at line 303 of file P_MultiCache.h.

References ink_assert.

Referenced by rebuild().

void MultiCacheBase::reset (  ) 

Definition at line 271 of file MultiCache.cc.

References data, lowest_level_data, store, and unmap_data().

Referenced by cmd_check_internal(), cmd_clear(), rebuild(), and ~MultiCacheBase().

void MultiCacheBase::set_lowest_level ( int  bucket,
int  lowest 
) [inline]

Definition at line 234 of file P_MultiCache.h.

References MultiCacheHeader::buckets, and lowest_level_data.

Referenced by MultiCache< C >::flush().

int MultiCacheBase::sync_all (  ) 

Definition at line 981 of file MultiCache.cc.

References sync_header(), sync_heap(), and sync_partition().

int MultiCacheBase::sync_header (  ) 

Definition at line 974 of file MultiCache.cc.

References ats_msync(), mapped_header, and STORE_BLOCK_SIZE.

Referenced by sync_all().

int MultiCacheBase::sync_heap ( int  part  ) 
int MultiCacheBase::sync_partition ( int  partition  ) 
void MultiCacheBase::sync_partitions ( Continuation cont  ) 
int MultiCacheBase::unmap_data (  ) 

Definition at line 285 of file MultiCache.cc.

References data, and MultiCacheHeader::totalsize.

Referenced by open(), rebuild(), and reset().

void MultiCacheBase::update ( int *  poffset,
int *  old_poffset 
)
int MultiCacheBase::valid_heap_pointer ( char *  p  )  [inline]

Definition at line 378 of file P_MultiCache.h.

References halfspace_size(), heap, and MultiCacheHeader::heap_used.

Referenced by HostDBCache::rebuild_callout().

int MultiCacheBase::valid_offset ( int  offset  )  [inline]

Definition at line 369 of file P_MultiCache.h.

References halfspace_size(), and MultiCacheHeader::heap_used.

Referenced by ptr(), HostDBCache::rebuild_callout(), and update().

bool MultiCacheBase::verify_header (  ) 
int MultiCacheBase::write_config ( const char *  config_filename,
int  nominal_size,
int  buckets 
)

Field Documentation

Definition at line 243 of file P_MultiCache.h.

Referenced by first_bucket_of_partition(), initialize(), and partition_of_bucket().

char MultiCacheBase::filename[PATH_NAME_MAX+1]

Definition at line 200 of file P_MultiCache.h.

Referenced by check(), initialize(), mmap_data(), MultiCacheBase(), and write_config().

Definition at line 203 of file P_MultiCache.h.

Referenced by MultiCacheSync::heapEvent().

int MultiCacheBase::hit_stat[MULTI_CACHE_MAX_LEVELS]

Definition at line 222 of file P_MultiCache.h.

Referenced by MultiCacheBase().

PtrMutex MultiCacheBase::locks[MULTI_CACHE_PARTITIONS]

Definition at line 208 of file P_MultiCache.h.

Referenced by initialize(), lowest_level(), reset(), and set_lowest_level().

Definition at line 223 of file P_MultiCache.h.

Definition at line 199 of file P_MultiCache.h.

Referenced by initialize(), mmap_data(), mmap_region(), open(), rebuild(), reset(), and write_config().

UnsunkPtrRegistry MultiCacheBase::unsunk[MULTI_CACHE_PARTITIONS]

Definition at line 358 of file P_MultiCache.h.

Referenced by alloc(), copy_heap_data(), fixup_heap_offsets(), MultiCacheBase(), ptr(), and update().


The documentation for this struct was generated from the following files: