]> uap-core.de Git - note.git/commitdiff
add resource lock/unlock methods main
authorOlaf Wintermann <olaf.wintermann@gmail.com>
Tue, 23 Jun 2026 19:25:02 +0000 (21:25 +0200)
committerOlaf Wintermann <olaf.wintermann@gmail.com>
Tue, 23 Jun 2026 19:25:02 +0000 (21:25 +0200)
dav-rs/src/dav/resource.rs

index e0e6485a8cf04c9fb5668aa7d0b219ed04e141a3..c2e556f77e4959946a55e3227717e7dc36f547ef 100644 (file)
@@ -236,6 +236,18 @@ impl<'a> ResourceRef<'a> {
 
         result == 0
     }
+
+    pub fn lock(&self) -> bool {
+        unsafe { dav_lock(self.ptr) == 0 }
+    }
+
+    pub fn lock_t(&self, timeout: u64) -> bool {
+        unsafe { dav_lock_t(self.ptr, timeout as libc::time_t)  == 0 }
+    }
+
+    pub fn unlock(&self) -> bool {
+        unsafe { dav_unlock(self.ptr) == 0 }
+    }
 }
 
 
@@ -390,4 +402,8 @@ unsafe extern "C" {
     fn dav_get_content(res: *mut ffi::DavResource, stream: *mut c_void, write_func: DavWriteFunc) -> c_int;
     fn dav_set_content(res: *mut ffi::DavResource, stream: *mut c_void, read: DavReadFunc, seek: DavSeekFunc);
     fn dav_set_content_data(res: *mut ffi::DavResource, content: *const c_char, length: size_t);
+
+    fn dav_lock(res: *mut ffi::DavResource) -> c_int;
+    fn dav_lock_t(res: *mut ffi::DavResource, timeout: libc::time_t) -> c_int;
+    fn dav_unlock(res: *mut ffi::DavResource) -> c_int;
 }
\ No newline at end of file