CernVM-FS  2.9.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
cache_posix.cc File Reference
#include "cvmfs_config.h"
#include "cache_posix.h"
Include dependency graph for cache_posix.cc:

Go to the source code of this file.

Classes

class  anonymous_namespace{cache_posix.cc}::CallGuard
 

Namespaces

 anonymous_namespace{cache_posix.cc}
 

Macros

#define __STDC_FORMAT_MACROS
 

Macro Definition Documentation

#define __STDC_FORMAT_MACROS

This file is part of the CernVM File System.

The cache module maintains the local file cache. Files are staged into the cache by Fetch(). The cache stores files with a name according to their content hash.

The procedure is

  1. Look in the catalog for content hash
  2. If it is in local cache: return file descriptor
  3. Otherwise download, store in cache and return fd

Each running CVMFS instance has to have a separate cache directory. The local cache directory (directories 00..ff) can be accessed in parallel to a running CVMFS, i.e. files can be deleted for instance anytime. However, this will confuse the cache database managed by the lru module.

Files are created in txn directory first. At the very latest point they are renamed into their "real" content hash names atomically by rename(). This concept is taken over from GROW-FS.

Identical URLs won't be concurrently downloaded. The first thread performs the download and informs the other, waiting threads on pipes.

Definition at line 27 of file cache_posix.cc.