home *** CD-ROM | disk | FTP | other *** search
/ ftp.parl.clemson.edu / 2015-02-07.ftp.parl.clemson.edu.tar / ftp.parl.clemson.edu / pub / pvfs2 / orangefs-2.8.3-20110323.tar.gz / orangefs-2.8.3-20110323.tar / orangefs / src / client / sysint / ncache.h < prev    next >
C/C++ Source or Header  |  2006-07-31  |  3KB  |  135 lines

  1. /*
  2.  * Copyright ⌐ Acxiom Corporation, 2006
  3.  *
  4.  * See COPYING in top-level directory.
  5.  */
  6.  
  7. #ifndef __NCACHE_H
  8. #define __NCACHE_H
  9.  
  10. #include "pvfs2-types.h"
  11. #include "pvfs2-attr.h"
  12. #include "gen-locks.h"
  13. #include "quicklist.h"
  14. #include "quickhash.h"
  15. #include "tcache.h"
  16. #include "pint-perf-counter.h"
  17.  
  18. /** \defgroup ncache Name Cache (ncache)
  19.  *
  20.  * The ncache implements a simple client side cache for PVFS2 files.
  21.  * A timeout is associated with each entry to dictate when it will expire. 
  22.  * The ncache is built on top of the generic tcache caching component. The NCACHE
  23.  * component will cache the following:
  24.  * - parent handle
  25.  * - entry for a specific file OR directory within the parent directory
  26.  * - entry handle
  27.  * .
  28.  *
  29.  * The tcache implements a simple component for caching data structures that
  30.  * can be referenced by unique, opaque keys.  A timeout is associated with each 
  31.  * entry to dictate when it will expire.  Specific caches such as the
  32.  * attribute or name cache may be built on top of this one.
  33.  *
  34.  * Notes:
  35.  * - See tcache for policy documentation
  36.  * .
  37.  *
  38.  * Operations that may retrieve items from ncache:
  39.  * - lookup
  40.  * - rename  (Current implementation does not yet use ncache)
  41.  * .
  42.  *
  43.  * Operations that may insert items into the cache:
  44.  * - pvfs2-lookup
  45.  * - pvfs2-rename  (Current implementation does not yet use ncache)
  46.  * - pvfs2-symlink
  47.  * - pvfs2-readdir
  48.  * - pvfs2-mkdir
  49.  * - pvfs2-create
  50.  * .
  51.  *
  52.  * Operations that may DELETE items from the cache:
  53.  * - pvfs2-remove
  54.  * - pvfs2-rename
  55.  * - any failed sysint operation from the list of operations that retrieve
  56.  *   items from NCACHE
  57.  * .
  58.  *
  59.  * @{
  60.  */
  61.  
  62. /** \file
  63.  * Declarations for the Name Cache (ncache) component.
  64.  */
  65.  
  66. /** @see PINT_tcache_options */
  67. #define PINT_ncache_options PINT_tcache_options
  68. enum {
  69. NCACHE_TIMEOUT_MSECS = TCACHE_TIMEOUT_MSECS,
  70. NCACHE_NUM_ENTRIES = TCACHE_NUM_ENTRIES,
  71. NCACHE_HARD_LIMIT = TCACHE_HARD_LIMIT,
  72. NCACHE_SOFT_LIMIT = TCACHE_SOFT_LIMIT,
  73. NCACHE_ENABLE = TCACHE_ENABLE,
  74. NCACHE_RECLAIM_PERCENTAGE = TCACHE_RECLAIM_PERCENTAGE,
  75. };
  76.  
  77. enum 
  78. {
  79.    PERF_NCACHE_NUM_ENTRIES = 0,
  80.    PERF_NCACHE_SOFT_LIMIT = 1,
  81.    PERF_NCACHE_HARD_LIMIT = 2,
  82.    PERF_NCACHE_HITS = 3,
  83.    PERF_NCACHE_MISSES = 4,
  84.    PERF_NCACHE_UPDATES = 5,
  85.    PERF_NCACHE_PURGES = 6,
  86.    PERF_NCACHE_REPLACEMENTS = 7,
  87.    PERF_NCACHE_DELETIONS = 8, 
  88.    PERF_NCACHE_ENABLED = 9,
  89. };
  90.  
  91. /** ncache performance counter keys */
  92. extern struct PINT_perf_key ncache_keys[];
  93.  
  94. void PINT_ncache_enable_perf_counter(struct PINT_perf_counter* pc);
  95.  
  96. int PINT_ncache_initialize(void);
  97.  
  98. void PINT_ncache_finalize(void);
  99.  
  100. int PINT_ncache_get_info(
  101.     enum PINT_ncache_options option,
  102.     unsigned int* arg);
  103.  
  104. int PINT_ncache_set_info(
  105.     enum PINT_ncache_options option,
  106.     unsigned int arg);
  107.  
  108. int PINT_ncache_get_cached_entry(
  109.     const char* entry, 
  110.     PVFS_object_ref* entry_ref,
  111.     const PVFS_object_ref* parent_ref); 
  112.  
  113. int PINT_ncache_update(
  114.     const char* entry, 
  115.     const PVFS_object_ref* entry_ref, 
  116.     const PVFS_object_ref* parent_ref); 
  117.  
  118. void PINT_ncache_invalidate(
  119.     const char* entry, 
  120.     const PVFS_object_ref* parent_ref); 
  121.  
  122. #endif /* __NCACHE_H */
  123.  
  124. /* @} */
  125.  
  126. /*
  127.  * Local variables:
  128.  *  c-indent-level: 4
  129.  *  c-basic-offset: 4
  130.  * End:
  131.  *
  132.  * vim: ts=8 sts=4 sw=4 expandtab
  133.  */
  134.  
  135.