CernVM-FS
2.12.0
|
#include <fs_traversal_interface.h>
Public Attributes | |
struct fs_traversal_context * | context_ |
struct fs_traversal_context *(* | initialize )(const char *repo, const char *base, const char *data, const char *config, int num_threads) |
void(* | finalize )(struct fs_traversal_context *ctx) |
void(* | archive_provenance )(struct fs_traversal_context *src, struct fs_traversal_context *dest) |
void(* | list_dir )(struct fs_traversal_context *ctx, const char *dir, char ***buf, size_t *len) |
int(* | get_stat )(struct fs_traversal_context *ctx, const char *path, struct cvmfs_attr *stat, bool get_hash) |
bool(* | is_hash_consistent )(struct fs_traversal_context *ctx, const struct cvmfs_attr *stat) |
int(* | set_meta )(struct fs_traversal_context *ctx, const char *path, const struct cvmfs_attr *stat) |
char *(* | get_identifier )(struct fs_traversal_context *ctx, const struct cvmfs_attr *stat) |
bool(* | has_file )(struct fs_traversal_context *ctx, const char *identifier) |
int(* | do_link )(struct fs_traversal_context *ctx, const char *path, const char *identifier) |
int(* | do_unlink )(struct fs_traversal_context *ctx, const char *path) |
int(* | do_mkdir )(struct fs_traversal_context *ctx, const char *path, const struct cvmfs_attr *stat) |
int(* | do_rmdir )(struct fs_traversal_context *ctx, const char *path) |
int(* | touch )(struct fs_traversal_context *ctx, const struct cvmfs_attr *stat) |
void *(* | get_handle )(struct fs_traversal_context *ctx, const char *identifier) |
int(* | do_symlink )(struct fs_traversal_context *ctx, const char *src, const char *dest, const struct cvmfs_attr *stat_info) |
int(* | garbage_collector )(struct fs_traversal_context *ctx) |
int(* | do_fopen )(void *file_ctx, fs_open_type op_mode) |
int(* | do_fclose )(void *file_ctx) |
int(* | do_fread )(void *file_ctx, char *buff, size_t len, size_t *read_len) |
int(* | do_fwrite )(void *file_ctx, const char *buff, size_t len) |
void(* | do_ffree )(void *file_ctx) |
Definition at line 30 of file fs_traversal_interface.h.
void(* fs_traversal::archive_provenance)(struct fs_traversal_context *src, struct fs_traversal_context *dest) |
Method that takes the specifications provided and stores them in a provenance directory.
[in] | src | The src context being archived |
[in] | dest | The dest context being archived |
Definition at line 74 of file fs_traversal_interface.h.
Referenced by main(), and posix_get_interface().
struct fs_traversal_context* fs_traversal::context_ |
Local copy of the context that should be set with the returned value of initialize. This is allocated using initialize and freed using finalize.
Definition at line 36 of file fs_traversal_interface.h.
Referenced by shrinkwrap::copyFile(), shrinkwrap::cvmfs_attr_cmp(), shrinkwrap::GarbageCollect(), shrinkwrap::handle_dir(), shrinkwrap::handle_file(), shrinkwrap::list_src_dir(), main(), shrinkwrap::Sync(), and shrinkwrap::updateStat().
int(* fs_traversal::do_fclose)(void *file_ctx) |
Method which closes a file described by the given file context. Needs to be called after open. After this operation open needs to be called again before further read and write operations
[in,out] | file_ctx | The file context used |
Definition at line 329 of file fs_traversal_interface.h.
Referenced by shrinkwrap::copyFile(), libcvmfs_get_interface(), and posix_get_interface().
void(* fs_traversal::do_ffree)(void *file_ctx) |
Method which frees a given file context
Definition at line 357 of file fs_traversal_interface.h.
Referenced by shrinkwrap::copyFile(), libcvmfs_get_interface(), and posix_get_interface().
int(* fs_traversal::do_fopen)(void *file_ctx, fs_open_type op_mode) |
Method which opens a file described by the given file context. Needs to be called before read and write operations
[in,out] | file_ctx | The file context used for opening |
[in] | op_mode | The mode for opening the file |
Definition at line 318 of file fs_traversal_interface.h.
Referenced by shrinkwrap::copyFile(), libcvmfs_get_interface(), and posix_get_interface().
int(* fs_traversal::do_fread)(void *file_ctx, char *buff, size_t len, size_t *read_len) |
Method which reads len chars into buff from the file described by the given context
[in] | file_ctx | The file context used |
[out] | buff | The buffer to write to |
[in] | len | The length of the buffer buff |
[out] | read_len | The number of chars read $returns 0 on success |
Definition at line 341 of file fs_traversal_interface.h.
Referenced by shrinkwrap::copyFile(), libcvmfs_get_interface(), and posix_get_interface().
int(* fs_traversal::do_fwrite)(void *file_ctx, const char *buff, size_t len) |
Method which writes len chars from buff into the file described by the given context
[in] | file_ctx | The file context used |
[in] | buff | The buffer to read from |
[in] | len | The length of the buffer buff |
Definition at line 352 of file fs_traversal_interface.h.
Referenced by shrinkwrap::copyFile(), libcvmfs_get_interface(), and posix_get_interface().
int(* fs_traversal::do_link)(struct fs_traversal_context *ctx, const char *path, const char *identifier) |
Method which creates a hardlink from the given path to the file given by its identifier
For this call to succeed the file given by its identifier already needs to exist in the destination filesystem
If the path already exists the old entry will silently be removed and a new link will be created
Error if:
[in] | ctx | The file system traversal context |
[in] | path | The path where the file should be linked |
[in] | identifier | The identifier of the file (usually obtained through get_identifier) |
Definition at line 196 of file fs_traversal_interface.h.
Referenced by shrinkwrap::handle_file(), and posix_get_interface().
int(* fs_traversal::do_mkdir)(struct fs_traversal_context *ctx, const char *path, const struct cvmfs_attr *stat) |
Method which will create the given directory
If the path already exists the old entry will silently be removed and a new directory will be created
Error if:
[in] | ctx | The file system traversal context |
[in] | path | The path to the directory that should be created |
[in] | stat | The stat containing the meta data for directory creation |
Definition at line 227 of file fs_traversal_interface.h.
Referenced by shrinkwrap::handle_dir(), and posix_get_interface().
int(* fs_traversal::do_rmdir)(struct fs_traversal_context *ctx, const char *path) |
Method which removes the given directory
Error if:
[in] | ctx | The file system traversal context |
[in] | path | The path to the directory that should be removed |
Definition at line 241 of file fs_traversal_interface.h.
Referenced by posix_get_interface(), and shrinkwrap::Sync().
int(* fs_traversal::do_symlink)(struct fs_traversal_context *ctx, const char *src, const char *dest, const struct cvmfs_attr *stat_info) |
Method which creates a symlink at src which points to dest
If src already exists the old entry will silently be removed and a new symlink will be created
Error:
[in] | ctx | The file system traversal context |
[in] | src | The position at which the symlink should be saved (parent directory must exist) |
[in] | dest | The position the symlink should point to |
[in] | stat_info | The stat containing the meta data for symlink creation |
Definition at line 291 of file fs_traversal_interface.h.
Referenced by posix_get_interface(), and shrinkwrap::Sync().
int(* fs_traversal::do_unlink)(struct fs_traversal_context *ctx, const char *path) |
Method removes the hardlink at the given path
Error if:
[in] | ctx | The file system traversal context |
[in] | path | The path which should be removed |
Definition at line 211 of file fs_traversal_interface.h.
Referenced by posix_get_interface(), and shrinkwrap::Sync().
void(* fs_traversal::finalize)(struct fs_traversal_context *ctx) |
Method which finalizes the file system traversal. Must always be called after a context had been initialized and before the procedure ends
The context is freed during execution of this method
[in] | ctx | The context to finalize and free |
Definition at line 65 of file fs_traversal_interface.h.
Referenced by libcvmfs_get_interface(), main(), and posix_get_interface().
int(* fs_traversal::garbage_collector)(struct fs_traversal_context *ctx) |
Method which executes garbage collection on the file systems hidden data directories.
This method is usually quite costly in terms of time and should only be invoked with care! If multiple repositories share the same hidden data repository it makes sense to invoke it only once all repositories are up to date.
[in] | ctx | The file system traversal context |
Definition at line 308 of file fs_traversal_interface.h.
Referenced by shrinkwrap::GarbageCollect(), and posix_get_interface().
void*(* fs_traversal::get_handle)(struct fs_traversal_context *ctx, const char *identifier) |
Retrieves a handle struct which allows the manipulation of the file defined by the given identifier
[in] | ctx | The file system traversal context |
[in] | identifier | The identifier of the file to manipulate (usually obtained through get_identifier) |
Definition at line 268 of file fs_traversal_interface.h.
Referenced by shrinkwrap::copyFile(), libcvmfs_get_interface(), and posix_get_interface().
char*(* fs_traversal::get_identifier)(struct fs_traversal_context *ctx, const struct cvmfs_attr *stat) |
Method which returns an identifier (usually a path) to a file identified by a stat struct
The memory of the char is allocated on the heap and needs to be freed by the caller
[in] | ctx | The file system traversal context |
[in] | stat | The stat struct describing the file |
Definition at line 161 of file fs_traversal_interface.h.
Referenced by shrinkwrap::handle_file(), libcvmfs_get_interface(), and posix_get_interface().
int(* fs_traversal::get_stat)(struct fs_traversal_context *ctx, const char *path, struct cvmfs_attr *stat, bool get_hash) |
Method which returns a stat struct given a file path. If the file doesn't exist, NULL is returned
For correct behaviour the following fields must be set (and may not be NULL):
[in] | ctx | The file system traversal context |
[in] | path | The path of the object to stat |
[out] | stat | The stat struct to write the information into |
[in] | get_hash | Whether the file hash in cvm_checksum should be calculated (true) or not (false) |
Definition at line 115 of file fs_traversal_interface.h.
Referenced by libcvmfs_get_interface(), posix_get_interface(), and shrinkwrap::updateStat().
bool(* fs_traversal::has_file)(struct fs_traversal_context *ctx, const char *identifier) |
Method which checks whether the file described by the given path exists in the destination file system
[in] | ctx | The file system traversal context |
[in] | identifier | The identifier of the file (obtained by get_identifier) |
Definition at line 174 of file fs_traversal_interface.h.
Referenced by libcvmfs_get_interface(), and posix_get_interface().
struct fs_traversal_context*(* fs_traversal::initialize)(const char *repo, const char *base, const char *data, const char *config, int num_threads) |
Method which initializes a file system traversal context based on repository and data storage information
[in] | repo | Repository name |
[in] | base | Base repository location |
[in] | data | Data storage information |
[in] | config | A configuration file name |
[in] | num_threads | Number of threads that may be started |
[out] | A | pointer to the context |
Definition at line 49 of file fs_traversal_interface.h.
Referenced by libcvmfs_get_interface(), main(), and posix_get_interface().
bool(* fs_traversal::is_hash_consistent)(struct fs_traversal_context *ctx, const struct cvmfs_attr *stat) |
Checks whether for a given stat the file at the stat's path name is actually linked to the file described by the stat's checksum
If this method returns false it usually means the file is out of sync and needs to be copied and linked
Error if:
[in] | ctx | The file system traversal context |
[in] | stat | The stat which should be used for the consistency check |
Definition at line 134 of file fs_traversal_interface.h.
Referenced by shrinkwrap::cvmfs_attr_cmp(), posix_get_interface(), and shrinkwrap::Sync().
void(* fs_traversal::list_dir)(struct fs_traversal_context *ctx, const char *dir, char ***buf, size_t *len) |
Method which returns a list of the given directory. Should not include "." or "..".
[in] | ctx | The file system traversal context |
[in] | dir | The directory over which should be iterated |
[out] | buf | The list of the paths to the elements in the directory |
[out] | len | Length of the output list |
Definition at line 86 of file fs_traversal_interface.h.
Referenced by libcvmfs_get_interface(), shrinkwrap::list_src_dir(), posix_get_interface(), and shrinkwrap::Sync().
int(* fs_traversal::set_meta)(struct fs_traversal_context *ctx, const char *path, const struct cvmfs_attr *stat) |
Sets the meta information for the directory entry. This assumes that other information is the same, and only updates the metadata. Used only on directories.
[in] | ctx | The file system traversal context |
[in] | path | The path of the object to be updated |
[in] | stat | The stat structure that determines the new values |
Definition at line 147 of file fs_traversal_interface.h.
Referenced by shrinkwrap::handle_dir(), and posix_get_interface().
int(* fs_traversal::touch)(struct fs_traversal_context *ctx, const struct cvmfs_attr *stat) |
Atomically creates the file representing the given identifier
Error:
[in] | ctx | The file system traversal context |
[in] | stat | The stat containing the meta data for file creation |
Definition at line 255 of file fs_traversal_interface.h.
Referenced by shrinkwrap::handle_file(), and posix_get_interface().