Commit graph

246 commits

Author SHA1 Message Date
Denis Kirillov
e2c740ae8d [#38] Refactoring
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
2021-11-15 14:04:06 +03:00
Denis Kirillov
818f38b811 [#38] Replace gcache with golang-lru
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
2021-11-15 14:04:06 +03:00
Denis Kirillov
1d546711e5 [#38] Add retrying when session token error
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
2021-11-15 14:04:06 +03:00
Denis Kirillov
e08e3d6c00 [#38] Add session cache tests
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
2021-11-15 14:04:06 +03:00
Denis Kirillov
c651a714fd [#38] Add session token cache
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
2021-11-15 14:04:06 +03:00
Evgenii Stratonikov
10b78e74af [#62] pool: replace neofs-api-go imports with neofs-sdk-go
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-11-10 18:29:19 +03:00
Evgenii Stratonikov
4855154b35 [#62] client: move package from neofs-api-go
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-11-10 18:29:19 +03:00
Evgenii Stratonikov
6c55c0fd4b [#61] token: move package from neofs-api-go
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-11-10 10:37:42 +03:00
Evgenii Stratonikov
49a24e4b3e [#53] session: refactor missed Marshal declarations
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-11-10 10:31:57 +03:00
Evgenii Stratonikov
7627f8376a [#60] container: rename NewOption and make code more consistent
In all other places we use `Option` as `func`, there is no need in
additional indirection.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-11-10 10:31:57 +03:00
Evgenii Stratonikov
73686827d3 [#60] container: move package from neofs-api-go
Also, remove deprecated methods and types.

Close #60.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-11-10 10:31:57 +03:00
Evgenii Stratonikov
8d313dbd5d [#58] eacl: move package from neofs-api-go
Also, remove deprecated methods.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-11-09 18:12:53 +03:00
Evgenii Stratonikov
f05ff3901f [#57] storagegroup: move package from neofs-api-go
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-11-09 12:31:54 +03:00
Evgenii Stratonikov
74a5254819 [#59] audit/test: reuse version generator
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-11-09 12:30:58 +03:00
Evgenii Stratonikov
db784a5758 [#59] audit: move package from neofs-api-go
Close #59.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-11-09 12:30:58 +03:00
Evgenii Stratonikov
26c59bfbb3 [#42] netmap: remove deprecated methods
Missed this from #51.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-11-09 10:01:43 +03:00
Evgenii Stratonikov
76d9835766 [#69] netmap: fix typo in comment
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-11-09 10:00:21 +03:00
Evgenii Stratonikov
d6b72453fc [#64] object/test: reuse checksum and signature generators
These were missing from #53.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-11-09 09:57:37 +03:00
Evgenii Stratonikov
39d3317ef6 [#64] object: move package from neofs-api-go
Also, remove deprecated method.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-11-09 09:57:37 +03:00
Evgenii Stratonikov
bdb99877f6 [#55] reputation: move package from neofs-api-go
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-11-09 09:54:09 +03:00
Evgenii Stratonikov
ff54fb7647 [#53] session: move XHeader from neofs-api-go
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-11-08 12:39:45 +03:00
Evgenii Stratonikov
ee47683848 [#53] session: move package from neofs-api-go
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-11-08 12:39:45 +03:00
Evgenii Stratonikov
1feafcbcbf [#53] util: move signature package from neofs-api-go
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-11-08 12:39:45 +03:00
Evgenii Stratonikov
bd554c94d8 [#44] checksum: move package from neofs-api-go
Also remove `Checksum` from functions and constants names.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-11-01 17:52:41 +03:00
Evgenii Stratonikov
ecc3d0fcf1 [#44] version: move package from neofs-api-go
Also remove `Version` from constructors and rename `SDKVersion` to
`Current`.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-11-01 17:52:41 +03:00
Evgenii Stratonikov
1ac6b819c5 [#44] signature: move package from neofs-api-go
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-11-01 17:52:41 +03:00
Evgenii Stratonikov
372468c320 [#41] container: move id from neofs-api-go
Change `Marshal` signature to `Marshal() ([]byte, error)`.
Dependency update in SDK itself should be done after moving client
as `pool` package has some dependent function signatures.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-11-01 17:52:27 +03:00
Evgenii Stratonikov
ee42623a3e [#43] owner: move package from neofs-api-go
Also remove neofs-crypto dependency.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-11-01 17:51:55 +03:00
Evgenii Stratonikov
46353456f1 [#48] pool/test: add missing EXPECT calls
Another possible panic (though quite rare).
```
--- FAIL: TestTwoNodes (0.00s)
    pool.go:185: Unexpected call to *pool.MockClient.EndpointInfo([context.Background.WithCancel.WithDeadline(2021-10-26 15:50:50.005585875 +0300 MSK m=+1.216577808 [-940.323µs])]) at /home/dzeta/repo/neofs-sdk-go/pool/pool.go:185 because: there are no expected calls of the method "EndpointInfo" for that receiver
    pool.go:185: Unexpected call to *pool.MockClient.EndpointInfo([context.Background.WithCancel.WithDeadline(2021-10-26 15:50:50.005715623 +0300 MSK m=+1.216707547 [-1.351991ms])]) at /home/dzeta/repo/neofs-sdk-go/pool/pool.go:185 because: there are no expected calls of the method "EndpointInfo" for that receiver
```

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-11-01 17:51:21 +03:00
Evgenii Stratonikov
f3f8ce01d3 [#48] pool/test: add go:generate line for mocks generation
We also don't use mocks for `Pool`.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-11-01 17:51:21 +03:00
Evgenii Stratonikov
cd5e08d725 [#48] pool: add Close method
Fix occasional panic in tests:
```
> for i in (seq 1 100); go test -race -count=1 ./pool/... ; end
...
{"level":"warn","ts":1635251466.567485,"caller":"pool/pool.go:122","msg":"failed to create neofs session token for client","address":"peer0","error":"error session"}
panic: Fail in goroutine after TestTwoNodes has completed

goroutine 6 [running]:
testing.(*common).Fail(0xc0002e1380)
        /usr/lib/go/src/testing/testing.go:710 +0x1b4
testing.(*common).FailNow(0xc0002e1380)
        /usr/lib/go/src/testing/testing.go:732 +0x2f
testing.(*common).Fatalf(0xc000074070, {0xd9d816, 0x2e}, {0xc000094050, 0x5, 0x5})
        /usr/lib/go/src/testing/testing.go:830 +0x85
github.com/golang/mock/gomock.(*Controller).Call.func1(0xc0002f4120, {0xd68380, 0xc0002dac30}, {0xd8847f, 0xc}, {0xc000074020, 0x1, 0x1})
        /home/dzeta/go/pkg/mod/github.com/golang/mock@v1.6.0/gomock/controller.go:231 +0x44d
github.com/golang/mock/gomock.(*Controller).Call(0xc0002f4120, {0xd68380, 0xc0002dac30}, {0xd8847f, 0xc}, {0xc000074020, 0x1, 0x1})
        /home/dzeta/go/pkg/mod/github.com/golang/mock@v1.6.0/gomock/controller.go:247 +0xce
github.com/nspcc-dev/neofs-sdk-go/pool.(*MockClient).EndpointInfo(0xc0002dac30, {0xe85528, 0xc00008a120}, {0x0, 0x0, 0x0})
        /home/dzeta/repo/neofs-sdk-go/pool/mock_test.go:186 +0x298
github.com/nspcc-dev/neofs-sdk-go/pool.updateNodesHealth.func1(0x1, {0xe950d8, 0xc0002dac30})
        /home/dzeta/repo/neofs-sdk-go/pool/pool.go:183 +0x188
created by github.com/nspcc-dev/neofs-sdk-go/pool.updateNodesHealth
        /home/dzeta/repo/neofs-sdk-go/pool/pool.go:174 +0x233
```

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-11-01 17:51:21 +03:00
Evgenii Stratonikov
d541aab1ff [#48] pool/test: remove defer for controller close
We have go1.16 in go.mod and `gomock.NewController` comment indicates:
```
New in go1.14+, if you are passing a *testing.T into this function you no
longer need to call ctrl.Finish() in your test methods.
```

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-11-01 17:51:21 +03:00
Alex Vanin
a64aa36c1a [#39] accounting: Move decimal structure to SDK
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2021-10-28 14:52:59 +03:00
Evgenii Stratonikov
22ea9687af [#42] policy: use SDK netmap version
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-10-28 14:50:33 +03:00
Evgenii Stratonikov
369bd382b3 [#42] netmap: move package from neofs-api-go
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-10-28 14:50:33 +03:00
Evgenii Stratonikov
1bd89bf797 [#42] go.mod: update neofs-api-go
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-10-28 14:50:33 +03:00
Evgenii Stratonikov
9435f4171b [#40] acl: move ACL types from neofs-api-go
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-10-27 19:42:38 +03:00
Angira Kekteeva
5d2a913355 [#37] ci: Add github workflows
Signed-off-by: Angira Kekteeva <kira@nspcc.ru>
2021-10-15 17:37:18 +03:00
Angira Kekteeva
2a90ddbda4 [#37] ci: Replace golint by revive
Signed-off-by: Angira Kekteeva <kira@nspcc.ru>
2021-10-15 17:37:18 +03:00
Evgenii Stratonikov
6e3836cb1d [#35] policy: remove netmap/v2 dependency
Also, fix tests.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-09-14 10:21:56 +03:00
Denis Kirillov
880f3a61e5 [#32] Require at least one healthy node
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
2021-09-09 14:46:46 +03:00
Alex Vanin
234373f249 [#31] pool: Do not invoke EndpointInfo to find the address
Since we transformed the pool of gRPC connection into the pool of
neofs clients, we don't need to call EndpointInfo to fetch the
address of the node for the beautiful error output.

Moreover it is done incorrectly, because c.CreateSession may return
context.Cancelled error (graceful shutdown). We will reuse the same
context for the EndpointInfo call which will lead to a
timeout freeze.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2021-09-07 13:54:34 +03:00
Alex Vanin
c55ae2c13f
Merge pull request #30 from masterSplinter01/misc/26-move-pkg-subfolders
Move /pkg subfolders to the root
2021-07-28 15:21:17 +03:00
Angira Kekteeva
c0101c6561 [#26] policy: Update imports
Signed-off-by: Angira Kekteeva <kira@nspcc.ru>
2021-07-28 13:47:27 +03:00
Angira Kekteeva
628ae20c72 [#26] *: Move pkg content to root
Signed-off-by: Angira Kekteeva <kira@nspcc.ru>
2021-07-28 13:47:27 +03:00
Denis Kirillov
d95d722d61 [#28] Add recreating session token
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
2021-07-28 12:37:55 +03:00
Alex Vanin
cb0a844cae
Merge pull request #27 from KirillovDenis/feature/16-pool_tests
[#16] Add pool tests
2021-07-26 15:45:45 +03:00
Denis Kirillov
9d2c7d9a04 [#16] Update neo-go version
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
2021-07-26 15:23:27 +03:00
Denis Kirillov
3af734a723 [#16] Add mock
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
2021-07-23 12:07:30 +03:00
Denis Kirillov
7a0128e6ff [#16] Fix TestHealthyReweight
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
2021-07-20 11:06:45 +03:00