Commit graph

1166 commits

Author SHA1 Message Date
Leonard Lyubich
48837bd5da [#288] pkg/eacl: Fix conversion of slices in Table.ToV2 method
Nil slice of records of the `Table` should be converted to nil slice in
corresponding field of API v2 message structure.

Add nil-check in `Table.ToV2` implementation. The changes fix corresponding
unit test.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-05-28 09:37:21 +03:00
Leonard Lyubich
fc4f7429d5 [#288] pkg/eacl: Document default values set in NewTable
Document field values of instance constructed via `NewTable`. Assert the
values in corresponding unit test.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-05-28 09:37:21 +03:00
Leonard Lyubich
8abf78009a [#288] pkg/eacl: Convert nil eACL table to nil API v2 message
Make `Table.ToV2` method to return `nil` when called on `nil`. Write
corresponding unit test.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-05-28 09:37:21 +03:00
Leonard Lyubich
8c70b4714e [#288] pkg/eacl: Fix conversion of slices in Record.ToV2 method
Nil slices of targets and filters of the `Record` should be converted to nil
slices in corresponding fields of API v2 message structure.

Add nil-check in `Record.ToV2` implementation. The changes fix corresponding
unit test.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-05-28 09:37:21 +03:00
Leonard Lyubich
374c37983d [#288] pkg/eacl: Document default values set in NewRecord
Document field values of instance constructed via `NewRecord`. Assert the
values in corresponding unit test.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-05-28 09:37:21 +03:00
Leonard Lyubich
18a3c4d54f [#288] pkg/eacl: Convert nil eACL record to nil API v2 message
Make `Record.ToV2` method to return `nil` when called on `nil`. Write
corresponding unit test.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-05-28 09:37:21 +03:00
Leonard Lyubich
b81f39368e [#288] pkg/eacl: Document default values set in NewTarget
Document field values of instance constructed via `NewTarget`. Assert the
values in corresponding unit test.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-05-28 09:37:21 +03:00
Leonard Lyubich
5844096017 [#288] pkg/eacl: Convert nil eACL target to nil API v2 message
Make `Target.ToV2` method to return `nil` when called on `nil`. Write
corresponding unit test.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-05-28 09:37:21 +03:00
Leonard Lyubich
8f27d857fa [#288] pkg/eacl: Document default values set in NewFilter
Document field values of instance constructed via `NewFilter`. Assert the
values in corresponding unit test.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-05-28 09:37:21 +03:00
Leonard Lyubich
89cb2f6e71 [#288] pkg/eacl: Convert nil eACL filter to nil message
Make `Filter.ToV2` method to return `nil` when called on `nil`. Write
corresponding unit test.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-05-28 09:37:21 +03:00
Leonard Lyubich
25de451a2f [#283] client/container: Write new fields to eACL table in GetEACL
Call `SetSessionToken` and `SetSignature` methods on resulting eACL table
with items from response body. From now eACL signature can be accessed from
the table itself, so `EACLWithSignature.Signature` is marked deprecated.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-05-26 12:24:58 +03:00
Leonard Lyubich
ad6b5aa8a9 [#283] client/container: Attach container session token to request
Write session token of `container.Container` to container SetExtendedACL
request body inside `client.SetEACL` call.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-05-26 12:24:58 +03:00
Leonard Lyubich
396210409d [#283] client/container: Write new fields to container in GetContainer
Call `SetSessionToken` and `SetSignature` methods on resulting container
with items from response body.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-05-26 12:24:58 +03:00
Leonard Lyubich
ddccfe0072 [#283] client/container: Attach container session token to request
Write session token of `container.Container` to container PUT request body
during `client.PutContainer` call.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-05-26 12:24:58 +03:00
Leonard Lyubich
d8f85e80c9 [#283] v2/container/test: Add setting of new fields in generators
Set signature and session token in `GenerateGetResponseBody`. Set session
token in `GenerateGetExtendedACLResponseBody`.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-05-26 12:24:58 +03:00
Leonard Lyubich
a4cf8df829 [#283] v2/container: Add missing testing of eACL-related messages
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-05-26 12:24:58 +03:00
Leonard Lyubich
92e8376f39 [#283] v2/container: Add session token and signature to response bodies
Add field of type `session.SessionToken` to `GetResponseBody` and
`GetExtendedACLResponseBody` messages. Add field of type `refs,Signature` to
`GetResponseBody` message. Change the implementation of all related methods.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-05-26 12:24:58 +03:00
Leonard Lyubich
dac997b8c3 [#283] v2/container/grpc: Implement setters of new fields
Implement `SetSessionToken` / `SetSignature` setters on `GetResponse_Body`.
Implement `SetSessionToken` setter on `GetExtendedACLResponse_Body`.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-05-26 12:24:58 +03:00
Leonard Lyubich
0719fcef59 [#283] pkg/container: Add session token and signature to Table
Extended ACL table can be set within a session, and should be signed.

Add `SessionToken` / `SetSessionToken` (`Signature` / `SetSignature`)
methods to carry session token (signature) in `Table` structure.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-05-26 12:24:58 +03:00
Leonard Lyubich
37b415347d [#283] pkg/token: Replace SessionToken into a session package
There is a need to add session token to `eacl.Table` structure. To do this,
we need to replace `token.SessionToken` type to another package since `eacl`
package imports `token` one (potential cross-import).

Create `pkg/session` package and replace session token implementation to it.
Related API in `container` package is deprecated from now.

Additionally implement test generator of random session tokens.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-05-26 12:24:58 +03:00
Leonard Lyubich
fcbe0bbd2e [#283] pkg/container: Add session token and signature to Container
Container can be created within a session, and should be signed.

Add `SessionToken` / `SetSessionToken` (`Signature` / `SetSignature`)
methods to carry session token (signature) in `Container` structure.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-05-26 12:24:58 +03:00
Leonard Lyubich
f60f7e0cdb [#283] pkg/eacl: Remove usage of deprecated container ID from src files
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-05-26 12:24:58 +03:00
Leonard Lyubich
7314038069 [#283] pkg/container: Define ID in a separate package
In order to prevent potential cross imports, container ID should be defined
in a separate package as a base type. A similar approach was used in the
NeoFS API design.

Create `pkg/container/id` package and replace container ID implementation to
it. Related API in `container` package is deprecated from now.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-05-26 12:24:58 +03:00
Leonard Lyubich
9eb567a53a [#283] v2/session: Support ContainerSessionContext message
Define `ContainerSessionContext` structure, implement getters / setters,
JSON and binary encoders, gRPC converters. Support new type of context in
SessionTokenBody message. Add test message generator and cover methods with
unit tests.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-05-26 12:24:58 +03:00
Leonard Lyubich
f2be7509d3 [#283] v2/session/grpc: Implement setters on container session messages
Implement `SessionToken_Body.SetContainerSessionContext` method. Implement
field setters on `ContainerSessionContext`.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-05-26 12:24:58 +03:00
Leonard Lyubich
8d60b2cdd5 [#283] v2/session/grpc: Fix docs of ObjectSessionContext methods
Fix docs of `SetVerb` and `SetAddress` methods of `ObjectSessionContext`.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-05-26 12:24:58 +03:00
Leonard Lyubich
af2a9d0851 [#283] v2/grpc: Compile source files with container session context
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-05-26 12:24:58 +03:00
Pavel Karpy
2ebb91cb4c [#286] client: Delete useless raw client init
Since raw client initialization is
postponed until the first `Raw()` function
call, there is no need to init empty(
without options) raw client in constructor.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-05-24 16:56:59 +03:00
Pavel Karpy
89aede1fb3 [#286] client: Add TLS options
Add `WithTLSConfig` option to client.
If it is not nil then client will
try to open secured connection.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-05-24 16:56:59 +03:00
Alex Vanin
634e405e9c Release v1.26.1
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2021-05-19 16:47:28 +03:00
Evgenii Stratonikov
9ddfcdfbba [#277] go.mod: remove pkg/errors
Use stdlib `errors` instead.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-05-19 11:14:56 +03:00
Alex Vanin
442f35d4a1 [#284] Update neo-go to v0.95.0
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2021-05-18 16:07:16 +03:00
Alex Vanin
3d28709b69 Release v1.26.0 - Daecheongdo (대청도, 大靑島)
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2021-05-07 15:11:18 +03:00
Alex Vanin
2e9db28f1c Bump version in pkg
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2021-05-07 15:11:18 +03:00
Alex Vanin
099347d3bc Synchronize namings with NeoFS API v2.6.0
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2021-05-07 15:11:18 +03:00
Leonard Lyubich
fcb2cce8a0 [#278] pkg/client: Fix payload slice allocation in Object Range method
Allocate capacity instead of length of the slice to write the object payload
range since each chunk is written through `append`.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-04-30 11:15:35 +03:00
Pavel Karpy
bb217067f4 [#275] reputation/convert: Add nil check
In `SendIntermediateResultRequestBody`
add nil check for `trust` field.
If true, allocate new `PeerToPeerTrust`.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-04-27 10:46:37 +03:00
Pavel Karpy
0f7a14a69f [#274] pkg/client: Add epoch field to SendIntermediateTrustPrm
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-04-22 13:37:07 +03:00
Pavel Karpy
541a56aae1 [#274] reputation: Adapt converters and encoding methods on messages
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-04-22 13:37:07 +03:00
Pavel Karpy
1076478b29 [#274] reputation: Recompile proto files
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-04-22 13:37:07 +03:00
Alex Vanin
5a507e0d1b [#273] Add go1.16 tests and fix linter error
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2021-04-16 16:32:14 +03:00
Leonard Lyubich
8128d598d0 [#265] pkg/client: Change trust type in SendIntermediateTrustPrm
Change accepted/returned value type of `SetTrust` / `Trust` methods of
`SendIntermediateTrustPrm` structure to `reputation.PeerToPeerTrust`.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-04-09 11:57:42 +03:00
Leonard Lyubich
a61c15b990 [#265] pkg/reputation: Implement PeerToPeerTrust structure
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-04-09 11:57:42 +03:00
Leonard Lyubich
269288119d [#265] v2/reputation: Support PeerToPeerTrust message
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-04-09 11:57:42 +03:00
Leonard Lyubich
771f395d9d [#265] pkg/reputation: Implement GlobalTrust type
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-04-02 15:57:59 +03:00
Leonard Lyubich
05a351d344 [#265] pkg/reputation: Change PeerID implementation
Make `PeerID` type to be the wrapper over v2 `PeerID` message structure.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-04-02 15:57:59 +03:00
Leonard Lyubich
c5000a3334 [#265] pkg/client: Extend Client with SendIntermediateTrust method
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-04-02 15:57:59 +03:00
Leonard Lyubich
710d1994a4 [#265] v2/rpc: Add SendIntermediateResult RPC
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-04-02 15:57:59 +03:00
Leonard Lyubich
35567afd11 [#265] v2/signature: Support SendIntermediateResult request and response
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-04-02 15:57:59 +03:00
Leonard Lyubich
ccae5a40ba [#265] reputation: Implement converters and encoding methods on messages
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-04-02 15:57:59 +03:00