On this page:
lock-info
fs-lock!
fs-unlock!
call-with-fs-lock
fs-lock-info
fs-list-locks
Version: 4.2.1

4.4 Locks

(struct lock-info (path
    token
    owner
    comment
    creation-time
    expiration-time))
  path : path?
  token : bytes?
  owner : string?
  comment : (or/c string? #f)
  creation-time : time?
  expiration-time : (or/c time? #f)
A structure containing information about a lock.

The path and token can be used to identify the lock in fs-access-add-lock-token!, fs-lock! and fs-unlock! operations.

(fs-lock! fs    
  path    
  [#:token token    
  #:comment comment    
  #:expiration-time expiration-time    
  #:current-rev current-rev    
  #:steal steal?])  lock-info?
  fs : fs?
  path : path-string?
  token : (or/c bytes? #f) = #f
  comment : (or/c string? #f) = #f
  expiration-time : (or/c time? #f) = #f
  current-rev : (or/c exact-nonnegative-integer? #f) = #f
  steal? : any/c = #f
Locks the specified path in the file system fs. The file system must have an associated access context, the user of the access context becomes the owner of the lock.

The token uniquely identifies the lock. If it is not specified, a fresh token is generated for the lock. If it is specified and a lock with that token already exists, it must be installed at the same path as the new lock.

The comment is purely descriptive and need not be specified.

An expiration-time is optional. If specified, it must be a SRFI-19 UTC time or a duration. A duration is added to the current time to produce a value to be passed to the Subversion library. Locks without expiration time never expire.

If a current-rev is specified, the lock operation only succeeds if the path hasn’t been modified or deleted since that revision.

If steal? is not #f, any existing lock at the given path is removed and replaced by a new one.

(fs-unlock! fs path token)  void?
  fs : fs?
  path : path-string?
  token : (or/c bytes? #f)
Unlocks the specified path in the file system fs. Fails if the lock is expired or no lock is present at all.

If token is #f, the lock at the given path is broken regardless of its owner.

(call-with-fs-lock fs    
  path    
  thunk    
  [#:token token    
  #:comment comment    
  #:expiration-time expiration-time    
  #:current-rev current-rev    
  #:steal steal?])  any
  fs : fs?
  path : path-string?
  thunk : (-> any)
  token : (or/c bytes? #f) = #f
  comment : (or/c string? #f) = #f
  expiration-time : (or/c time? #f) = #f
  current-rev : (or/c exact-nonnegative-integer? #f) = #f
  steal? : any/c = #f
Calls the given thunk in a dynamic context, that establishes a lock at path in the file system fs upon entry and releases the lock upon exit.

When the lock is established, its token is also added to the current access context of the file system.

See fs-lock! for the precise meaning of the keyword arguments.

(fs-lock-info fs path)  (or/c lock-info? #f)
  fs : fs?
  path : path-string?
Checks for the presence of a lock at path in the file system fs. Returns a lock information object, if there is a lock and #f otherwise.

(fs-list-locks fs path)  (listof lock-info?)
  fs : fs?
  path : path-string?
Retrieves a list of lock information objects for any locks at or below path in file system fs.