pub struct PosixEnv { /* private fields */ }Expand description
Implementations§
Source§impl PosixEnv
impl PosixEnv
pub fn background_thread_main(&mut self)
Trait Implementations§
Source§impl CreateDir for PosixEnv
impl CreateDir for PosixEnv
Source§fn create_dir(&mut self, dirname: &String) -> Status
fn create_dir(&mut self, dirname: &String) -> Status
| Create the specified directory.
|
Source§impl DeleteDir for PosixEnv
impl DeleteDir for PosixEnv
Source§fn delete_dir(&mut self, dirname: &String) -> Status
fn delete_dir(&mut self, dirname: &String) -> Status
| Delete the specified directory.
|
Source§impl DeleteFile for PosixEnv
impl DeleteFile for PosixEnv
Source§fn delete_file(&mut self, filename: &String) -> Status
fn delete_file(&mut self, filename: &String) -> Status
| Delete the named file.
|
Source§impl Env for PosixEnv
impl Env for PosixEnv
fn new_appendable_file( &mut self, fname: &String, result: *mut *mut Box<dyn WritableFile>, ) -> Status
fn posix_default(&mut self) -> Rc<RefCell<dyn Env>>
Source§impl FileExists for PosixEnv
impl FileExists for PosixEnv
Source§fn file_exists(&mut self, filename: &String) -> bool
fn file_exists(&mut self, filename: &String) -> bool
| Returns true iff the named file exists.
|
Source§impl GetChildren for PosixEnv
impl GetChildren for PosixEnv
Source§impl GetFileSize for PosixEnv
impl GetFileSize for PosixEnv
Source§impl GetTestDirectory for PosixEnv
impl GetTestDirectory for PosixEnv
Source§fn get_test_directory(&mut self, result: *mut String) -> Status
fn get_test_directory(&mut self, result: *mut String) -> Status
| *path is set to a temporary directory that
| can be used for testing. It may or may not
| have just been created. The directory may or
| may not differ between runs of the same
| process, but subsequent calls will return the
| same directory.
Source§impl LockFile for PosixEnv
impl LockFile for PosixEnv
Source§fn lock_file(
&mut self,
filename: &String,
lock: *mut *mut Box<dyn FileLock>,
) -> Status
fn lock_file( &mut self, filename: &String, lock: *mut *mut Box<dyn FileLock>, ) -> Status
| Lock the specified file. Used to prevent
| concurrent access to the same db by multiple
| processes. On failure, stores nullptr in
| *lock and returns non-OK.
|
| On success, stores a pointer to the object
| that represents the acquired lock in *lock
| and returns OK. The caller should call
| UnlockFile(*lock) to release the lock. If
| the process exits, the lock will be
| automatically released.
|
| If somebody else already holds the lock,
| finishes immediately with a failure. I.e.,
| this call does not wait for existing locks to
| go away.
|
| May create the named file if it does not
| already exist.
Source§impl NewAppendableFile for PosixEnv
impl NewAppendableFile for PosixEnv
Source§fn new_appendable_file(
&mut self,
filename: &String,
result: *mut *mut Box<dyn WritableFile>,
) -> Status
fn new_appendable_file( &mut self, filename: &String, result: *mut *mut Box<dyn WritableFile>, ) -> Status
| Create an object that either appends to an
| existing file, or writes to a new file (if
| the file does not exist to begin with). On
| success, stores a pointer to the new file in
| *result and returns OK. On failure stores
| nullptr in *result and returns non-OK.
|
| The returned file will only be accessed by
| one thread at a time.
|
| May return an IsNotSupportedError error if
| this Env does not allow appending to an
| existing file. Users of Env (including the
| leveldb implementation) must be prepared to
| deal with an Env that does not support
| appending.
Source§impl NewRandomAccessFile for PosixEnv
impl NewRandomAccessFile for PosixEnv
Source§fn new_random_access_file(
&mut self,
filename: &String,
result: *mut *mut Box<dyn RandomAccessFile>,
) -> Status
fn new_random_access_file( &mut self, filename: &String, result: *mut *mut Box<dyn RandomAccessFile>, ) -> Status
| Create an object supporting random-access
| reads from the file with the specified name.
| On success, stores a pointer to the new file
| in *result and returns OK. On failure stores
| nullptr in *result and returns non-OK. If
| the file does not exist, returns a non-OK
| status. Implementations should return
| a NotFound status when the file does not
| exist.
|
| The returned file may be concurrently
| accessed by multiple threads.
Source§impl NewSequentialFile for PosixEnv
impl NewSequentialFile for PosixEnv
Source§fn new_sequential_file(
&mut self,
filename: &String,
result: *mut *mut Box<dyn SequentialFile>,
) -> Status
fn new_sequential_file( &mut self, filename: &String, result: *mut *mut Box<dyn SequentialFile>, ) -> Status
| Create an object that sequentially reads the
| file with the specified name.
|
| On success, stores a pointer to the new file
| in *result and returns OK.
|
| On failure stores nullptr in *result and
| returns non-OK. If the file does
|
| not exist, returns a non-OK status.
| Implementations should return a NotFound
| status when the file does not exist.
|
| The returned file will only be accessed by
| one thread at a time.
Source§impl NewWritableFile for PosixEnv
impl NewWritableFile for PosixEnv
Source§fn new_writable_file(
&mut self,
filename: &String,
result: *mut *mut Box<dyn WritableFile>,
) -> Status
fn new_writable_file( &mut self, filename: &String, result: *mut *mut Box<dyn WritableFile>, ) -> Status
| Create an object that writes to a new file
| with the specified name. Deletes any
| existing file with the same name and creates
| a new file. On success, stores a pointer to
| the new file in *result and returns OK. On
| failure stores nullptr in *result and returns
| non-OK.
|
| The returned file will only be accessed by
| one thread at a time.
Source§impl NowMicros for PosixEnv
impl NowMicros for PosixEnv
Source§fn now_micros(&mut self) -> u64
fn now_micros(&mut self) -> u64
| Returns the number of micro-seconds
| since some fixed point in time. Only
| useful for computing deltas of time.
|
Source§impl RenameFile for PosixEnv
impl RenameFile for PosixEnv
Source§impl Schedule for PosixEnv
impl Schedule for PosixEnv
Source§fn schedule(
&mut self,
background_work_function: fn(background_work_arg: *mut c_void) -> c_void,
background_work_arg: *mut c_void,
)
fn schedule( &mut self, background_work_function: fn(background_work_arg: *mut c_void) -> c_void, background_work_arg: *mut c_void, )
| Arrange to run “(*function)(arg)” once in
| a background thread.
|
| “function” may run in an unspecified thread.
| Multiple functions added to the same Env may
| run concurrently in different threads.
|
| I.e., the caller may not assume that
| background work items are serialized.
Source§impl SleepForMicroseconds for PosixEnv
impl SleepForMicroseconds for PosixEnv
Source§fn sleep_for_microseconds(&mut self, micros: i32)
fn sleep_for_microseconds(&mut self, micros: i32)
| Sleep/delay the thread for the prescribed
| number of micro-seconds.
|
Source§impl StartThread for PosixEnv
impl StartThread for PosixEnv
Auto Trait Implementations§
impl !Freeze for PosixEnv
impl !RefUnwindSafe for PosixEnv
impl !Send for PosixEnv
impl !Sync for PosixEnv
impl Unpin for PosixEnv
impl UnwindSafe for PosixEnv
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more