You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Connected.Common/Common/Distributed/DistributedLockService.cs

33 lines
974 B

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)
{
}
/// <summary>
/// This method performs a distribubuted lock on an entity. If the lock
/// cannot be obtained the exception is thrown.
/// </summary>
/// <param name="args">The arguments containing the entity on which
/// a distributed lock will be performed.</param>
/// <returns>The key of a newly acquired lock.</returns>
public async Task<Guid> Lock(DistributedLockArgs args)
{
return await Invoke(GetOperation<Ops.Lock>(), args);
}
public async Task Ping(DistributedLockPingArgs args)
{
await Invoke(GetOperation<Ops.Ping>(), args);
}
public async Task Unlock(PrimaryKeyArgs<Guid> args)
{
await Invoke(GetOperation<Ops.Unlock>(), args);
}
}