The interface implemented by applications to provide a custom file system implementation. More...
Public Attributes | |
int(* | fs_directory_list )(WT_FILE_SYSTEM *file_system, WT_SESSION *session, const char *directory, const char *prefix, char ***dirlist, uint32_t *countp) |
Return a list of file names for the named directory. More... | |
int(* | fs_directory_list_free )(WT_FILE_SYSTEM *file_system, WT_SESSION *session, char **dirlist, uint32_t count) |
Free memory allocated by WT_FILE_SYSTEM::directory_list. More... | |
int(* | fs_exist )(WT_FILE_SYSTEM *file_system, WT_SESSION *session, const char *name, bool *existp) |
Return if the named file system object exists. More... | |
int(* | fs_open_file )(WT_FILE_SYSTEM *file_system, WT_SESSION *session, const char *name, WT_FS_OPEN_FILE_TYPE file_type, uint32_t flags, WT_FILE_HANDLE **file_handlep) |
Open a handle for a named file system object. More... | |
int(* | fs_remove )(WT_FILE_SYSTEM *file_system, WT_SESSION *session, const char *name, uint32_t flags) |
Remove a named file system object. More... | |
int(* | fs_rename )(WT_FILE_SYSTEM *file_system, WT_SESSION *session, const char *from, const char *to, uint32_t flags) |
Rename a named file system object. More... | |
int(* | fs_size )(WT_FILE_SYSTEM *file_system, WT_SESSION *session, const char *name, wt_off_t *sizep) |
Return the size of a named file system object. More... | |
int(* | terminate )(WT_FILE_SYSTEM *file_system, WT_SESSION *session) |
A callback performed when the file system is closed and will no longer be accessed by the WiredTiger database. More... | |
The interface implemented by applications to provide a custom file system implementation.
Thread safety: WiredTiger may invoke methods on the WT_FILE_SYSTEM interface from multiple threads concurrently. It is the responsibility of the implementation to protect any shared data.
Applications register implementations with WiredTiger by calling WT_CONNECTION::add_file_system. See Custom File Systems for more information.
int(* WT_FILE_SYSTEM::fs_directory_list) (WT_FILE_SYSTEM *file_system, WT_SESSION *session, const char *directory, const char *prefix, char ***dirlist, uint32_t *countp) |
Return a list of file names for the named directory.
file_system | the WT_FILE_SYSTEM | |
session | the current WiredTiger session | |
directory | the name of the directory | |
prefix | if not NULL, only files with names matching the prefix are returned | |
[out] | dirlist | the method returns an allocated array of individually allocated strings, one for each entry in the directory. |
[out] | countp | the number of entries returned |
int(* WT_FILE_SYSTEM::fs_directory_list_free) (WT_FILE_SYSTEM *file_system, WT_SESSION *session, char **dirlist, uint32_t count) |
Free memory allocated by WT_FILE_SYSTEM::directory_list.
file_system | the WT_FILE_SYSTEM |
session | the current WiredTiger session |
dirlist | array returned by WT_FILE_SYSTEM::directory_list |
count | count returned by WT_FILE_SYSTEM::directory_list |
int(* WT_FILE_SYSTEM::fs_exist) (WT_FILE_SYSTEM *file_system, WT_SESSION *session, const char *name, bool *existp) |
Return if the named file system object exists.
file_system | the WT_FILE_SYSTEM | |
session | the current WiredTiger session | |
name | the name of the file | |
[out] | existp | If the named file system object exists |
int(* WT_FILE_SYSTEM::fs_open_file) (WT_FILE_SYSTEM *file_system, WT_SESSION *session, const char *name, WT_FS_OPEN_FILE_TYPE file_type, uint32_t flags, WT_FILE_HANDLE **file_handlep) |
Open a handle for a named file system object.
The method should return ENOENT if the file is not being created and does not exist.
The method should return EACCES if the file cannot be opened in the requested mode (for example, a file opened for writing in a readonly file system).
The method should return EBUSY if WT_FS_OPEN_EXCLUSIVE is set and the file is in use.
file_system | the WT_FILE_SYSTEM | |
session | the current WiredTiger session | |
name | the name of the file system object | |
file_type | the type of the file The file type is provided to allow optimization for different file access patterns. | |
flags | flags indicating how to open the file, one or more of WT_FS_OPEN_CREATE, WT_FS_OPEN_DIRECTIO, WT_FS_OPEN_DURABLE, WT_FS_OPEN_EXCLUSIVE or WT_FS_OPEN_READONLY. | |
[out] | file_handlep | the handle to the newly opened file. File system implementations must allocate memory for the handle and the WT_FILE_HANDLE::name field, and fill in the WT_FILE_HANDLE:: fields. Applications wanting to associate private information with the WT_FILE_HANDLE:: structure should declare and allocate their own structure as a superset of a WT_FILE_HANDLE:: structure. |
int(* WT_FILE_SYSTEM::fs_remove) (WT_FILE_SYSTEM *file_system, WT_SESSION *session, const char *name, uint32_t flags) |
Remove a named file system object.
This method is not required for readonly file systems and should be set to NULL when not required by the file system.
file_system | the WT_FILE_SYSTEM |
session | the current WiredTiger session |
name | the name of the file system object |
durable | if the operation requires durability |
flags | 0 or WT_FS_DURABLE |
int(* WT_FILE_SYSTEM::fs_rename) (WT_FILE_SYSTEM *file_system, WT_SESSION *session, const char *from, const char *to, uint32_t flags) |
Rename a named file system object.
This method is not required for readonly file systems and should be set to NULL when not required by the file system.
file_system | the WT_FILE_SYSTEM |
session | the current WiredTiger session |
from | the original name of the object |
to | the new name for the object |
flags | 0 or WT_FS_DURABLE |
int(* WT_FILE_SYSTEM::fs_size) (WT_FILE_SYSTEM *file_system, WT_SESSION *session, const char *name, wt_off_t *sizep) |
Return the size of a named file system object.
file_system | the WT_FILE_SYSTEM | |
session | the current WiredTiger session | |
name | the name of the file system object | |
[out] | sizep | the size of the file system entry |
int(* WT_FILE_SYSTEM::terminate) (WT_FILE_SYSTEM *file_system, WT_SESSION *session) |
A callback performed when the file system is closed and will no longer be accessed by the WiredTiger database.
This method is not required and should be set to NULL when not required by the file system.
The WT_FILE_SYSTEM::terminate callback is intended to allow cleanup, the handle will not be subsequently accessed by WiredTiger.