CernVM-FS  2.12.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
libcvmfs_cache.h File Reference
#include <stdint.h>
Include dependency graph for libcvmfs_cache.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  cvmcache_hash
 
struct  cvmcache_object_info
 
struct  cvmcache_info
 
struct  cvmcache_session
 
struct  cvmcache_breadcrumb
 
struct  cvmcache_callbacks
 

Macros

#define LIBCVMFS_CACHE_REVISION   5
 
#define CVMCACHE_SIZE_UNKNOWN   (uint64_t(-1))
 

Typedefs

typedef struct OptionsManager cvmcache_option_map
 

Enumerations

enum  cvmcache_hash_algorithm { CVMCACHE_HASH_SHA1 = 1, CVMCACHE_HASH_RIPEMD160, CVMCACHE_HASH_SHAKE128 }
 
enum  cvmcache_status {
  CVMCACHE_STATUS_UNKNOWN = 0, CVMCACHE_STATUS_OK, CVMCACHE_STATUS_NOSUPPORT, CVMCACHE_STATUS_FORBIDDEN,
  CVMCACHE_STATUS_NOSPACE, CVMCACHE_STATUS_NOENTRY, CVMCACHE_STATUS_MALFORMED, CVMCACHE_STATUS_IOERR,
  CVMCACHE_STATUS_CORRUPTED, CVMCACHE_STATUS_TIMEOUT, CVMCACHE_STATUS_BADCOUNT, CVMCACHE_STATUS_OUTOFBOUNDS,
  CVMCACHE_STATUS_PARTIAL
}
 
enum  cvmcache_object_type { CVMCACHE_OBJECT_REGULAR = 0, CVMCACHE_OBJECT_CATALOG, CVMCACHE_OBJECT_VOLATILE }
 
enum  cvmcache_capabilities {
  CVMCACHE_CAP_NONE = 0, CVMCACHE_CAP_WRITE = 1, CVMCACHE_CAP_REFCOUNT = 2, CVMCACHE_CAP_SHRINK = 4,
  CVMCACHE_CAP_INFO = 8, CVMCACHE_CAP_SHRINK_RATE = 16, CVMCACHE_CAP_LIST = 32, CVMCACHE_CAP_ALL_V1 = 63,
  CVMCACHE_CAP_BREADCRUMB = 64, CVMCACHE_CAP_ALL_V2 = 127
}
 

Functions

struct cvmcache_hash __attribute__ ((__packed__))
 
int cvmcache_hash_cmp (struct cvmcache_hash *a, struct cvmcache_hash *b)
 
char * cvmcache_hash_print (const struct cvmcache_hash *h)
 
void cvmcache_init_global ()
 
void cvmcache_cleanup_global ()
 
int cvmcache_is_supervised ()
 
struct cvmcache_contextcvmcache_init (struct cvmcache_callbacks *callbacks)
 
int cvmcache_listen (struct cvmcache_context *ctx, char *locator)
 
void cvmcache_process_requests (struct cvmcache_context *ctx, unsigned nworkers)
 
void cvmcache_ask_detach (struct cvmcache_context *ctx)
 
void cvmcache_terminate (struct cvmcache_context *ctx)
 
void cvmcache_wait_for (struct cvmcache_context *ctx)
 
uint32_t cvmcache_max_object_size (struct cvmcache_context *ctx)
 
void cvmcache_spawn_watchdog (const char *crash_dump_file)
 
void cvmcache_terminate_watchdog ()
 
void cvmcache_get_session (cvmcache_session *session)
 
cvmcache_option_mapcvmcache_options_init ()
 
void cvmcache_options_fini (cvmcache_option_map *opts)
 
void cvmcache_options_set (cvmcache_option_map *opts, const char *key, const char *value)
 
int cvmcache_options_parse (cvmcache_option_map *opts, const char *path)
 
void cvmcache_options_unset (cvmcache_option_map *opts, const char *key)
 
char * cvmcache_options_get (cvmcache_option_map *opts, const char *key)
 
char * cvmcache_options_dump (cvmcache_option_map *opts)
 
void cvmcache_options_free (char *value)
 

Variables

unsigned char digest [20]
 
char algorithm
 
struct cvmcache_object_info __attribute__
 

Macro Definition Documentation

#define CVMCACHE_SIZE_UNKNOWN   (uint64_t(-1))

