Trait LockFile

Source
pub trait LockFile {
    // Required method
    fn lock_file(
        &mut self,
        fname: &String,
        lock: *mut *mut Box<dyn FileLock>,
    ) -> Status;
}

Required Methods§

Source

fn lock_file( &mut self, fname: &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.

Implementors§