From: Marco Tallskog Date: Wed, 14 Aug 2019 11:50:23 +0000 (+0300) Subject: Add resource locking X-Git-Tag: v0.3.0 X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=a10caff26de79e06caac2d00d3c11218e2d7ee87;hp=a10caff26de79e06caac2d00d3c11218e2d7ee87;p=ric-plt%2Fsdlgo.git Add resource locking Implement methods that enable applications to create locks for a resources. Resource locks are plain keys with a random value with an expiration time. Only the holder of a lock can release it either by removing the lock or by letting it expire (after it will be automatically removed). By using a random value (that only lock holder knows), it can be ensured that others can't remove it. Resource locks are per namespace. Implemented methods are: LockResource: this method will check if the lock already exists and if not, it will create it with an expiration time. It is possible for the client to define with options how many times the lock will be tried and the interval how often it is tried. If retry is used, this method will block. ReleaseResource: remove the lock. If removing is tried after the expiration, an error will be returned. RefreshResource: with this method, it is possible to set a new expiration time for the lock. If the lock has already expired, an error will be returned. CheckResource: application can query the remaining expiration time with this method, regardless it is the owner of the lock or not. Change-Id: Ic6f5274c1740c7e36ddaba564024cffcc4c5de3d Signed-off-by: Marco Tallskog ---