MCPcopy
hub / github.com/borgbackup/borg / migrate_lock

Method migrate_lock

src/borg/fslocking.py:354–371  ·  view source on GitHub ↗

migrate the lock ownership from old_id to new_id

(self, key, old_id, new_id)

Source from the content-addressed store, hash-verified

352 self.save(roster)
353
354 def migrate_lock(self, key, old_id, new_id):
355 """migrate the lock ownership from old_id to new_id"""
356 assert self.id == old_id
357 # need to switch off stale lock killing temporarily as we want to
358 # migrate rather than kill them (at least the one made by old_id).
359 killing, self.kill_stale_locks = self.kill_stale_locks, False
360 try:
361 try:
362 self.modify(key, REMOVE2)
363 except KeyError:
364 # entry was not there, so no need to add a new one, but still update our id
365 self.id = new_id
366 else:
367 # old entry removed, update our id and add a updated entry
368 self.id = new_id
369 self.modify(key, ADD)
370 finally:
371 self.kill_stale_locks = killing
372
373
374class Lock:

Callers 1

test_migrate_lockMethod · 0.95

Calls 1

modifyMethod · 0.95

Tested by 1

test_migrate_lockMethod · 0.76