WT_FILE_HANDLE

Type Alias WT_FILE_HANDLE 

Source
pub type WT_FILE_HANDLE = __wt_file_handle;
Expand description

A file handle implementation returned by WT_FILE_SYSTEM::open_file.

Thread safety: Unless explicitly stated otherwise, WiredTiger may invoke methods on the WT_FILE_HANDLE interface from multiple threads concurrently. It is the responsibility of the implementation to protect any shared data.

See @ref custom_file_systems for more information.

Aliased Type§

#[repr(C)]
pub struct WT_FILE_HANDLE {
Show 17 fields pub file_system: *mut __wt_file_system, pub name: *mut i8, pub close: Option<unsafe extern "C" fn(*mut __wt_file_handle, *mut __wt_session) -> i32>, pub fh_advise: Option<unsafe extern "C" fn(*mut __wt_file_handle, *mut __wt_session, i64, i64, i32) -> i32>, pub fh_extend: Option<unsafe extern "C" fn(*mut __wt_file_handle, *mut __wt_session, i64) -> i32>, pub fh_extend_nolock: Option<unsafe extern "C" fn(*mut __wt_file_handle, *mut __wt_session, i64) -> i32>, pub fh_lock: Option<unsafe extern "C" fn(*mut __wt_file_handle, *mut __wt_session, bool) -> i32>, pub fh_map: Option<unsafe extern "C" fn(*mut __wt_file_handle, *mut __wt_session, *mut c_void, *mut usize, *mut c_void) -> i32>, pub fh_map_discard: Option<unsafe extern "C" fn(*mut __wt_file_handle, *mut __wt_session, *mut c_void, usize, *mut c_void) -> i32>, pub fh_map_preload: Option<unsafe extern "C" fn(*mut __wt_file_handle, *mut __wt_session, *const c_void, usize, *mut c_void) -> i32>, pub fh_unmap: Option<unsafe extern "C" fn(*mut __wt_file_handle, *mut __wt_session, *mut c_void, usize, *mut c_void) -> i32>, pub fh_read: Option<unsafe extern "C" fn(*mut __wt_file_handle, *mut __wt_session, i64, usize, *mut c_void) -> i32>, pub fh_size: Option<unsafe extern "C" fn(*mut __wt_file_handle, *mut __wt_session, *mut i64) -> i32>, pub fh_sync: Option<unsafe extern "C" fn(*mut __wt_file_handle, *mut __wt_session) -> i32>, pub fh_sync_nowait: Option<unsafe extern "C" fn(*mut __wt_file_handle, *mut __wt_session) -> i32>, pub fh_truncate: Option<unsafe extern "C" fn(*mut __wt_file_handle, *mut __wt_session, i64) -> i32>, pub fh_write: Option<unsafe extern "C" fn(*mut __wt_file_handle, *mut __wt_session, i64, usize, *const c_void) -> i32>,
}

Fields§

§file_system: *mut __wt_file_system

The enclosing file system, set by WT_FILE_SYSTEM::open_file.

§name: *mut i8

The name of the file, set by WT_FILE_SYSTEM::open_file.

§close: Option<unsafe extern "C" fn(*mut __wt_file_handle, *mut __wt_session) -> i32>

Close a file handle, the handle will not be further accessed by WiredTiger.

@errors

@param file_handle the WT_FILE_HANDLE @param session the current WiredTiger session

§fh_advise: Option<unsafe extern "C" fn(*mut __wt_file_handle, *mut __wt_session, i64, i64, i32) -> i32>

Indicate expected future use of file ranges, based on the POSIX 1003.1 standard fadvise.

This method is not required, and should be set to NULL when not supported by the file.

@errors

@param file_handle the WT_FILE_HANDLE @param session the current WiredTiger session @param offset the file offset @param len the size of the advisory @param advice one of ::WT_FILE_HANDLE_WILLNEED or ::WT_FILE_HANDLE_DONTNEED.

§fh_extend: Option<unsafe extern "C" fn(*mut __wt_file_handle, *mut __wt_session, i64) -> i32>

Extend the file.

This method is not required, and should be set to NULL when not supported by the file.

Any allocated disk space must read as 0 bytes, and no existing file data may change. Allocating all necessary underlying storage (not changing just the file’s metadata), is likely to result in increased performance.

This method is not called by multiple threads concurrently (on the same file handle). If the file handle’s extension method supports concurrent calls, set the WT_FILE_HANDLE::fh_extend_nolock method instead. See @ref custom_file_systems for more information.

@errors

@param file_handle the WT_FILE_HANDLE @param session the current WiredTiger session @param offset desired file size after extension

§fh_extend_nolock: Option<unsafe extern "C" fn(*mut __wt_file_handle, *mut __wt_session, i64) -> i32>

Extend the file.

This method is not required, and should be set to NULL when not supported by the file.

Any allocated disk space must read as 0 bytes, and no existing file data may change. Allocating all necessary underlying storage (not only changing the file’s metadata), is likely to result in increased performance.

This method may be called by multiple threads concurrently (on the same file handle). If the file handle’s extension method does not support concurrent calls, set the WT_FILE_HANDLE::fh_extend method instead. See @ref custom_file_systems for more information.

