Since api was moved from `TrueCloudLab/frostfs-api-go` to sdk,
moving changes from TrueCloudLab/frostfs-api-go#125 here.
Signed-off-by: Ekaterina Lebedeva <ekaterina.lebedeva@yadro.com>
* `c.conn` may be already invalidated but the rpc client can't detect this.
`NewStream` may hang trying to open a stream with invalidated connection.
Using timer with `dialTimeout` for `NewStream` fixes this problem.
Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
* Sending empty chunks by `writeChunk` should not release new
objects as this doesn't change `payloadSizeLimiter` internal
state.
* This also fixes the bug with patcher when an offset of a patch
equals to `MaxSize` - `payloadSizeLimiter` releases object again
although state is the same. This led to error because EC-encoder
receieved empty payload and couldn't not process it.
Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
Implemented context timeout for all tree service operations except those that return a GRPC stream
Signed-off-by: Nikita Zinkevich <n.zinkevich@yadro.com>
A particular status code does not imply that a connection has not been
established. However, `Dial()` requires user to call `Close()` only if
the error was nil. Thus, it is `Dial()` responsibility to close
everything if it returns an error.
Introduced after the gRPC update in #270 (6009d089fc).
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
After removing `grpc.Dial` from client `DialTimeout` used only if
custom dialer provided. Client uses `BalanceOf` instead of `grpc.Dial`,
so it is required to use `DialTimeout` to not to use RPC timeout.
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
The previous policy target generated device-specific comments
(e.g., `/home/john_doe/repos/<...>`), which could result in
unnecessary file changes This behavior would confuse git and
require manual changes to resolve. The update ensures comments
are now device-agnostic, preventing unwanted changes.
Signed-off-by: Aleksey Savchuk <a.savchuk@yadro.com>
After api-go upgrade created client doesn't establish connection after created,
so RPC call is required to establish and check connection.
RPC call returns status error, so conversion from status error to context error
is required to satisfy Dial contract and unit tests.
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
* Make the method `PatchPayload` send a patch with empty
payload patch if range's length is non-zero and if it's the
first call.
* Empty payload patches just cut original object payload. So, these
patches are also valid.
Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
* The flag 'firstPayloadPatch' keeps its state after first
`PatchPayload` that make other calls incorrectly set patch
ranges.
Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
Since Go 1.22 a `for` statement with a `range` clause is able
to iterate through integer values from zero to an upper limit.
gopatch script:
@@
var i, e expression
@@
-for i := 0; i <= e - 1; i++ {
+for i := range e {
...
}
@@
var i, e expression
@@
-for i := 0; i <= e; i++ {
+for i := range e + 1 {
...
}
@@
var i, e expression
@@
-for i := 0; i < e; i++ {
+for i := range e {
...
}
Signed-off-by: Ekaterina Lebedeva <ekaterina.lebedeva@yadro.com>
Remove `client.ContainerEACL` and related references. This change
was initiated by the removal of `ContainerService.GetExtendedACL`
from the API.
Signed-off-by: Aleksey Savchuk <a.savchuk@yadro.com>