Commit graph

239 commits

Author SHA1 Message Date
Alex Vanin
9c5d3d9dfa [#168] client: Adopt replacement of pointer slices with struct slices
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2022-03-15 16:59:59 +03:00
Alex Vanin
e89a0d88d2 [#168] container: Remove pointer tricks from setAttribute
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2022-03-15 16:59:59 +03:00
Alex Vanin
98d4b5c926 [#168] container: Replace []*Attribute with []Attribute
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2022-03-15 16:59:59 +03:00
Alex Vanin
cef9872b39 [#168] policy: Adopt replacement of pointer slices with struct slices
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2022-03-15 16:59:59 +03:00
Alex Vanin
cdcbaa1677 [#168] netmap: Replace pointer slices with non-pointer slices
- []*Replica => []Replica
 - []*Selector => []Selector
 - []*Filter => []Filter
 - []*NetworkParameter => []NetworkParameter
 - []*Node => []Node

Also introduces `filter.id()`` function to store filters
in numCache map.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2022-03-15 16:59:59 +03:00
Alex Vanin
e70bf05fb9 [#168] eacl: Replace pointer slices with non-pointer slices
- []*Record => []Record
 - []*Filter => []Filter
 - []*Target => []Target

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2022-03-15 16:59:59 +03:00
Alex Vanin
ef96949cbf [#168] object: Replace pointer slices with non-pointer slices
- []*oid.ID => []oid.ID
 - []*object.SearchFilter => []object.SearchFilter
 - []*Attribute => []Attribute

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2022-03-15 16:59:59 +03:00
Alex Vanin
467358f15a [#168] reputation: Replace []*reputation.Trust with []reputation.Trust
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2022-03-15 16:59:59 +03:00
Alex Vanin
022f412584 [#168] storagegroup: Replace []*oid.ID with []oid.ID
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2022-03-15 16:59:59 +03:00
Alex Vanin
d4a8b1755c [#168] audit: Replace []*oid.ID with []oid.ID
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2022-03-15 16:59:59 +03:00
Alex Vanin
eea0c0ecdc [#168] Update neofs-api-go with non pointer slices
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2022-03-15 16:59:59 +03:00
Alex Vanin
68b0440c62 [#164] Do not return rpc.Balance error in Dial
Balance request should be replaced with more generic Dial()
call from neofs-api-go.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2022-03-14 13:04:49 +03:00
Leonard Lyubich
b81122740a [#164] pool: Make pool.Pool a struct
Connection pool package should not define `Pool` type as an interface
since it provides single particular implementation.

Make `pool.Pool` type a struct instead of interface. Also remove
`Object`, `Container` and `Accounting` interfaces.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-03-10 15:02:10 +03:00
Leonard Lyubich
22dad0573d [#164] client: Refactor and document package functionality
Get rid of `Option` pattern. Define `Init`, `Dial` and `Close` methods
for the corresponding stages of use.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-03-10 15:02:10 +03:00
Leonard Lyubich
df5c69eea5 [#139] object: Implement function to init object creation
All NeoFS object must have at least container and owner identifiers.

Add `InitCreation` function which write all required fields to the
object instance. Extend `Object` type docs with all the constructors.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-03-05 17:38:16 +03:00
Leonard Lyubich
1c161956c8 [#163] object: Implement functions linking Object and Lock instances
Add `WriteLock`/`ReadLock` function which writes/read `Lock` instace
to/from the `Object` instance.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-03-05 17:38:16 +03:00
Leonard Lyubich
fb8daf80fc Upgrade NeoFS API Go module to v2.12.0
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-03-05 17:38:16 +03:00
Denis Kirillov
61f9c3392b [#159] Add object context to session tokens
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
2022-03-03 15:08:47 +03:00
Leonard Lyubich
70c3644e2b [#139] object: Deprecate RawObject type and everything related
From now `Object` type should be used directly.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-03-03 15:08:36 +03:00
Leonard Lyubich
529c4d1c2a [#160] client: Support request X-Headers
Add `WithXHeaders` method to all `Client` operations.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-03-03 14:56:20 +03:00
Alex Vanin
6f1c21da31 [#158] client: Do not ignore errors in processCall()
Some callbacks, such as `close()` -> `result(v2)` may
generate new errors, so `processCall` should not ignore
them.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2022-03-03 14:27:29 +03:00
Alex Vanin
7ef141aab7 [#158] client: Fix length setter in object hash range
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2022-03-03 14:27:29 +03:00
Alex Vanin
bf23b548ab [#158] client: Support object context in session token setter
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2022-03-03 14:27:29 +03:00
Leonard Lyubich
d109594d75 [#157] util/signature: Revive removed features
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-03-03 09:39:21 +03:00
Leonard Lyubich
a292150d42 [#157] signature: Change scheme selection
`SignData`: use `ECDSAWithSHA512` by default. `SignWithRFC6979` option
switches the scheme to `RFC6979WithSHA256`.

`VerifyData`: if scheme is not fixed (like by `SignWithRFC6979` option)
then scheme from the message is processed.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-03-03 09:39:21 +03:00
Leonard Lyubich
2a0b7b6b40 [#140] client: Specify status errors of Client methods
Extend docs with supported status returns. Add several helper functions
which allow to check the particular status.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-03-02 18:27:08 +03:00
Leonard Lyubich
12aa7ae144 [#140] apistatus: Support session errors
Define `SessionTokenNotFound`/`SessionTokenExpired` types for
`TOKEN_NOT_FOUND`/`TOKEN_EXPIRED` codes.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-03-02 18:27:08 +03:00
Leonard Lyubich
c627648798 [#140] apistatus: Support CONTAINER_NOT_FOUND error
Define `ContainerNotFound` type for `CONTAINER_NOT_FOUND` code.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-03-02 18:27:08 +03:00
Leonard Lyubich
f1e46d35de [#140] apistatus: Support OBJECT_ALREADY_REMOVED error
Define `ObjectAlreadyRemoved` type for `OBJECT_ALREADY_REMOVED` code.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-03-02 18:27:08 +03:00
Leonard Lyubich
ff3826ae6b [#140] apistatus: Support OBJECT_NOT_FOUND error
Define `ObjectNotFound` type for `OBJECT_NOT_FOUND` code.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-03-02 18:27:08 +03:00
Leonard Lyubich
3e94b7c892 [#140] apistatus: Support ACCESS_DENIED error
Define `ObjectAccessDenied` type for `ACCESS_DENIED` code. Provide
method to write/read human-readable reason.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-03-02 18:27:08 +03:00
Leonard Lyubich
2b28f91a89 [#140] object: Support LOCK type
Add `TypeLock` value to `Type` enum. Implement `Lock` type compatible
with corresponding message. Implement `ObjectLocked` and
`IrregularObjectLock` errors in `apistatus` package.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-03-02 18:27:08 +03:00
Evgenii Stratonikov
07817fb403 [#148] client: Allow to iterate over search results
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2022-02-28 10:19:35 +03:00
Evgenii Stratonikov
d716765c1a [#150] util/signature: Simplify public interface
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2022-02-25 12:42:38 +03:00
Evgenii Stratonikov
1c7dd03cf5 [#150] signature: Add scheme
Allow `SignOption` to set 2 parameters:
1. Default signature scheme, which is used in case scheme is
   unspecified.
2. Restrict scheme option which also checks that scheme is either
   unspecified or equal to the restricted scheme. This is only used
   for verification and is necessary because some of the signatures
   are used in smart-contracts.

Also provide signature struct to sign/verify functions in helpers.

The constant names differ a bit from those in API because of linter
complaints.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2022-02-25 12:42:38 +03:00
Leonard Lyubich
4fba1af6aa Upgrade to NeoFS API Go v2.12.0
Use new types instead of the deprecated ones.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-02-25 11:31:15 +03:00
Evgenii Stratonikov
fa670ab57a *: Fix linter warnings
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2022-02-24 18:49:55 +03:00
Leonard Lyubich
b5874778e9 [#149] client: Fix false io.ErrUnexpectedEOF return
In previous implementation `Close` method of `ObjectReader` /
`ObjectRangeReader` could incorrectly return `io.ErrUnexpectedEOF` of
payload wasn't read by `Read` method (in this case
`remainingPayloadLen` state var is not updated).

Return `io.ErrUnexpectedEOF` from `Read` method only.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-02-24 15:59:09 +03:00
Leonard Lyubich
2adbe29f7f [#149] client: Fill buffer completely when reading stream data
In previous implementation all `Read` methods read single response
per-call, so buffer could be incompletely filled w/o an error. In order
to follow `io.Reader` docs we need to continue filling the buffer while
it is possible.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-02-24 15:59:09 +03:00
Leonard Lyubich
8e99e8a818 [#149] client: Do not finish on empty ID list in ObjectListReader
In previous implementation `ObjectListReader.Read` returned `false` on
server responded with empty ID list. This could cause premature end of
reading since the protocol does not forbid intermediate empty lists.

Do not stop if ID list from response body is empty.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-02-24 15:59:09 +03:00
Evgenii Stratonikov
32af7251f2 [#134] owner: Add helpers for working script hash
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2022-02-24 15:53:42 +03:00
Evgenii Stratonikov
5ed064eba5 [#134] owner: Fix doc comments
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2022-02-24 15:53:42 +03:00
Pavel Karpy
47e8527ffb [#143] object: Add notification setters and getters
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2022-02-22 19:34:51 +03:00
Pavel Karpy
ddd6c08b6a [#143] object/search: Add notification filter
It allows searching object whose notification epoch fits passed
`SearchMatchType` and a value.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2022-02-22 19:34:51 +03:00
Pavel Karpy
e791793253 [#143] go.mod: Update api-go library
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2022-02-22 19:34:51 +03:00
Pavel Karpy
a25d145d84 [#143] object: Fix well-known attribute comment
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2022-02-22 19:34:51 +03:00
Leonard Lyubich
29c057272c [#147] pool: Limit buffer length by 3MB in PutObject
In previous implementation we wrote up to 4KB payload chunk per-call.
This led to sending a large number of messages with a large
amount of payload.

Increase buffer length limit to 3MB.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-02-22 09:09:22 +03:00
Leonard Lyubich
035f1d5667 [#147] client: Send 3MB per message in ObjectWriter.WritePayloadChunk
In previous implementation payload chunks were split into pieces with
512B length. This led to sending a large number of messages with a large
amount of payload.

Increase per-message payload chunk limit to 3MB.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-02-22 09:09:22 +03:00
Denis Kirillov
5386694a1a [#142] Drop retry for container operations
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
2022-02-21 16:48:28 +03:00
Leonard Lyubich
66bc59da5c [#146] pool: Set private key in object HEAD/DELETE
Use call private key parameterized in `HeadObject` / `DeleteObject`
methods of `Pool` as corresponding key for `ObjectHead` / `ObjectDelete`
methods of `Client`.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2022-02-21 15:21:37 +03:00