[#24] Client: Implement pool part1 #31

Merged
PavelGrossSpb merged 3 commits from PavelGrossSpb/frostfs-sdk-csharp:poll into master 2024-11-20 15:44:04 +00:00
Member

First iteration - base classes and methods

Signed-off-by: Pavel Gross p.gross@yadro.com

First iteration - base classes and methods Signed-off-by: Pavel Gross <p.gross@yadro.com>
PavelGrossSpb added 1 commit 2024-10-21 07:50:07 +00:00
[#24] Client: Implement pool part1
All checks were successful
DCO / DCO (pull_request) Successful in 46s
c9a75ea025
first iteration - base classes and methods

Signed-off-by: Pavel Gross <p.gross@yadro.com>
PavelGrossSpb requested review from dstepanov-yadro 2024-10-21 07:50:33 +00:00
PavelGrossSpb requested review from orikik 2024-10-21 07:50:33 +00:00
dstepanov-yadro requested changes 2024-10-23 07:15:38 +00:00
Dismissed
@ -483,0 +536,4 @@
return null;
}
catch (FrostFsException ex)

To tell the truth, it doesn't look pretty. Without examining the source code, it is unclear what the returned string means.

To tell the truth, it doesn't look pretty. Without examining the source code, it is unclear what the returned string means.
Author
Member

refactored

refactored
dstepanov-yadro marked this conversation as resolved
@ -0,0 +95,4 @@
await ScheduleGracefulClose().ConfigureAwait(false);
}
#pragma warning disable CA2000 // Dispose objects before losing scope: will be disposed manually

Could be resolved with

var client FrostFSClient
try {
client = new(WrapperPrm);
...
Client = client;
client = null;
}
finally {
client?.Dispose();
}
Could be resolved with ``` var client FrostFSClient try { client = new(WrapperPrm); ... Client = client; client = null; } finally { client?.Dispose(); } ```
Author
Member

and why do I need a reference to disposed object?

and why do I need a reference to disposed object?

I did not understand the question: where is the reference to disposed object?
There are 4 main steps:

  1. Create temp reference to disposable object
  2. Inside try block create an disposable object to this reference
  3. Inside try block transfer ownership of disposable object from temp reference to new owner and set null to temp reference: now Client field holds reference to disposable object, not temp reference
  4. Dispose disposable object if it is not null
I did not understand the question: where is the reference to disposed object? There are 4 main steps: 1. Create temp reference to disposable object 2. Inside `try` block create an disposable object to this reference 3. Inside `try` block transfer ownership of disposable object from temp reference to new owner and set `null` to temp reference: now `Client` field holds reference to disposable object, not temp reference 4. Dispose disposable object if it is not `null`
Author
Member

Got it. But it looks like a strange trick to avoid dispose pattern warning that follows another analizer warning about "always null variable". The suppressing comment is a good reminder about dispose necessity and keeps the code clean and clear.

Got it. But it looks like a strange trick to avoid dispose pattern warning that follows another analizer warning about "always null variable". The suppressing comment is a good reminder about dispose necessity and keeps the code clean and clear.

I don't think it is a trick, but if you ok with it, I'm ok too.

I don't think it is a trick, but if you ok with it, I'm ok too.
@ -0,0 +296,4 @@
);
}
private FrostFSClient? Сonnection()

See warning

See warning
Author
Member

fixed

fixed
dstepanov-yadro marked this conversation as resolved
PavelGrossSpb added 1 commit 2024-11-01 07:30:52 +00:00
[#24] Client: Implement pool part2
All checks were successful
DCO / DCO (pull_request) Successful in 46s
ee20798379
Signed-off-by: Pavel Gross <p.gross@yadro.com>
PavelGrossSpb added 1 commit 2024-11-01 07:41:34 +00:00
[#24] Client: Implement pool part2
All checks were successful
DCO / DCO (pull_request) Successful in 52s
bff8d67867
Unicode fix

Signed-off-by: Pavel Gross <p.gross@yadro.com>
dstepanov-yadro approved these changes 2024-11-05 07:50:48 +00:00
PavelGrossSpb merged commit bff8d67867 into master 2024-11-05 11:44:51 +00:00
PavelGrossSpb deleted branch poll 2024-11-05 11:44:52 +00:00
Sign in to join this conversation.
No description provided.