Commit graph

218 commits

Author SHA1 Message Date
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