using Connected.ServiceModel;
using Connected.Services;
using Ops = Common.Distributed.DistributedLockOps;
namespace Common.Distributed;
internal sealed class DistributedLockService : DistributedService, IDistributedLockService
{
public DistributedLockService(IContext context) : base(context)
{
}
///
/// This method performs a distribubuted lock on an entity. If the lock
/// cannot be obtained the exception is thrown.
///
/// The arguments containing the entity on which
/// a distributed lock will be performed.
/// The key of a newly acquired lock.
public async Task Lock(DistributedLockArgs args)
{
return await Invoke(GetOperation(), args);
}
public async Task Ping(DistributedLockPingArgs args)
{
await Invoke(GetOperation(), args);
}
public async Task Unlock(PrimaryKeyArgs args)
{
await Invoke(GetOperation(), args);
}
}