WT_FILE_SYSTEM

Type Alias WT_FILE_SYSTEM 

Source
pub type WT_FILE_SYSTEM = __wt_file_system;
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

Aliased Type§

#[repr(C)]
pub struct WT_FILE_SYSTEM { pub fs_directory_list: Option<unsafe extern "C" fn(*mut __wt_file_system, *mut __wt_session, *const i8, *const i8, *mut *mut *mut i8, *mut u32) -> i32>, pub fs_directory_list_single: Option<unsafe extern "C" fn(*mut __wt_file_system, *mut __wt_session, *const i8, *const i8, *mut *mut *mut i8, *mut u32) -> i32>, pub fs_directory_list_free: Option<unsafe extern "C" fn(*mut __wt_file_system, *mut __wt_session, *mut *mut i8, u32) -> i32>, pub fs_exist: Option<unsafe extern "C" fn(*mut __wt_file_system, *mut __wt_session, *const i8, *mut bool) -> i32>, pub fs_open_file: Option<unsafe extern "C" fn(*mut __wt_file_system, *mut __wt_session, *const i8, u32, u32, *mut *mut __wt_file_handle) -> i32>, pub fs_remove: Option<unsafe extern "C" fn(*mut __wt_file_system, *mut __wt_session, *const i8, u32) -> i32>, pub fs_rename: Option<unsafe extern "C" fn(*mut __wt_file_system, *mut __wt_session, *const i8, *const i8, u32) -> i32>, pub fs_size: Option<unsafe extern "C" fn(*mut __wt_file_system, *mut __wt_session, *const i8, *mut i64) -> i32>, pub terminate: Option<unsafe extern "C" fn(*mut __wt_file_system, *mut __wt_session) -> i32>, }

Fields§

§fs_directory_list: Option<unsafe extern "C" fn(*mut __wt_file_system, *mut __wt_session, *const i8, *const i8, *mut *mut *mut i8, *mut u32) -> i32>

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(*mut __wt_file_system, *mut __wt_session, *const i8, *const i8, *mut *mut *mut i8, *mut u32) -> i32>§fs_directory_list_free: Option<unsafe extern "C" fn(*mut __wt_file_system, *mut __wt_session, *mut *mut i8, u32) -> i32>

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(*mut __wt_file_system, *mut __wt_session, *const i8, *mut bool) -> i32>

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(*mut __wt_file_system, *mut __wt_session, *const i8, u32, u32, *mut *mut __wt_file_handle) -> i32>

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(*mut __wt_file_system, *mut __wt_session, *const i8, u32) -> i32>

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(*mut __wt_file_system, *mut __wt_session, *const i8, *const i8, u32) -> i32>

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(*mut __wt_file_system, *mut __wt_session, *const i8, *mut i64) -> i32>

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(*mut __wt_file_system, *mut __wt_session) -> i32>

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.