@errors

@param file_handle the WT_FILE_HANDLE @param session the current WiredTiger session @param offset desired file size after extension

§fh_lock: Option<unsafe extern "C" fn(*mut __wt_file_handle, *mut __wt_session, bool) -> i32>

Lock/unlock a file from the perspective of other processes running in the system, where necessary.

@errors

@param file_handle the WT_FILE_HANDLE @param session the current WiredTiger session @param lock whether to lock or unlock

§fh_map: Option<unsafe extern "C" fn(*mut __wt_file_handle, *mut __wt_session, *mut c_void, *mut usize, *mut c_void) -> i32>

Map a file into memory, based on the POSIX 1003.1 standard mmap.

This method is not required, and should be set to NULL when not supported by the file.

@errors

@param file_handle the WT_FILE_HANDLE @param session the current WiredTiger session @param[out] mapped_regionp a reference to a memory location into which should be stored a pointer to the start of the mapped region @param[out] lengthp a reference to a memory location into which should be stored the length of the region @param[out] mapped_cookiep a reference to a memory location into which can be optionally stored a pointer to an opaque cookie which is subsequently passed to WT_FILE_HANDLE::unmap.

§fh_map_discard: Option<unsafe extern "C" fn(*mut __wt_file_handle, *mut __wt_session, *mut c_void, usize, *mut c_void) -> i32>

Unmap part of a memory mapped file, based on the POSIX 1003.1 standard madvise.

This method is not required, and should be set to NULL when not supported by the file.

@errors

@param file_handle the WT_FILE_HANDLE @param session the current WiredTiger session @param map a location in the mapped region unlikely to be used in the near future @param length the length of the mapped region to discard @param mapped_cookie any cookie set by the WT_FILE_HANDLE::map method

§fh_map_preload: Option<unsafe extern "C" fn(*mut __wt_file_handle, *mut __wt_session, *const c_void, usize, *mut c_void) -> i32>

Preload part of a memory mapped file, based on the POSIX 1003.1 standard madvise.

This method is not required, and should be set to NULL when not supported by the file.

@errors

@param file_handle the WT_FILE_HANDLE @param session the current WiredTiger session @param map a location in the mapped region likely to be used in the near future @param length the size of the mapped region to preload @param mapped_cookie any cookie set by the WT_FILE_HANDLE::map method

§fh_unmap: Option<unsafe extern "C" fn(*mut __wt_file_handle, *mut __wt_session, *mut c_void, usize, *mut c_void) -> i32>

Unmap a memory mapped file, based on the POSIX 1003.1 standard munmap.

This method is only required if a valid implementation of map is provided by the file, and should be set to NULL otherwise.

@errors

@param file_handle the WT_FILE_HANDLE @param session the current WiredTiger session @param mapped_region a pointer to the start of the mapped region @param length the length of the mapped region @param mapped_cookie any cookie set by the WT_FILE_HANDLE::map method

§fh_read: Option<unsafe extern "C" fn(*mut __wt_file_handle, *mut __wt_session, i64, usize, *mut c_void) -> i32>

Read from a file, based on the POSIX 1003.1 standard pread.

@errors

@param file_handle the WT_FILE_HANDLE @param session the current WiredTiger session @param offset the offset in the file to start reading from @param len the amount to read @param[out] buf buffer to hold the content read from file

§fh_size: Option<unsafe extern "C" fn(*mut __wt_file_handle, *mut __wt_session, *mut i64) -> i32>

Return the size of a file.

@errors

@param file_handle the WT_FILE_HANDLE @param session the current WiredTiger session @param sizep the size of the file

§fh_sync: Option<unsafe extern "C" fn(*mut __wt_file_handle, *mut __wt_session) -> i32>

Make outstanding file writes durable and do not return until writes are complete.

This method is not required for read-only files, and should be set to NULL when not supported by the file.

@errors

@param file_handle the WT_FILE_HANDLE @param session the current WiredTiger session

§fh_sync_nowait: Option<unsafe extern "C" fn(*mut __wt_file_handle, *mut __wt_session) -> i32>

Schedule the outstanding file writes required for durability and return immediately.

This method is not required, and should be set to NULL when not supported by the file.

@errors

@param file_handle the WT_FILE_HANDLE @param session the current WiredTiger session

§fh_truncate: Option<unsafe extern "C" fn(*mut __wt_file_handle, *mut __wt_session, i64) -> i32>

Truncate the file.

This method is not required, and should be set to NULL when not supported by the file.

This method is not called by multiple threads concurrently (on the same file handle).

@errors

@param file_handle the WT_FILE_HANDLE @param session the current WiredTiger session @param offset desired file size after truncate

§fh_write: Option<unsafe extern "C" fn(*mut __wt_file_handle, *mut __wt_session, i64, usize, *const c_void) -> i32>

Write to a file, based on the POSIX 1003.1 standard pwrite.

This method is not required for read-only files, and should be set to NULL when not supported by the file.

@errors

@param file_handle the WT_FILE_HANDLE @param session the current WiredTiger session @param offset offset at which to start writing @param length amount of data to write @param buf content to be written to the file