Definition at line 81 of file libcvmfs_cache.h.

Referenced by main(), and PluginRamCache::ram_start_txn().

#define LIBCVMFS_CACHE_REVISION   5

This file is part of the CernVM File System.

See cvmfs_cache_null plugin for a demo user of the library.

Definition at line 18 of file libcvmfs_cache.h.

Typedef Documentation

Definition at line 27 of file libcvmfs_cache.h.

Enumeration Type Documentation

Enumerator
CVMCACHE_CAP_NONE 
CVMCACHE_CAP_WRITE 
CVMCACHE_CAP_REFCOUNT 
CVMCACHE_CAP_SHRINK 
CVMCACHE_CAP_INFO 
CVMCACHE_CAP_SHRINK_RATE 
CVMCACHE_CAP_LIST 
CVMCACHE_CAP_ALL_V1 
CVMCACHE_CAP_BREADCRUMB 
CVMCACHE_CAP_ALL_V2 

Definition at line 65 of file libcvmfs_cache.h.

Enumerator
CVMCACHE_HASH_SHA1 
CVMCACHE_HASH_RIPEMD160 
CVMCACHE_HASH_SHAKE128 

Definition at line 31 of file libcvmfs_cache.h.

Enumerator
CVMCACHE_OBJECT_REGULAR 
CVMCACHE_OBJECT_CATALOG 
CVMCACHE_OBJECT_VOLATILE 

Definition at line 58 of file libcvmfs_cache.h.

Enumerator
CVMCACHE_STATUS_UNKNOWN 
CVMCACHE_STATUS_OK 
CVMCACHE_STATUS_NOSUPPORT 
CVMCACHE_STATUS_FORBIDDEN 
CVMCACHE_STATUS_NOSPACE 
CVMCACHE_STATUS_NOENTRY 
CVMCACHE_STATUS_MALFORMED 
CVMCACHE_STATUS_IOERR 
CVMCACHE_STATUS_CORRUPTED 
CVMCACHE_STATUS_TIMEOUT 
CVMCACHE_STATUS_BADCOUNT 
CVMCACHE_STATUS_OUTOFBOUNDS 
CVMCACHE_STATUS_PARTIAL 

Definition at line 38 of file libcvmfs_cache.h.

Function Documentation

struct cvmcache_hash __attribute__ ( (__packed__)  )
void cvmcache_ask_detach ( struct cvmcache_context ctx)

Politely ask connected clients to release open nested catalogs so that more objects in the cache become unpinned.

Definition at line 335 of file libcvmfs_cache.cc.

Referenced by PluginRamCache::CheckHighPinWatermark(), and main().

Here is the caller graph for this function:

void cvmcache_cleanup_global ( )

Deletes global state, afterwards no further calls to cvmcache_... functions should take place.

Definition at line 316 of file libcvmfs_cache.cc.

Referenced by main().

Here is the caller graph for this function:

void cvmcache_get_session ( cvmcache_session session)

Returns a static pointer to an origin struct that identifies the client connection that triggered a callback. Calling this function is only valid from within a callback. Otherwise the function returns NULL values.

Definition at line 352 of file libcvmfs_cache.cc.

Here is the call graph for this function:

int cvmcache_hash_cmp ( struct cvmcache_hash a,
struct cvmcache_hash b 
)

Returns -1, 0, or 1 like other C comparison functions

Definition at line 296 of file libcvmfs_cache.cc.

Referenced by ComparableHash::operator!=(), ComparableHash::operator<(), ComparableHash::operator==(), and ComparableHash::operator>().

Here is the call graph for this function:

Here is the caller graph for this function:

char* cvmcache_hash_print ( const struct cvmcache_hash h)

The caller has to free the resulting string

Definition at line 307 of file libcvmfs_cache.cc.

Here is the call graph for this function:

struct cvmcache_context* cvmcache_init ( struct cvmcache_callbacks callbacks)

Definition at line 322 of file libcvmfs_cache.cc.

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

void cvmcache_init_global ( )

Should be called before any other cvmcache_... function.

Definition at line 313 of file libcvmfs_cache.cc.

Referenced by main().

Here is the caller graph for this function:

int cvmcache_is_supervised ( )

True if the plugin was started from a cvmfs mountpoint and thus will terminate by itself when the last mount point disconnects.

