Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaume-chervet committed Dec 20, 2024
1 parent 41ea8db commit b4b88d2
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/SlimFaas/Database/DatabaseMockService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public Task<long> ListCountElementAsync(string key, int maximum = Int32.MaxValue
return Task.FromResult<long>(list.Count);
}

public async Task ListSetQueueItemStatus(string key, ListQueueItemStatus queueItemStatus)
public async Task ListCallbackAsync(string key, ListQueueItemStatus queueItemStatus)
{
await Task.Delay(100);
}
Expand Down
2 changes: 1 addition & 1 deletion src/SlimFaas/Database/IDatabaseService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ public interface IDatabaseService
Task<IList<QueueData>?> ListRightPopAsync(string key, int count = 1);
Task<long> ListCountAvailableElementAsync(string key, int maximum = int.MaxValue);
Task<long> ListCountElementAsync(string key, int maximum = int.MaxValue);
Task ListSetQueueItemStatus(string key, ListQueueItemStatus queueItemStatus);
Task ListCallbackAsync(string key, ListQueueItemStatus queueItemStatus);
}
2 changes: 1 addition & 1 deletion src/SlimFaas/Database/ISlimFaasQueue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ public interface ISlimFaasQueue
{
Task EnqueueAsync(string key, byte[] message);
Task<IList<QueueData>?> DequeueAsync(string key, long count = 1);
Task ListSetQueueItemStatusAsync(string key, ListQueueItemStatus queueItemStatus);
Task ListCallbackAsync(string key, ListQueueItemStatus queueItemStatus);
public Task<long> CountAvailableElementAsync(string key, int maximum = int.MaxValue);
public Task<long> CountElementAsync(string key, int maximum = int.MaxValue);
}
6 changes: 3 additions & 3 deletions src/SlimFaas/Database/SlimDataService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -201,12 +201,12 @@ private async Task<long> DoListCountElementAsync(string key, int maximum)
return 0L;
}

public async Task ListSetQueueItemStatus(string key, ListQueueItemStatus queueItemStatus)
public async Task ListCallbackAsync(string key, ListQueueItemStatus queueItemStatus)
{
await Retry.Do(() => DoListSetQueueItemStatus(key, queueItemStatus), _retryInterval, logger, MaxAttemptCount);
await Retry.Do(() => DoListCallbackAsync(key, queueItemStatus), _retryInterval, logger, MaxAttemptCount);
}

private async Task DoListSetQueueItemStatus(string key, ListQueueItemStatus queueItemStatus)
private async Task DoListCallbackAsync(string key, ListQueueItemStatus queueItemStatus)
{
EndPoint endpoint = await GetAndWaitForLeader();
if (!cluster.LeadershipToken.IsCancellationRequested)
Expand Down
2 changes: 1 addition & 1 deletion src/SlimFaas/Database/SlimFaasQueue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public async Task EnqueueAsync(string key, byte[] data) =>
return data;
}

public async Task ListSetQueueItemStatusAsync(string key, ListQueueItemStatus queueItemStatus) => await databaseService.ListSetQueueItemStatus($"{KeyPrefix}{key}", queueItemStatus);
public async Task ListCallbackAsync(string key, ListQueueItemStatus queueItemStatus) => await databaseService.ListCallbackAsync($"{KeyPrefix}{key}", queueItemStatus);

public async Task<long> CountAvailableElementAsync(string key, int maximum = int.MaxValue) => await databaseService.ListCountAvailableElementAsync($"{KeyPrefix}{key}", maximum);

Expand Down
2 changes: 1 addition & 1 deletion src/SlimFaas/SlimWorker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ private async Task<int> ManageProcessingTasksAsync(ISlimFaasQueue slimFaasQueue,

if (listQueueItemStatus.Items.Count > 0)
{
await slimFaasQueue.ListSetQueueItemStatusAsync(functionDeployment, listQueueItemStatus);
await slimFaasQueue.ListCallbackAsync(functionDeployment, listQueueItemStatus);
}

int numberProcessingTasks = processingTasks[functionDeployment].Count;
Expand Down
2 changes: 1 addition & 1 deletion tests/SlimData.Tests/RaftClusterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ await databaseServiceSlave.HashSetAsync("hashsetKey1",
HttpCode = 200,
});
}
await databaseServiceSlave.ListSetQueueItemStatus("listKey1", queueItemStatus);
await databaseServiceSlave.ListCallbackAsync("listKey1", queueItemStatus);

await GetLocalClusterView(host1).ForceReplicationAsync();
var listLength2 = await databaseServiceSlave.ListCountAvailableElementAsync("listKey1");
Expand Down
2 changes: 1 addition & 1 deletion tests/SlimFaas.Tests/SlimProxyMiddlewareTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ internal class MemorySlimFaasQueue : ISlimFaasQueue
public Task<long> CountAvailableElementAsync(string key, int maximum) => throw new NotImplementedException();
public Task<long> CountElementAsync(string key, int maximum) => throw new NotImplementedException();

public Task ListSetQueueItemStatusAsync(string key, ListQueueItemStatus queueItemStatus) => throw new NotImplementedException();
public Task ListCallbackAsync(string key, ListQueueItemStatus queueItemStatus) => throw new NotImplementedException();

public async Task EnqueueAsync(string key, byte[] message) => await Task.Delay(100);

Expand Down

0 comments on commit b4b88d2

Please sign in to comment.