mirror of
https://github.com/aljazceru/kata-containers.git
synced 2025-12-27 02:54:27 +01:00
virtcontainers: store: Add a ItemLock API
The ItemLock API allows for taking shared and exclusive locks on all items. For virtcontainers, this is specialized into taking locks on the Lock item, and will be used for sandbox locking. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
@@ -261,3 +261,13 @@ func (s *Store) Raw(id string) (string, error) {
|
||||
|
||||
return s.backend.raw(id)
|
||||
}
|
||||
|
||||
// ItemLock takes a lock on an item.
|
||||
func (s *Store) ItemLock(item Item, exclusive bool) (string, error) {
|
||||
return s.backend.lock(item, exclusive)
|
||||
}
|
||||
|
||||
// ItemUnlock unlocks an item.
|
||||
func (s *Store) ItemUnlock(item Item, token string) error {
|
||||
return s.backend.unlock(item, token)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user