Commit Graph

378 Commits (fix/31-policy_placement_marsh)

Author SHA1 Message Date
Leonard Lyubich 88a3829b39 [#293] pkg/eacl: Implement and use generator of Target
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-06-08 18:59:15 +03:00
Leonard Lyubich e0ac55c526 [#293] pkg/accounting: Implement and use generator of Decimal
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-06-08 18:59:15 +03:00
Pavel Karpy 0f478a9dc6 [#301] pkg/object: Add `MarshalHeaderJSON` method
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-06-07 15:21:37 +03:00
Leonard Lyubich cc1163fd57 [#298] pkg/session/test: Set lifetime fields in Generate func
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-06-07 13:26:59 +03:00
Leonard Lyubich 779a61c97d [#298] pkg/session: Implement methods to work with Token lifetime
Implement `Exp`/`SetExp`/`Nbf`/`SetNbf`/`Iat`/`SetIat` methods on `Token`
type which provide access to the message fields of the same name.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-06-07 13:26:59 +03:00
Leonard Lyubich 7968c4994a [#298] pkg/session: Remove redundant slashes from SetSessionKey docs
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-06-07 13:26:59 +03:00
Pavel Karpy 52c1c4c5ab [#290] client: Add `WithURIAddress` option
Add `WithURIAddress` option to client.
It parses passed address with
`url.ParseRequestURI` function and
use(or not) TLS over grpc connection
based on retrieved scheme('grpc' or
'grpcs').

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-06-02 15:55:20 +03:00
Leonard Lyubich 65080c8b69 [#295] pkg: Remove usage of deprecated elements
Remove usage of deprecated of `container.ID` and `token.SessionToken` code
elements. Replace using of custom message generators with the ones provided
by packages. Replace string comparison with `Equal` method call.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-06-01 08:04:12 +03:00
Leonard Lyubich 89be8d3f5a [#196] pkg/client: Extend Client interface with Conn method
Add `Conn` method to `Client` interface which must return the underlying
connection. Implement new method on the core structure. `Conn` can be used
to control the connection (e.g. for closing).

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-05-31 10:13:00 +03:00
Leonard Lyubich 6cd3497388 [#283] pkg/session: Implement work with token contexts
Implement `Context` / `SetContext` methods on `Token` which reads / sets
token context. Support container context (`ContainerContext`).

Add helper function `GetContainerContext` for easy reading of the container
context.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-05-28 16:32:02 +03:00
Leonard Lyubich 2648abb49e [#283] pkg/session: Add container context generator
Implement `sessiontest.ContainerContext` function for testing.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-05-28 16:32:02 +03:00
Leonard Lyubich 1d8207ae19 [#283] pkg/session: Implement container session context
Define `ContainerContext` type for container sessions. Implement basic
functionality to work with its data.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-05-28 16:32:02 +03:00
Leonard Lyubich fb0b1ea108 [#283] pkg/session: Cover Token's Sign/Verify methods with unit test
Add `sessiontest.GenerateSigned` function which returns signed random token.
Clarify that `sessiontest.Generate` returns an unsigned token. Use these
functions to assert the correctness of `Sign` / `VerifySignature` methods.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-05-28 16:32:02 +03:00
Leonard Lyubich 05e74d56db [#283] pkg/session: Implement Sign/Verify methods on Token
Implement `Token.Sign` method which calculates signature of the data of the
`Token` and writes the signature into it. Implement `Token.VerifySignature`
which checks if `Token` signature is presented and valid. These methods
allow to abstract the external context from the details of what kind of data
is being signed and how the signature is stored.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-05-28 16:32:02 +03:00
Leonard Lyubich 5fe5af5bf9 [#283] pkg/owner: Implement Equal method of ID type
Implement `owner.ID.Equal` method which defines a comparison relationship
between two identifiers.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-05-28 16:32:02 +03:00
Leonard Lyubich 4f286f5175 [#283] pkg/owner: Implement generators of ID's for testing
Create `ownertest` package with functions which generate random `owner.ID`
instances. These functions is going to be used for testing.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-05-28 16:32:02 +03:00
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 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
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
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 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 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
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 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 b792e4e464 [#265] pkg/client: Implement SendLocalTrust method
Define `Reputation` section interface. Embed `Reputation` interface to
`Client` one.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-03-25 11:20:34 +03:00
Leonard Lyubich 009f704377 [#265] pkg/reputation: Implement PeerID and Trust types
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-03-25 11:20:34 +03:00
Leonard Lyubich 2fcb6d9613 [#267] pkg: Fix IsSupportedVersion implementation
Current API library supports versions up to 2.4.x.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-03-17 14:30:02 +03:00
Leonard Lyubich 7cb9b8f283 [#267] pkg/client: Extend Client interface with Raw method
Add `Client.Raw` method which returns underlying raw protobuf client.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-03-17 14:30:02 +03:00
Leonard Lyubich a43175e2ea [#263] pkg/client: Split interface method's declarations with linebreaks
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-03-17 14:03:49 +03:00
Leonard Lyubich c819909906 [#263] pkg/client: Refactor the client to use raw protobuf client
Make `Client` to be the wrapper over raw protobuf client. Provide public
method to get the underlying raw client. Change implementations of all
methods with the new approach of the RPC execution.

Additional changes:
 * key replaced from `New` argument to `WithDefaultPrivateKey` option;
 * `GetSelfBalance` is removed as non-viable;
 * `GetEACLWithSignature` is removed, `GetEACL` returns `EACLWithSignature`;
 * `AttachSessionToken` / `AttachBearerToken` are removed as non-viable;
 * redundant options are removed.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-03-17 14:03:49 +03:00
Leonard Lyubich 5a9dd7ab3f [#263] pkg/netmap: Do not allocate nil repeated fields during conversion
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-03-17 14:03:49 +03:00
Evgenii Stratonikov ae2fb263f1 [#266] pkg/client: Export `Client` interface instead of structure
Make it easier to test API clients and mock specific methods.
Also add comments on exported methods.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-03-17 13:43:22 +03:00
Alex Vanin e39a1fd949 pkg/object: Add content type constant
Specification defined one more well-known object
attribute `Content-Type`.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2021-03-15 13:27:28 +03:00
Evgenii Stratonikov 64505180b4 [#261] pkg/client: Provide signing key in call options
Allow to reuse underlying connection for requests
with different key. If no key is specified the one
provided on client creation is used.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-03-12 10:40:10 +03:00
Evgenii Stratonikov 74769323be [#261] pkg/client: Use self address as default in `ListContainers`/`GetBalance`
This will allow us to overwrite key for every request.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-03-12 10:40:10 +03:00
Leonard Lyubich 8529aa2a93 [#259] pkg/client: Add NetworkInfo method
Implement NetworkInfo method that performs NeoFS API NetmapService
NetworkInfo RPC.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-02-19 16:25:53 +03:00
Leonard Lyubich f6268339d0 [#259] pkg/netmap: Implement v2-compatible NetworkInfo type
Define NetworkInfo structure. Implement constructors, fields getters and
setters, binary and JSON encoding methods.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-02-19 16:25:53 +03:00
Leonard Lyubich 521df90def [#255] pkg/netmap: Define constant keys to all well-known attributes
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-02-11 15:04:13 +03:00
Leonard Lyubich 8254da2890 [#255] pkg/netmap: Move common substring of well-known attributes to prefix
Rename `PriceAttr` constant to `AttrPrice`. Rename `CapacityAttr` constant
to `AttrCapacity`. Add documentation to both of them.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-02-11 15:04:13 +03:00
Leonard Lyubich e782531f25 [#255] pkg/object: Implement json.Marshaler/Unmarshaler on SearchFilters
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-02-11 15:04:13 +03:00
Leonard Lyubich ebff07aaf2 [#254] object: Support new values of search match type
Support STRING_NOT_EQUAL and NOT_PRESENT match types
of object search filters.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-02-11 15:04:13 +03:00
Leonard Lyubich e9ae408c3a [#254] pkg/object: Rewrite unit test of MatchType enum
Avoid direct usage of naming constants where it is not necessary.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-02-11 15:04:13 +03:00
Leonard Lyubich 93e1580684 [#253] container: Implement marshalers on UsedSpaceAnnouncement structure
Implement Unmarshal method on UsedSpaceAnnouncement v2 message. Implement
Marshal/Unmarshal methods on cross-version UsedSpaceAnnouncement type.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-02-11 15:04:13 +03:00
Alex Vanin 9e01f29dda [#250] pkg/container: Add epoch field to size announce body
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2021-02-11 15:04:13 +03:00
Alex Vanin 5566081d2d [#245] pkg/client: Add AnnounceContainerUsedSpace method
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2021-02-11 15:04:13 +03:00
Evgenii Stratonikov 5d9ef5feec [#248] netmap: fulfill backup factor for default attribute
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-02-03 15:31:18 +03:00
Alex Vanin c35e15a758 [#249] pkg/netmap: Add CBF field in placement context
If CBF value is not set, then netmap package uses default CBF
value. However it modifies placement policy structure in
`GetContainerNodes()` because policy passed as a pointer.

Instead package can store CBF value in internal context and use
it without policy modification.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2021-01-27 15:47:06 +03:00
Alex Vanin 9401724b9c [#246] pkg/client: Use io.Reader wrapper at object put
Object payload transferred in chunks. Size of the
chunks may be limited by transport protocols. To
split it we use `io.CopyBuffer` with pre-allocated
buffer size of one chunk. However this function may
ignore buffer if reader or writer implements
`WriteTo` or `ReadFrom` methods. Unfortunately
`bytes.Reader` implements `WriteTo` function.

To fix this we wrap reader so wrapper implements
only `io.Reader` interface.

Related to github.com/nspcc-dev/neofs-node/issues/338

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2021-01-25 13:25:52 +03:00
Alex Vanin 8a82400451 [#243] Fix golint linter errors
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2021-01-12 18:22:07 +03:00
Alex Vanin c2db2a54a1 [#243] Fix exhaustive linter errors
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2021-01-12 18:22:07 +03:00
Alex Vanin aafeb70bdb [#235] v2/audit: Regenerate protobuf
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-12-25 16:20:34 +03:00
Alex Vanin 1c25c3904b [#234] Update audit result struct definition
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-12-25 16:20:34 +03:00
Leonard Lyubich 9986a4ecd1 [#233] Implement data audit result type with basic methods
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-12-25 16:20:34 +03:00
Leonard Lyubich f0ebe80a78 [#231] object/search: Implement method to add search filter by type
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-12-25 16:20:26 +03:00
Leonard Lyubich 53e2756762 [#231] object: Implement string encode/decode methods on Type
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-12-25 16:20:26 +03:00
Leonard Lyubich 0f04087543 [#230] pkg: Implement string encode/decode methods on Checksum
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-12-25 16:20:26 +03:00
Leonard Lyubich 6861de042b [#230] pkg: Implement storage group type with basic methods
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-12-25 16:20:26 +03:00
Leonard Lyubich 37e2cab93b [#229] pkg/client: Set hash fields to result of short HEAD operation
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-12-25 16:20:26 +03:00
Leonard Lyubich c4f7be19ea [#194] pkg/client: Verify container format in GetContainer method
Make Client.GetContainer method to return an error if received container
structure does not meet NeoFS API specification.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-12-24 12:54:53 +03:00
Leonard Lyubich 7988405753 [#194] pkg/container: Implement container constructor with format check
Implement NewVerifiedFromV2 function that verifies format of NeoFS API V2
Container message.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-12-24 12:54:53 +03:00
Leonard Lyubich 70c29ca3e5 [#194] pkg/container: Implement container nonce getter/setter as UUID
Implement NonceUUID/SetNonceUUID methods on container structure. Change
implementation of Nonce/SetNonce methods and mark them deprecated.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-12-24 12:54:53 +03:00
Leonard Lyubich 3550e128bb [#236] Fix SDK minor version number
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-12-24 10:35:33 +03:00
Leonard Lyubich 5395988efc [#208] pkg/client: Add function to get container and verify ID
GetContainer method reads container structure by identifier from the
network. In some cases it is required to additionally check the
correspondence of the container structure to the identifier as a hash from
the binary representation. To do this, a new function
GetVerifiedContainerStructure is defined to execute the check after
receiving the container.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-12-17 14:52:04 +03:00
Leonard Lyubich 84839b09c2 [#208] pkg/container: Define standard error for mismatch identifiers
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-12-17 14:52:04 +03:00
Leonard Lyubich 1bc91466aa sdk/client: Fix setter of objectAddressWriter structure value
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-12-11 11:19:45 +03:00
Leonard Lyubich 803c91b3eb [#226] sdk/client: Add tombstone address to the return of DeleteObject
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-12-10 18:26:23 +03:00
Leonard Lyubich c064760f5d [#226] sdk/object: Implement Tombstone type with field access and encoding
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-12-10 18:26:23 +03:00
Alex Vanin 139660c6ff [#225] pkg/client: Update object methods
- Support errors with SplitInfo in head and range methods.
- Support raw flat in range method.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-12-08 10:23:27 +03:00
Alex Vanin 28aad71860 [#225] Do not use wrappers on oneof object.HeadResponse types
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-12-08 10:23:27 +03:00
Alex Vanin 6db6b569e0 [#223] pkg/client: Add getters for object params
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-12-03 18:07:42 +03:00
Alex Vanin 1fe0307711 [#223] pkg/object: Work with SplitInfoError via pointer
Closes #221

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-12-03 18:07:42 +03:00
Alex Vanin b683dbe7e6 [#218] pkg/object: Add marshal operations for SplitInfo
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-12-03 16:09:38 +03:00
Alex Vanin 664ebfd8a7 [#218] pkg/client: Add raw flag for object.Head
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-12-03 16:09:38 +03:00
Alex Vanin 582cdd4ba3 [#218] pkg/client: Add raw flag for object.Get
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-12-03 16:09:38 +03:00
Alex Vanin e11b1728be [#218] pkg/object: Define custom error for SplitInfo
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-12-03 16:09:38 +03:00
Alex Vanin 1fdeca84e1 [#218] Support SplitInfo structure
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-12-03 16:09:38 +03:00
Evgenii Stratonikov 707a0bcb35 [#220] netmap: process `REP X` policies correctly
For `REP X` select X nodes from the default filter
and fail if it cannot be done.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2020-12-03 15:39:49 +03:00
Evgenii Stratonikov 576841e0e0 [#215] netmap: add test with multiple replicas
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2020-12-01 13:33:11 +03:00
Evgenii Stratonikov 4e0a11b71a [#156] netmap: Use default value for CBF if unset
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2020-12-01 13:33:11 +03:00
Evgenii Stratonikov 4e65fa41b8 [#213] netmap: Do not append not twice if selector is unnamed
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2020-12-01 13:33:11 +03:00
Evgenii Stratonikov ea6b6adfe0 [#157] netmap: Fallback to using minimal backup factor
Use CBF=1 when strict policy can't be satisfied.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2020-12-01 13:33:11 +03:00
Leonard Lyubich c01024b553 [#217] pkg/eacl: Change interface for working with keys on Target and Record
In previous implementation Target provided Keys/SetKeys methods which
allowed working with ECDSA keys. There was also a bug in the NewTargetFromV2
function when the binary key differed in format from the ECDSA key. New
BinaryKeys/SetBinaryKeys methods work with binary keys. To work with ECDSA
keys added functions TargetECDSAKeys/SetTargetECDSAKeys. Old methods are
left and marked deprecated.

Type Record provided an interface for adding a Target by Role and a list of
ECDSA keys. New SetTargets method allows to set the list of Target's,
AddTarget function allows to add a single Target. AddFormedTarget works like
old AddTarget method, which is now deprecated.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-12-01 10:11:32 +03:00
Alex Vanin 2a94fdc5e7 [#209] Support nil value in SplitID
SplitID is not set on non-split and virtual
objects, so we should support this state in
library.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-11-26 13:26:34 +03:00
Alex Vanin 3d08d8140f [#209] object: Support `splitID` search attribute
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-11-26 11:56:30 +03:00
Alex Vanin 79c76e87e4 [#209] object: Remove `childfree` search attribute
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-11-26 11:56:30 +03:00
Alex Vanin 6b0bd42f25 [#209] pkg/object: Support splitID field in SDK library
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-11-26 11:56:30 +03:00
Leonard Lyubich 8c99d9d54c [#207] sdk/client: Implement GetEACLWithSignature method
GetEACL method of Client receives eACL table with signature, verifies the
signature and return the table. In some cases we need to receive table and
signature regardless of their correctness. New method GetEACLWithSignature
provides such an opportunity.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-24 15:16:42 +03:00
Leonard Lyubich 3ebfef9f94 [#207] sdk/client: Fix signature verification in GetEACL method
Extended ACL tables should be signed with RFC-6979 standard. Fix Client
.GetEACL implementation to verify eACL signature with SignRFC6979 option.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-24 15:16:42 +03:00
Leonard Lyubich 5ee500bb43 [#205] sdk/client: Support option to set dial timeout
There is a need to set dial timeout in SDK client that is used in case of
internal connection opening. Add DialTimeout option constructor to support
this feature.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-23 14:15:42 +03:00
Leonard Lyubich 20ede88fe7 [#204] sdk/object: Add SearchFilters method to filter by object ID
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-20 10:41:17 +03:00
Alex Vanin 9ceba98198 [#202] pkg/client: Fix signature check in object header getter
According to API object.Head response contains signature of
object ID rather than signature of object header itself.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-11-17 16:23:44 +03:00
Leonard Lyubich 0620a3b1eb [#199] sdk/client: Correct linter's remarks
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-16 18:51:14 +03:00
Leonard Lyubich 00ce980d82 [#199] sdk/token: Correct linter's remarks
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-16 18:51:14 +03:00
Leonard Lyubich c0de2bf9e5 [#199] sdk/owner: Correct linter's remarks
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-16 18:51:14 +03:00
Leonard Lyubich 1ff8b3fd94 [#199] sdk/object: Correct linter's remarks
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-16 18:51:14 +03:00
Leonard Lyubich 3a966ee5df [#199] sdk/netmap: Correct linter's remarks
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-16 18:51:14 +03:00
Leonard Lyubich 459d295788 [#199] sdk/container: Correct linter's remarks
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-16 18:51:14 +03:00
Leonard Lyubich 7611c218e3 [#199] sdk/client: Verify eACL table signature in GetEACL method
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-16 18:51:14 +03:00
Leonard Lyubich 3097059f85 [#199] sdk/client: Verify header signature in GetObjectHeader method
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-16 18:51:14 +03:00
Leonard Lyubich c6884f9823 [#199] sdk/eacl: Correct linter's remarks
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-16 18:51:14 +03:00
Leonard Lyubich 2b3502d6c0 [#199] sdk/acl: Add comments for basic ACL constants
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-16 18:51:14 +03:00
Leonard Lyubich 154e09f4e4 [#199] sdk/accounting: Rename test file package
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-16 18:51:14 +03:00
Leonard Lyubich 79f72e10c9 [#199] sdk: Refactor string parse errors
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-16 18:51:14 +03:00
Leonard Lyubich fe336fd5ba [#198] sdk/client: Use XHeader type
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-16 12:44:37 +03:00
Leonard Lyubich 5452554b58 [#198] sdk: Implement XHeader type
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-16 12:44:37 +03:00
Leonard Lyubich 5f5e5ac5dd [#197] sdk/object: Rename getters of Attribute and Object types
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-16 11:52:21 +03:00
Leonard Lyubich 67bcf6eb4d [#197] sdk/object: Rename getters of Address type
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-16 11:52:21 +03:00
Leonard Lyubich 9f0bc50e53 [#197] sdk: Rename getters of Checksum type
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-16 11:52:21 +03:00
Leonard Lyubich 2afc684313 [#197] sdk: Rename getters of Signature type
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-16 11:52:21 +03:00
Leonard Lyubich 2bcbd48972 [#197] sdk: Rename getters of Version type
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-16 11:52:21 +03:00
Alex Vanin f886d75560 [#168] pkg/object: Fix lint error on attribute receiver
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2020-11-13 18:07:26 +03:00
Leonard Lyubich 85d4713348 [#168] session: Implement binary/JSON encoders/decoders on SessionToken
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-13 18:07:26 +03:00
Leonard Lyubich 93df2fd765 [#168] refs: Implement binary/JSON encoders/decoders on Checksum
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-13 18:07:26 +03:00
Leonard Lyubich 4b55b06780 [#168] refs: Implement binary/JSON encoders/decoders on Signature
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-13 18:07:26 +03:00
Leonard Lyubich 1519a02d63 [#168] refs: Implement binary/JSON encoders/decoders on Version
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-13 18:07:26 +03:00
Leonard Lyubich 9ec57ee9f8 [#168] refs: Implement binary/JSON encoders/decoders on OwnerID
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-13 18:07:26 +03:00
Leonard Lyubich c0f3ac51d4 [#168] refs: Implement binary/JSON encoders/decoders on ContainerID
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-13 18:07:26 +03:00
Leonard Lyubich 7289ff6c64 [#168] refs: Implement binary/JSON encoders/decoders on ObjectID
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-13 18:07:26 +03:00
Leonard Lyubich 4ce751f13c [#168] refs: Implement binary/JSON encoders/decoders on Address
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-13 18:07:26 +03:00
Leonard Lyubich 9325e22871 [#168] object: Implement binary/JSON encoders/decoders on Object
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-13 18:07:26 +03:00
Leonard Lyubich 0caff85fb7 [#168] object: Implement binary/JSON encoders/decoders on Attribute
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-13 18:07:26 +03:00
Leonard Lyubich a684da6118 [#168] container: Implement binary/JSON encoders/decoders on Container
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-13 18:07:26 +03:00
Leonard Lyubich ec957be60c [#168] acl: Implement binary/JSON encoders/decoders on BearerToken
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-13 18:07:26 +03:00
Leonard Lyubich 233756ca8f [#168] acl: Implement binary/JSON encoders/decoders on Table
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-13 18:07:26 +03:00
Leonard Lyubich ae68790bbd [#168] acl: Implement binary/JSON encoders/decoders on Record
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-13 18:07:26 +03:00
Leonard Lyubich 9ddc4c1f48 [#168] acl: Implement binary/JSON encoders/decoders on Target
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-11-13 18:07:26 +03:00