Definition at line 318 of file libcvmfs_cache.cc.

Referenced by main().

Here is the caller graph for this function:

int cvmcache_listen ( struct cvmcache_context ctx,
char *  locator 
)

The locator is either a UNIX domain socket (unix=/path/to/socket) or a tcp socket (tcp=hostname:port)

Definition at line 326 of file libcvmfs_cache.cc.

Referenced by main().

Here is the caller graph for this function:

uint32_t cvmcache_max_object_size ( struct cvmcache_context ctx)

Definition at line 348 of file libcvmfs_cache.cc.

char* cvmcache_options_dump ( cvmcache_option_map opts)

Prints the key-value pairs of cvmfs_option_map line-by-line. The resulting string needs to be freed by a call to cvmfs_options_free().

void cvmcache_options_fini ( cvmcache_option_map opts)

Frees the resources of a cvmfs_options_map, which was created by a call to cvmfs_options_init().

Referenced by main().

Here is the caller graph for this function:

void cvmcache_options_free ( char *  value)

Frees a string returned from cvmfs_options_get() or cvmfs_options_dump().

Definition at line 32 of file libcvmfs_cache_options.cc.

Referenced by anonymous_namespace{cvmfs_cache_posix.cc}::GetSettings(), and main().

Here is the caller graph for this function:

char* cvmcache_options_get ( cvmcache_option_map opts,
const char *  key 
)

Retrieves the value for a given key or NULL of the key does not exist. If the result is not NULL, it must be freed by a call to cvmfs_options_free().

Referenced by anonymous_namespace{cvmfs_cache_posix.cc}::GetSettings(), and main().

Here is the caller graph for this function:

cvmcache_option_map* cvmcache_options_init ( )

Definition at line 55 of file libcvmfs_cache_options.cc.

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

int cvmcache_options_parse ( cvmcache_option_map opts,
const char *  path 
)

Sets options from a file with linewise KEY=VALUE pairs. Returns 0 on success and -1 otherwise.

Referenced by main().

Here is the caller graph for this function:

void cvmcache_options_set ( cvmcache_option_map opts,
const char *  key,
const char *  value 
)

Fills a cvmfs_options_map. Use the same key/value pairs as the configuration parameters used by the fuse module in /etc/cvmfs/...

void cvmcache_options_unset ( cvmcache_option_map opts,
const char *  key 
)

Removes a key-value pair from a cvmfs_options_map. The key may or may not exist before the call.

void cvmcache_process_requests ( struct cvmcache_context ctx,
unsigned  nworkers 
)

Spawns a separate I/O thread that can be stopped with cvmcache_terminate. The nworkers parameter is currently unused.

Definition at line 330 of file libcvmfs_cache.cc.

Referenced by main().

Here is the caller graph for this function:

void cvmcache_spawn_watchdog ( const char *  crash_dump_file)

Can be used to spawn a second process that superwises the cache plugin. The watchdog can use gdb/lldb to generate stack traces. Must be closed by a call to cvmcache_close_watchdog(), otherwise the main process will be reported has having died unexpectedly.

Definition at line 361 of file libcvmfs_cache.cc.

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

void cvmcache_terminate ( struct cvmcache_context ctx)

Stops the processing thread.

Definition at line 344 of file libcvmfs_cache.cc.

Referenced by anonymous_namespace{cvmfs_cache_posix.cc}::handle_sigint(), and main().

Here is the caller graph for this function:

void cvmcache_terminate_watchdog ( )

Definition at line 369 of file libcvmfs_cache.cc.

Referenced by main().

Here is the caller graph for this function:

void cvmcache_wait_for ( struct cvmcache_context ctx)

Blocks until the processing thread finishes. Can either happen due to a call to cvmcache_terminate or – when the plugin is started from cvmfs – when the last repository is unmounted. Invalidates the context object.

Definition at line 339 of file libcvmfs_cache.cc.

Referenced by main().

Here is the caller graph for this function:

Variable Documentation

static void * __attribute__
inline

Used when the caller remembers the size, so that it can call sxunmap later.

Free memory acquired by sxmmap.

Pointer is aligned at a multiple of the size. The size has to be a multiple of 2MB.

Definition at line 24 of file atomic.h.

Referenced by Tracer::DoTrace(), AuthzSessionManager::HashPidKey(), and AuthzSessionManager::HashSessionKey().