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 / acache.h < prev    next >
C/C++ Source or Header  |  2008-03-06  |  4KB  |  159 lines

  1. /*
  2.  * Copyright ⌐ Acxiom Corporation, 2005
  3.  *
  4.  * See COPYING in top-level directory.
  5.  */
  6.  
  7. #ifndef __ACACHE_H
  8. #define __ACACHE_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 acache Attribute Cache (acache)
  19.  *
  20.  * The acache implements a simple client side cache for PVFS2 attibutes as
  21.  * well as logical file sizes.  A timeout is associated with each attribute 
  22.  * structure to dictate when it will expire, and the attribute mask is used 
  23.  * to determine which fields in the attribute structure are valid at a given
  24.  * time.  The acache is built on top of the generic tcache caching component.
  25.  *
  26.  * The tcache implements a simple component for caching data structures that
  27.  * can be referenced by unique, opaque keys.  A timeout is associated with each 
  28.  * entry to dictate when it will expire.  Specific caches such as the
  29.  * attribute or name cache may be built on top of this one.
  30.  *
  31.  * Notes:
  32.  * - See tcache for policy documentation
  33.  * - Note that the acache never explicitly deletes an entry.  Instead, it
  34.  *   will invalidate an entry but leave it in the cache.
  35.  * .
  36.  *
  37.  * Operations that may retrieve items from acache:
  38.  * - truncate
  39.  * - symlink
  40.  * - rename
  41.  * - readdir
  42.  * - mkdir
  43.  * - lookup
  44.  * - io
  45.  * - getattr
  46.  * - flush
  47.  * - create
  48.  * - remove
  49.  * - mgmt-get-dfile-array
  50.  * - setattrib
  51.  * .
  52.  *
  53.  * Operations that may insert items into the cache:
  54.  * - create
  55.  * - getattr
  56.  * - setattr
  57.  * - mkdir
  58.  * - symlink
  59.  * .
  60.  *
  61.  * Operations that may invalidate items in the cache:
  62.  * - remove
  63.  * - rename
  64.  * - io (size only)
  65.  * - truncate (size only)
  66.  * - any failed sysint operation from the list of operations that retrieve
  67.  * attributes
  68.  * .
  69.  *
  70.  * @{
  71.  */
  72.  
  73. /** \file
  74.  * Declarations for the Attribute Cache (acache) component.
  75.  */
  76.  
  77. /** @see PINT_tcache_options */
  78. #define PINT_acache_options PINT_tcache_options
  79.  
  80. #define ACACHE_TIMEOUT_MSECS TCACHE_TIMEOUT_MSECS
  81. #define ACACHE_NUM_ENTRIES TCACHE_NUM_ENTRIES
  82. #define ACACHE_HARD_LIMIT TCACHE_HARD_LIMIT
  83. #define ACACHE_SOFT_LIMIT TCACHE_SOFT_LIMIT
  84. #define ACACHE_ENABLE TCACHE_ENABLE
  85. #define ACACHE_RECLAIM_PERCENTAGE TCACHE_RECLAIM_PERCENTAGE
  86.  
  87. #define STATIC_ACACHE_OPT 1024
  88.  
  89. #define STATIC_ACACHE_TIMEOUT_MSECS (TCACHE_TIMEOUT_MSECS | STATIC_ACACHE_OPT)
  90. #define STATIC_ACACHE_NUM_ENTRIES (TCACHE_NUM_ENTRIES | STATIC_ACACHE_OPT)
  91. #define STATIC_ACACHE_HARD_LIMIT (TCACHE_HARD_LIMIT | STATIC_ACACHE_OPT)
  92. #define STATIC_ACACHE_SOFT_LIMIT (TCACHE_SOFT_LIMIT | STATIC_ACACHE_OPT)
  93. #define STATIC_ACACHE_ENABLE (TCACHE_ENABLE | STATIC_ACACHE_OPT)
  94. #define STATIC_ACACHE_RECLAIM_PERCENTAGE (TCACHE_RECLAIM_PERCENTAGE | STATIC_ACACHE_OPT)
  95.  
  96. enum 
  97. {
  98.    PERF_ACACHE_NUM_ENTRIES = 0,
  99.    PERF_ACACHE_SOFT_LIMIT = 1,
  100.    PERF_ACACHE_HARD_LIMIT = 2,
  101.    PERF_ACACHE_HITS = 3,
  102.    PERF_ACACHE_MISSES = 4,
  103.    PERF_ACACHE_UPDATES = 5,
  104.    PERF_ACACHE_PURGES = 6,
  105.    PERF_ACACHE_REPLACEMENTS = 7,
  106.    PERF_ACACHE_DELETIONS = 8,
  107.    PERF_ACACHE_ENABLED = 9,
  108. };
  109.  
  110. /** acache performance counter keys */
  111. extern struct PINT_perf_key acache_keys[];
  112.  
  113. void PINT_acache_enable_perf_counter(struct PINT_perf_counter* pc,
  114.     struct PINT_perf_counter* static_pc);
  115.  
  116. int PINT_acache_initialize(void);
  117.  
  118. void PINT_acache_finalize(void);
  119.  
  120. int PINT_acache_get_info(
  121.     enum PINT_acache_options option,
  122.     unsigned int* arg);
  123.  
  124. int PINT_acache_set_info(
  125.     enum PINT_acache_options option,
  126.     unsigned int arg);
  127.  
  128. int PINT_acache_get_cached_entry(
  129.     PVFS_object_ref refn,
  130.     PVFS_object_attr* attr,
  131.     int* attr_status,
  132.     PVFS_size* size,
  133.     int* size_status);
  134.  
  135. int PINT_acache_update(
  136.     PVFS_object_ref refn, 
  137.     PVFS_object_attr *attr,
  138.     PVFS_size* size);
  139.  
  140. void PINT_acache_invalidate(
  141.     PVFS_object_ref refn);
  142.  
  143. void PINT_acache_invalidate_size(
  144.     PVFS_object_ref refn);
  145.  
  146. #endif /* __ACACHE_H */
  147.  
  148. /* @} */
  149.  
  150. /*
  151.  * Local variables:
  152.  *  c-indent-level: 4
  153.  *  c-basic-offset: 4
  154.  * End:
  155.  *
  156.  * vim: ts=8 sts=4 sw=4 expandtab
  157.  */
  158.  
  159.