Commit graph

1047 commits

Author SHA1 Message Date
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
Leonard Lyubich
1031f3122e [#263] v2: Support new rpc library
Implement `message.Message` interface on all structures and use new methods
for conversion instead of functions. make `Unmarshal` and JSON methods to
use encoding functions from `message` library. Remove all per-service
clients and implement `rpc` library of the functions which execute NeoFS API
RPC through new RPC client. Remove no longer used gRPC per-service clients.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-03-17 14:03:49 +03:00
Leonard Lyubich
30c6ca0714 [#263] Implement client for exchanging raw Protobuf messages
Implement generic `Client` that can communicate with the remote server via
protobuf `Message`'s. The client can uniformly execute any protobuf RPC
on the remote server using any of the supported transport protocols.
Currently only gRPC protocol is supported.

Additionally implement helpful functions to transmit messages by one of the
flow types: unary, client- or server-side stream.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-03-17 14:03:49 +03:00
Leonard Lyubich
c61656a43f [#263] Define generic protobuf message
Define `Message` interface of the generic protobuf message. In the initial
implementation, the message should be convertible to and from related gRPC
message.

Implement encoding functions over the `Message` that can:

 * unmarshal the `Message` via related gRPC message;
 * decode the `Message` from JSON format via related gRPC message;
 * encode the `Message` to JSON.

Implement nested `test` package for testing the implementation.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-03-17 14:03:49 +03:00
Leonard Lyubich
cf765a61a6 [#263] Implement client for exchanging raw messages using gRPC protocol
Implement gRPC client that can uniformly execute any RPC on the remote
server. In the primary implementation, the client is a thin wrapper over
gRPC client connection that is required to create the client. In the future,
it is planned to expand the library with convenient functionality.

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
Alex Vanin
471c7e0df9 v2: Regenerate protobuf files
Protobuf definition has updated import path for C#
library and new well-known object K-V header.

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
Alex Vanin
18e9122e43 Update changelog and readme for release v1.24.0
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2021-02-26 16:43:05 +03:00
Alex Vanin
a4d52c2d23 Recompile NeoFS API proto definitions
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2021-02-26 16:43:05 +03:00
Leonard Lyubich
e2b0887be9 [#259] v2/signature: Support NetworkInfo request/response messages
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-02-19 16:25:53 +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
88d6857a3c [#259] netmap: Add NetworkInfo call to Client
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-02-19 16:25:53 +03:00
Leonard Lyubich
8cb1f960f4 [#259] netmap/grpc: Add NetworkInfo call to Client
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-02-19 16:25:53 +03:00
Leonard Lyubich
9eda317efe [#259] netmap: Implement JSON encoding for NetworkInfo RPC messages
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-02-19 16:25:53 +03:00
Leonard Lyubich
276d863fd5 [#259] netmap: Implement binary encoding for NetworkInfo RPC messages
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-02-19 16:25:53 +03:00
Leonard Lyubich
c3be9dc270 [#259] netmap: Implement converters for NetworkInfo RPC messages
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-02-19 16:25:53 +03:00
Leonard Lyubich
ae35f17827 [#259] netmap/grpc: Implement field setters of NetworkInfo RPC messages
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-02-19 16:25:53 +03:00
Leonard Lyubich
d0d2f8d5db [#259] netmap: Define NetworkInfo RPC and all related messages
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-02-19 16:25:53 +03:00
Leonard Lyubich
786462c2a2 Recompile NeoFS API proto definitions
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-02-19 16:25:53 +03:00
Leonard Lyubich
e4613fcffb Update changelog and readme for release v1.23.0
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-02-11 17:30:15 +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
783c323d95 [#255] v2/netmap: Recompile proto files with update node attributes
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
f9939e8c90 [#255] v2/object: Implement json.Marshaler/Unmarshaler on SearchFilter
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
e27d76e804 [#250] v2/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
Alex Vanin
d2ee6b469a [#245] v2/container: Add AnnounceUsedSpace 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
42657aaf11 Update changelog for release v1.22.2
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2021-01-27 20:07:01 +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
98284f0bfa Fix badge in README file
We don't have `go` workflow in the repository.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2021-01-25 13:51:38 +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
Leonard Lyubich
c7dcea9e49 Update changelog for release v1.22.1
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-01-15 17:02:35 +03:00
Alex Vanin
43c579f670 [#243] Fix ineffassign linter errors
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2021-01-12 18:22:07 +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
60a55ea6c1 [#243] Fix whitespace linter errors
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2021-01-12 18:22:07 +03:00
Alex Vanin
2fa752864f [#243] Fix goimports linter errors
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2021-01-12 18:22:07 +03:00
Alex Vanin
0c9440c972 [#243] Update linter config
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2021-01-12 18:22:07 +03:00
Leonard Lyubich
f8018f9c3d [#241] v2/session: Define keys of the well-known X-headers
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-01-11 18:43:42 +03:00
Stanislav Bogatyrev
aa55079b69 Minor typo fixes
Signed-off-by: Stanislav Bogatyrev <stanislav@nspcc.ru>
2020-12-30 12:35:03 +03:00