Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: remove gRPC objects from IAgent #594

Merged
merged 7 commits into from
Jan 26, 2024
Merged

Conversation

aneojgurhem
Copy link
Contributor

@aneojgurhem aneojgurhem commented Jan 22, 2024

  • refactor: remove gRPC objects from IAgent NotifyResultData
  • refactor: remove gRPC objects from IAgent CreateResultsMetaData
  • refactor: remove gRPC objects from IAgent CreateResults

@aneojgurhem aneojgurhem marked this pull request as ready for review January 23, 2024 12:59
Common/src/gRPC/Services/Agent.cs Outdated Show resolved Hide resolved
@@ -123,17 +125,14 @@ public Task Stop()
};
}

var result = (await agent_.CreateResultsMetaData(new CreateResultsMetaDataRequest
var result = (await agent_.CreateResultsMetaData(agent_.Token,
new List<ResultCreationRequest>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
new List<ResultCreationRequest>
new ResultCreationRequest[]

public Task<ICollection<Result>> CreateResultsMetaData(string token,
ICollection<ResultCreationRequest> requests,
CancellationToken cancellationToken)
=> Task.FromResult(new List<Result>().AsICollection());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
=> Task.FromResult(new List<Result>().AsICollection());
=> Task.FromResult(Array.Empty<Result>().AsICollection());

@@ -70,21 +68,21 @@ public Task FinalizeTaskCreation(CancellationToken cancellationToken)
CancellationToken cancellationToken)
=> Task.FromResult(new List<TaskCreationRequest>().AsICollection());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
=> Task.FromResult(new List<TaskCreationRequest>().AsICollection());
=> Task.FromResult(Array.Empty<TaskCreationRequest>().AsICollection());

CommunicationToken = token,
},
Assert.ThrowsAsync<RpcException>(() => holder.Agent.CreateResultsMetaData(token,
new List<ResultCreationRequest>(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
new List<ResultCreationRequest>(),
Array.Empty<ResultCreationRequest>(),

Common/tests/Pollster/AgentTest.cs Outdated Show resolved Hide resolved
@@ -746,52 +684,34 @@ public async Task SubmitTasksCreateOneRequestShouldSucceed(bool optionsNull)
{
using var holder = new AgentHolder();

var payload = await holder.Agent.CreateResults(new CreateResultsRequest
var payload = await holder.Agent.CreateResults(holder.Token,
new List<(ResultCreationRequest request, ReadOnlyMemory<byte> data)>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
new List<(ResultCreationRequest request, ReadOnlyMemory<byte> data)>
new (ResultCreationRequest request, ReadOnlyMemory<byte> data)[]

},
CancellationToken.None)
.ConfigureAwait(false);

var eok = await holder.Agent.CreateResultsMetaData(new CreateResultsMetaDataRequest
var eok = await holder.Agent.CreateResultsMetaData(holder.Token,
new List<ResultCreationRequest>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
new List<ResultCreationRequest>
new ResultCreationRequest[]

Comment on lines +714 to 715
eok.Select(r => r.ResultId)
.AsICollection(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
eok.Select(r => r.ResultId)
.AsICollection(),
eok.ViewSelect(r => r.ResultId),

@@ -837,37 +757,27 @@ public async Task SubmitTasksUploadPayloadShouldSucceed(bool optionsNull)
{
using var holder = new AgentHolder();

var eok = await holder.Agent.CreateResultsMetaData(new CreateResultsMetaDataRequest
var eok = await holder.Agent.CreateResultsMetaData(holder.Token,
new List<ResultCreationRequest>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
new List<ResultCreationRequest>
new ResultCreationRequest[]

@aneojgurhem aneojgurhem merged commit 8c6fcf3 into main Jan 26, 2024
74 checks passed
@aneojgurhem aneojgurhem deleted the jg/refactoragent2 branch January 26, 2024 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants