Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

lock until cancelled

chrisluaafb874ad2b4
diff --git a/weed/cluster/lock_client.go b/weed/cluster/lock_client.go
index 6a6f7a4502..de37476a90 100644
--- a/weed/cluster/lock_client.go
+++ b/weed/cluster/lock_client.go
@@ -35,7 +35,17 @@ type LiveLock struct {
isLocked bool
}
-func (lc *LockClient) NewLock(filer pb.ServerAddress, key string, lockDuration time.Duration) (lock *LiveLock) {
+// NewLockWithTimeout locks the key with the given duration
+func (lc *LockClient) NewLockWithTimeout(filer pb.ServerAddress, key string, lockDuration time.Duration) (lock *LiveLock) {
+ return lc.doNewLock(filer, key, lockDuration)
+}
+
+// NewLock creates a lock with a very long duration
+func (lc *LockClient) NewLock(filer pb.ServerAddress, key string) (lock *LiveLock) {
+ return lc.doNewLock(filer, key, time.Duration(1<<63-1))
+}
+
+func (lc *LockClient) doNewLock(filer pb.ServerAddress, key string, lockDuration time.Duration) (lock *LiveLock) {
lock = &LiveLock{
key: key,
filer: filer,