#[repr(C)]pub struct __wt_file_system {
pub fs_directory_list: Option<unsafe extern "C" fn(file_system: *mut WT_FILE_SYSTEM, session: *mut WT_SESSION, directory: *const c_char, prefix: *const c_char, dirlist: *mut *mut *mut c_char, countp: *mut u32) -> c_int>,
pub fs_directory_list_single: Option<unsafe extern "C" fn(file_system: *mut WT_FILE_SYSTEM, session: *mut WT_SESSION, directory: *const c_char, prefix: *const c_char, dirlist: *mut *mut *mut c_char, countp: *mut u32) -> c_int>,
pub fs_directory_list_free: Option<unsafe extern "C" fn(file_system: *mut WT_FILE_SYSTEM, session: *mut WT_SESSION, dirlist: *mut *mut c_char, count: u32) -> c_int>,
pub fs_exist: Option<unsafe extern "C" fn(file_system: *mut WT_FILE_SYSTEM, session: *mut WT_SESSION, name: *const c_char, existp: *mut bool) -> c_int>,
pub fs_open_file: Option<unsafe extern "C" fn(file_system: *mut WT_FILE_SYSTEM, session: *mut WT_SESSION, name: *const c_char, file_type: WT_FS_OPEN_FILE_TYPE, flags: u32, file_handlep: *mut *mut WT_FILE_HANDLE) -> c_int>,
pub fs_remove: Option<unsafe extern "C" fn(file_system: *mut WT_FILE_SYSTEM, session: *mut WT_SESSION, name: *const c_char, flags: u32) -> c_int>,
pub fs_rename: Option<unsafe extern "C" fn(file_system: *mut WT_FILE_SYSTEM, session: *mut WT_SESSION, from: *const c_char, to: *const c_char, flags: u32) -> c_int>,
pub fs_size: Option<unsafe extern "C" fn(file_system: *mut WT_FILE_SYSTEM, session: *mut WT_SESSION, name: *const c_char, sizep: *mut wt_off_t) -> c_int>,
pub terminate: Option<unsafe extern "C" fn(file_system: *mut WT_FILE_SYSTEM, session: *mut WT_SESSION) -> c_int>,
}Expand description
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 @ref custom_file_systems for more information.
@snippet ex_file_system.c WT_FILE_SYSTEM register
Fields§
§fs_directory_list: Option<unsafe extern "C" fn(file_system: *mut WT_FILE_SYSTEM, session: *mut WT_SESSION, directory: *const c_char, prefix: *const c_char, dirlist: *mut *mut *mut c_char, countp: *mut u32) -> c_int>Return a list of file names for the named directory.
@errors
@param file_system the WT_FILE_SYSTEM @param session the current WiredTiger session @param directory the name of the directory @param prefix if not NULL, only files with names matching the prefix are returned @param[out] dirlist the method returns an allocated array of individually allocated strings, one for each entry in the directory. @param[out] countp the number of entries returned
fs_directory_list_single: Option<unsafe extern "C" fn(file_system: *mut WT_FILE_SYSTEM, session: *mut WT_SESSION, directory: *const c_char, prefix: *const c_char, dirlist: *mut *mut *mut c_char, countp: *mut u32) -> c_int>§fs_directory_list_free: Option<unsafe extern "C" fn(file_system: *mut WT_FILE_SYSTEM, session: *mut WT_SESSION, dirlist: *mut *mut c_char, count: u32) -> c_int>Free memory allocated by WT_FILE_SYSTEM::directory_list.
@errors
@param file_system the WT_FILE_SYSTEM @param session the current WiredTiger session @param dirlist array returned by WT_FILE_SYSTEM::directory_list @param count count returned by WT_FILE_SYSTEM::directory_list
fs_exist: Option<unsafe extern "C" fn(file_system: *mut WT_FILE_SYSTEM, session: *mut WT_SESSION, name: *const c_char, existp: *mut bool) -> c_int>Return if the named file system object exists.
@errors
@param file_system the WT_FILE_SYSTEM @param session the current WiredTiger session @param name the name of the file @param[out] existp If the named file system object exists
fs_open_file: Option<unsafe extern "C" fn(file_system: *mut WT_FILE_SYSTEM, session: *mut WT_SESSION, name: *const c_char, file_type: WT_FS_OPEN_FILE_TYPE, flags: u32, file_handlep: *mut *mut WT_FILE_HANDLE) -> c_int>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.
@errors
@param file_system the WT_FILE_SYSTEM @param session the current WiredTiger session @param name the name of the file system object @param file_type the type of the file The file type is provided to allow optimization for different file access patterns. @param 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. @param[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.
fs_remove: Option<unsafe extern "C" fn(file_system: *mut WT_FILE_SYSTEM, session: *mut WT_SESSION, name: *const c_char, flags: u32) -> c_int>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.
@errors
@param file_system the WT_FILE_SYSTEM @param session the current WiredTiger session @param name the name of the file system object @param durable if the operation requires durability @param flags 0 or ::WT_FS_DURABLE
fs_rename: Option<unsafe extern "C" fn(file_system: *mut WT_FILE_SYSTEM, session: *mut WT_SESSION, from: *const c_char, to: *const c_char, flags: u32) -> c_int>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.
@errors
@param file_system the WT_FILE_SYSTEM @param session the current WiredTiger session @param from the original name of the object @param to the new name for the object @param flags 0 or ::WT_FS_DURABLE
fs_size: Option<unsafe extern "C" fn(file_system: *mut WT_FILE_SYSTEM, session: *mut WT_SESSION, name: *const c_char, sizep: *mut wt_off_t) -> c_int>Return the size of a named file system object
@errors
@param file_system the WT_FILE_SYSTEM @param session the current WiredTiger session @param name the name of the file system object @param[out] sizep the size of the file system entry
terminate: Option<unsafe extern "C" fn(file_system: *mut WT_FILE_SYSTEM, session: *mut WT_SESSION) -> c_int>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.
Trait Implementations§
Source§impl Clone for __wt_file_system
impl Clone for __wt_file_system
Source§fn clone(&self) -> __wt_file_system
fn clone(&self) -> __wt_file_system
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more