Commit graph

353 commits

Author SHA1 Message Date
Leonard Lyubich
07fcaa4ba5 [#312] netmap: Support multiple addresses in NodeInfo
In latest NeoFS API changes `NodeInfo` message carries list of network
addresses. There is a need

Add `SetAddresses` / `IterateAddresses` / `NumberOfAddresses` methods to
provide the access to node's address group. Mark `Address` / `SetAddress`
methods as deprecated.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-06-23 17:52:43 +03:00
Leonard Lyubich
6d531a07a5
[#313] client/object: Always return number of bytes read from Get stream (#316)
Fix failure to comply with a requirement of stdlib `io.Reader` docs: `When
Read encounters an error or end-of-file condition after successfully reading
n > 0 bytes, it returns the number of bytes read.`

Prepare a platform for unit tests and test the affected case.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-06-23 14:15:58 +03:00
Leonard Lyubich
616b4b71a1 [#310] *: Implement string converters for enumerations
Implement `String` / `FromString` method pair in all levels of enum
definitions. From now `String()` returns canonical protojson-compatible
values.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-06-23 10:24:32 +03:00
Leonard Lyubich
fdea892db7 [#313] client/object: Add payload-handling parameter to GetObjectParams
Define `ReaderHandler` type. Add `GetObjectParams.WithPayloadReaderHandler`
method which accepts `ReaderHandler`. The handler is called right after
header receipt in `Client.GetObject`. After the handler is called,
`GetObject` returns object header immediately.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-06-22 17:54:39 +03:00
Angira Kekteeva
8ea9993577 [#309] pkg/session: Add marshal-unmarshal
Added Marshal, Unmarshal, MarshalJSON, UnmarshalJSON methods
to ContainerContext

Signed-off-by: Angira Kekteeva <kira@nspcc.ru>
2021-06-17 16:59:24 +03:00
Pavel Karpy
5f50484cd5 Bump SDK version in pkg
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-06-09 17:23:35 +03:00
Pavel Karpy
1542162657 [#302] pkg/xheader: Document default values set in NewXHeader
Document field values of instance constructed via
`NewXHeader`. Assert the values in corresponding
unit test.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-06-09 17:23:35 +03:00
Pavel Karpy
41307a5e00 [#302] pkg/xheader: Convert nil XHeader to nil message
Document that `XHeader.ToV2` method return `nil`
when called on `nil`. Document that `NewXHeaderFromV2`
function return `nil` when called on `nil`. Write
corresponding unit tests.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-06-09 17:23:35 +03:00
Pavel Karpy
dc99d4edce [#302] pkg/version: Document default values set in NewVersion
Document field values of instance constructed via
`NewVersion`. Assert the values in corresponding
unit test.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-06-09 17:23:35 +03:00
Pavel Karpy
768adfdd15 [#302] pkg/version: Convert nil Version to nil message
Document that `Version.ToV2` method return `nil`
when called on `nil`. Document that `NewVersionFromV2`
function return `nil` when called on `nil`. Write
corresponding unit tests.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-06-09 17:23:35 +03:00
Pavel Karpy
bb0cd8e4c0 [#302] pkg/signature: Document default values set in NewSignature
Document field values of instance constructed via
`NewSignature`. Assert the values in corresponding
unit test.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-06-09 17:23:35 +03:00
Pavel Karpy
b506970636 [#302] pkg/signature: Convert nil Signature to nil message
Document that `Signature.ToV2` method return `nil`
when called on `nil`. Document that `NewSignatureFromV2`
function return `nil` when called on `nil`. Write
corresponding unit tests.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-06-09 17:23:35 +03:00
Pavel Karpy
bf0d106e54 [#302] pkg/checksum: Document default values set in NewChecksum
Document field values of instance constructed via `NewChecksum`.
Assert the values in corresponding unit test.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-06-09 17:23:35 +03:00
Pavel Karpy
35b6629e1c [#302] pkg/checksum: Convert nil Checksum to nil message
Document that `Checksum.ToV2` method return `nil`
when called on `nil`. Document that `NewChecksumFromV2`
function return `nil` when called on `nil`. Write
corresponding unit tests.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-06-09 17:23:35 +03:00
Pavel Karpy
245271bb65 [#302] pkg/token: Document default values set in NewBearerToken
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-06-09 17:23:35 +03:00
Pavel Karpy
00a0ea42a8 [#302] pkg/token: Convert nil BearerToken to nil message
Document that `BearerToken.ToV2` method return `nil`
when called on `nil`. Write corresponding unit tests.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-06-09 17:23:35 +03:00
Pavel Karpy
3bc25f54d8 [#302] pkg/storagegroup: Document default values set in New
Document field values of instance constructed via `New`.
Assert the values in corresponding unit test.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-06-09 17:23:35 +03:00
Pavel Karpy
934cf8ecc8 [#302] pkg/storagegroup: Convert nil StorageGroup to nil message
Document that `StorageGroup.ToV2` method return `nil`
when called on `nil`. Document that `NewFromV2`
function return `nil` when called on `nil`. Write
corresponding unit tests.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-06-09 17:23:35 +03:00
Pavel Karpy
fb77bd3511 [#302] pkg/session: Document default values set in NewToken
Document field values of instance constructed via `NewToken`.
Assert the values in corresponding unit test.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-06-09 17:23:35 +03:00
Pavel Karpy
707776976a [#302] pkg/session: Convert nil Token to nil message
Document that `Token.ToV2` method return `nil`
when called on `nil`. Document that `NewTokenFromV2`
function return `nil` when called on `nil`. Write
corresponding unit tests.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-06-09 17:23:35 +03:00
Pavel Karpy
2d7a658059 [#302] pkg/owner: Document default values set in
`NewTrust`, `NewPeerToPeerTrust` and `NewGlobalTrust`

Document field values of instance constructed via
`NewTrust`, `NewPeerToPeerTrust` and `NewGlobalTrust`.
Assert the values in corresponding unit test.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-06-09 17:23:35 +03:00
Pavel Karpy
8ab3abab4b [#302] pkg/reputation: Convert nil Trust,
`PeerToPeerTrust` and `GlobalTrust` to nil message

Document that `Trust.ToV2`, `PeerToPeerTrust.ToV2`
and `GlobalTrust.ToV2` methods return `nil`when
called on `nil`. Document that `TrustFromV2`,
`PeerToPeerTrustFromV2`and `GlobalTrustFromV2`
functions return `nil` when called on `nil`. Write
corresponding unit tests.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-06-09 17:23:35 +03:00
Pavel Karpy
cce7ecbc00 [#302] pkg/reputation: Document default values set in NewPeerID
Document field values of instance constructed via `NewPeerID`.
Assert the values in corresponding unit test.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-06-09 17:23:35 +03:00
Pavel Karpy
d4327ec018 [#302] pkg/reputation: Convert nil PeerID to nil message
Document that `PeerID.ToV2` method return `nil`
when called on `nil`. Document that `PeerIDFromV2`
function return `nil` when called on `nil`. Write
corresponding unit tests.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-06-09 17:23:35 +03:00
Pavel Karpy
c00cdd407d [#302] pkg/owner: Document default values set in NewID
Document field values of instance constructed via `NewID`.
Assert the values in corresponding unit test.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-06-09 17:23:35 +03:00
Pavel Karpy
12574469e5 [#302] pkg/owner: Convert nil ID to nil message
Document that `ID.ToV2` method return `nil`
when called on `nil`. Document that `NewIDFromV2`
function return `nil` when called on `nil`. Write
corresponding unit tests.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-06-09 17:23:35 +03:00
Pavel Karpy
d802a994f5 [#302] pkg/object: Document default values set in NewSplitID
Document field values of instance constructed via
`NewSplitID`.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-06-09 17:23:35 +03:00
Pavel Karpy
bbd651767e [#302] pkg/object: Convert nil SplitID to nil message
Document that `SplitID.ToV2` method return `nil`
when called on `nil`. Document that `NewSplitIDFromV2`
function return `nil` when called on `nil`. Write
corresponding unit tests.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-06-09 17:23:35 +03:00
Pavel Karpy
2fb67d99d3 [#302] pkg/object: Document default values set in NewTombstone
Document field values of instance constructed via `NewTombstone`.
Assert the values in corresponding unit test.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-06-09 17:23:35 +03:00
Pavel Karpy
753402c336 [#302] pkg/object: Convert nil Tombstone to nil message
Document that `NewTombstoneFromV2` function return
`nil` when called on `nil`. Write corresponding
unit tests.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-06-09 17:23:35 +03:00
Pavel Karpy
dde721ea9f [#302] pkg/object: Document default values set in NewSplitInfo
Document field values of instance constructed via `NewSplitInfo`.
Assert the values in corresponding unit test.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-06-09 17:23:35 +03:00
Pavel Karpy
5cbdef1e46 [#302] pkg/object: Convert nil SplitInfo to nil message
Document that `SplitInfo.ToV2` method return `nil`
when called on `nil`. Document that `NewSplitInfoFromV2`
function return `nil` when called on `nil`. Write
corresponding unit tests.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-06-09 17:23:35 +03:00
Pavel Karpy
d443904e43 [#302] pkg/object: Document default values set in NewRange
Document field values of instance constructed via `NewRange`.
Assert the values in corresponding unit test.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-06-09 17:23:35 +03:00
Pavel Karpy
4e40f195bc [#302] pkg/object: Convert nil Range to nil message
Document that `Range.ToV2` method return `nil`
when called on `nil`. Document that `NewRangeFromV2`
function return `nil` when called on `nil`. Write
corresponding unit tests.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-06-09 17:23:35 +03:00
Pavel Karpy
6c12b4dfb6 [#302] pkg/object: Document default values set in NewID
Document field values of instance constructed via `NewID`.
Assert the values in corresponding unit test.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-06-09 17:23:35 +03:00
Pavel Karpy
245a55f715 [#302] pkg/object: Convert nil ID to nil message
Document that `ID.ToV2` method return `nil`
when called on `nil`. Document that `NewIDFromV2`
function return `nil` when called on `nil`. Write
corresponding unit tests.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-06-09 17:23:35 +03:00
Pavel Karpy
ff851215b0 [#302] pkg/object: Document default values set in NewAttribute
Document field values of instance constructed via `NewAttribute`.
Assert the values in corresponding unit test.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-06-09 17:23:35 +03:00
Pavel Karpy
941b513eb3 [#302] pkg/object: Convert nil Attribute to nil message
Document that `Attribute.ToV2` method return `nil`
when called on `nil`. Document that `NewAttributeFromV2`
function return `nil` when called on `nil`. Write
corresponding unit tests.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-06-09 17:23:35 +03:00
Pavel Karpy
5fda8ef796 [#302] pkg/object: Document default values set in NewAddress
Document field values of instance constructed via `NewAddress`.
Assert the values in corresponding unit test.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-06-09 17:23:35 +03:00
Pavel Karpy
c978fa0e21 [#302] pkg/object: Convert nil Address to nil message
Document that `Address.ToV2` method return `nil`
when called on `nil`. Document that `NewAddressFromV2`
function return `nil` when called on `nil`. Write
corresponding unit tests.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-06-09 17:23:35 +03:00
Pavel Karpy
2307c8f8f7 [#302] pkg/netmap: Document default values set in NewSelector
Document field values of instance constructed via `NewSelector`.
Assert the values in corresponding unit test.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-06-09 17:23:35 +03:00
Pavel Karpy
c47d1fb26b [#302] pkg/netmap: Convert nil Selector to nil message
Document that `Selector.ToV2` method return `nil`
when called on `nil`. Document that `NewSelectorFromV2`
function return `nil` when called on `nil`. Write
corresponding unit tests.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-06-09 17:23:35 +03:00
Pavel Karpy
af1742b48a [#302] pkg/netmap: Document default values set in NewReplica
Document field values of instance constructed via `NewReplica`.
Assert the values in corresponding unit test.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-06-09 17:23:35 +03:00
Pavel Karpy
fb591f5fac [#302] pkg/netmap: Convert nil Replica to nil message
Document that `Replica.ToV2` method return `nil`
when called on `nil`. Document that `ReplicaFromV2`
function return `nil` when called on `nil`. Write
corresponding unit tests.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-06-09 17:23:35 +03:00
Pavel Karpy
6fb7c79219 [#302] pkg/netmap: Document default values set in NewPlacementPolicy
Document field values of instance constructed via `NewPlacementPolicy`.
Assert the values in corresponding unit test.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-06-09 17:23:35 +03:00
Pavel Karpy
2176cb9f2b [#302] pkg/netmap: Convert nil PlacementPolicy to nil message
Document that `PlacementPolicy.ToV2` method return `nil`
when called on `nil`. Document that `PlacementPolicyFromV2`
function return `nil` when called on `nil`. Write corresponding
unit tests.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-06-09 17:23:35 +03:00
Pavel Karpy
df4d610fad [#302] pkg/netmap: Document default values set in NewNodeInfo and NewNodeAttribute
Document field values of instance constructed via `NewNodeInfo` and `NewNodeAttribute`.
Assert the values in corresponding unit test.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-06-09 17:23:35 +03:00
Pavel Karpy
05f48d9394 [#302] pkg/netmap: Convert nil NodeInfo and NodeAttribute to nil message
Document that `NodeAttribute.ToV2` and `NodeInfo.ToV2`
method return `nil` when called on `nil`. Document that
`NodeAttributeFromV2` and `NodeInfoFromV2` functions
return `nil` when called on `nil`. Write corresponding
unit tests.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-06-09 17:23:35 +03:00
Pavel Karpy
19cf3c2d0b [#302] pkg/netmap: Document default values set in NewNetworkInfo
Document field values of instance constructed via `NewNetworkInfo`.
Assert the values in corresponding unit test.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-06-09 17:23:35 +03:00
Pavel Karpy
6142a352da [#302] pkg/netmap: Convert nil NetworkInfo to nil message
Document that `NetworkInfo.ToV2` method return `nil`
when called on `nil`. Document that `NewNetworkInfoFromV2`
function return `nil` when called on `nil`. Write
corresponding unit tests.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-06-09 17:23:35 +03:00