forked from TrueCloudLab/frostfs-sdk-go
[#85] pool: make client interface methods private
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
This commit is contained in:
parent
aa6a4950d5
commit
9e8e12f6ae
4 changed files with 221 additions and 222 deletions
|
@ -1,5 +1,5 @@
|
||||||
// Code generated by MockGen. DO NOT EDIT.
|
// Code generated by MockGen. DO NOT EDIT.
|
||||||
// Source: github.com/nspcc-dev/neofs-sdk-go/pool (interfaces: Client)
|
// Source: pool.go
|
||||||
|
|
||||||
// Package pool is a generated GoMock package.
|
// Package pool is a generated GoMock package.
|
||||||
package pool
|
package pool
|
||||||
|
@ -18,7 +18,7 @@ import (
|
||||||
id0 "github.com/nspcc-dev/neofs-sdk-go/object/id"
|
id0 "github.com/nspcc-dev/neofs-sdk-go/object/id"
|
||||||
)
|
)
|
||||||
|
|
||||||
// MockClient is a mock of Client interface.
|
// MockClient is a mock of client interface.
|
||||||
type MockClient struct {
|
type MockClient struct {
|
||||||
ctrl *gomock.Controller
|
ctrl *gomock.Controller
|
||||||
recorder *MockClientMockRecorder
|
recorder *MockClientMockRecorder
|
||||||
|
@ -41,239 +41,239 @@ func (m *MockClient) EXPECT() *MockClientMockRecorder {
|
||||||
return m.recorder
|
return m.recorder
|
||||||
}
|
}
|
||||||
|
|
||||||
// BalanceGet mocks base method.
|
// balanceGet mocks base method.
|
||||||
func (m *MockClient) BalanceGet(arg0 context.Context, arg1 PrmBalanceGet) (*accounting.Decimal, error) {
|
func (m *MockClient) balanceGet(arg0 context.Context, arg1 PrmBalanceGet) (*accounting.Decimal, error) {
|
||||||
m.ctrl.T.Helper()
|
m.ctrl.T.Helper()
|
||||||
ret := m.ctrl.Call(m, "BalanceGet", arg0, arg1)
|
ret := m.ctrl.Call(m, "balanceGet", arg0, arg1)
|
||||||
ret0, _ := ret[0].(*accounting.Decimal)
|
ret0, _ := ret[0].(*accounting.Decimal)
|
||||||
ret1, _ := ret[1].(error)
|
ret1, _ := ret[1].(error)
|
||||||
return ret0, ret1
|
return ret0, ret1
|
||||||
}
|
}
|
||||||
|
|
||||||
// BalanceGet indicates an expected call of BalanceGet.
|
// balanceGet indicates an expected call of balanceGet.
|
||||||
func (mr *MockClientMockRecorder) BalanceGet(arg0, arg1 interface{}) *gomock.Call {
|
func (mr *MockClientMockRecorder) balanceGet(arg0, arg1 interface{}) *gomock.Call {
|
||||||
mr.mock.ctrl.T.Helper()
|
mr.mock.ctrl.T.Helper()
|
||||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BalanceGet", reflect.TypeOf((*MockClient)(nil).BalanceGet), arg0, arg1)
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "balanceGet", reflect.TypeOf((*MockClient)(nil).balanceGet), arg0, arg1)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ContainerDelete mocks base method.
|
// containerDelete mocks base method.
|
||||||
func (m *MockClient) ContainerDelete(arg0 context.Context, arg1 PrmContainerDelete) error {
|
func (m *MockClient) containerDelete(arg0 context.Context, arg1 PrmContainerDelete) error {
|
||||||
m.ctrl.T.Helper()
|
m.ctrl.T.Helper()
|
||||||
ret := m.ctrl.Call(m, "ContainerDelete", arg0, arg1)
|
ret := m.ctrl.Call(m, "containerDelete", arg0, arg1)
|
||||||
ret0, _ := ret[0].(error)
|
ret0, _ := ret[0].(error)
|
||||||
return ret0
|
return ret0
|
||||||
}
|
}
|
||||||
|
|
||||||
// ContainerDelete indicates an expected call of ContainerDelete.
|
// containerDelete indicates an expected call of containerDelete.
|
||||||
func (mr *MockClientMockRecorder) ContainerDelete(arg0, arg1 interface{}) *gomock.Call {
|
func (mr *MockClientMockRecorder) containerDelete(arg0, arg1 interface{}) *gomock.Call {
|
||||||
mr.mock.ctrl.T.Helper()
|
mr.mock.ctrl.T.Helper()
|
||||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContainerDelete", reflect.TypeOf((*MockClient)(nil).ContainerDelete), arg0, arg1)
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "containerDelete", reflect.TypeOf((*MockClient)(nil).containerDelete), arg0, arg1)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ContainerEACL mocks base method.
|
// containerEACL mocks base method.
|
||||||
func (m *MockClient) ContainerEACL(arg0 context.Context, arg1 PrmContainerEACL) (*eacl.Table, error) {
|
func (m *MockClient) containerEACL(arg0 context.Context, arg1 PrmContainerEACL) (*eacl.Table, error) {
|
||||||
m.ctrl.T.Helper()
|
m.ctrl.T.Helper()
|
||||||
ret := m.ctrl.Call(m, "ContainerEACL", arg0, arg1)
|
ret := m.ctrl.Call(m, "containerEACL", arg0, arg1)
|
||||||
ret0, _ := ret[0].(*eacl.Table)
|
ret0, _ := ret[0].(*eacl.Table)
|
||||||
ret1, _ := ret[1].(error)
|
ret1, _ := ret[1].(error)
|
||||||
return ret0, ret1
|
return ret0, ret1
|
||||||
}
|
}
|
||||||
|
|
||||||
// ContainerEACL indicates an expected call of ContainerEACL.
|
// containerEACL indicates an expected call of containerEACL.
|
||||||
func (mr *MockClientMockRecorder) ContainerEACL(arg0, arg1 interface{}) *gomock.Call {
|
func (mr *MockClientMockRecorder) containerEACL(arg0, arg1 interface{}) *gomock.Call {
|
||||||
mr.mock.ctrl.T.Helper()
|
mr.mock.ctrl.T.Helper()
|
||||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContainerEACL", reflect.TypeOf((*MockClient)(nil).ContainerEACL), arg0, arg1)
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "containerEACL", reflect.TypeOf((*MockClient)(nil).containerEACL), arg0, arg1)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ContainerGet mocks base method.
|
// containerGet mocks base method.
|
||||||
func (m *MockClient) ContainerGet(arg0 context.Context, arg1 PrmContainerGet) (*container.Container, error) {
|
func (m *MockClient) containerGet(arg0 context.Context, arg1 PrmContainerGet) (*container.Container, error) {
|
||||||
m.ctrl.T.Helper()
|
m.ctrl.T.Helper()
|
||||||
ret := m.ctrl.Call(m, "ContainerGet", arg0, arg1)
|
ret := m.ctrl.Call(m, "containerGet", arg0, arg1)
|
||||||
ret0, _ := ret[0].(*container.Container)
|
ret0, _ := ret[0].(*container.Container)
|
||||||
ret1, _ := ret[1].(error)
|
ret1, _ := ret[1].(error)
|
||||||
return ret0, ret1
|
return ret0, ret1
|
||||||
}
|
}
|
||||||
|
|
||||||
// ContainerGet indicates an expected call of ContainerGet.
|
// containerGet indicates an expected call of containerGet.
|
||||||
func (mr *MockClientMockRecorder) ContainerGet(arg0, arg1 interface{}) *gomock.Call {
|
func (mr *MockClientMockRecorder) containerGet(arg0, arg1 interface{}) *gomock.Call {
|
||||||
mr.mock.ctrl.T.Helper()
|
mr.mock.ctrl.T.Helper()
|
||||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContainerGet", reflect.TypeOf((*MockClient)(nil).ContainerGet), arg0, arg1)
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "containerGet", reflect.TypeOf((*MockClient)(nil).containerGet), arg0, arg1)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ContainerList mocks base method.
|
// containerList mocks base method.
|
||||||
func (m *MockClient) ContainerList(arg0 context.Context, arg1 PrmContainerList) ([]id.ID, error) {
|
func (m *MockClient) containerList(arg0 context.Context, arg1 PrmContainerList) ([]id.ID, error) {
|
||||||
m.ctrl.T.Helper()
|
m.ctrl.T.Helper()
|
||||||
ret := m.ctrl.Call(m, "ContainerList", arg0, arg1)
|
ret := m.ctrl.Call(m, "containerList", arg0, arg1)
|
||||||
ret0, _ := ret[0].([]id.ID)
|
ret0, _ := ret[0].([]id.ID)
|
||||||
ret1, _ := ret[1].(error)
|
ret1, _ := ret[1].(error)
|
||||||
return ret0, ret1
|
return ret0, ret1
|
||||||
}
|
}
|
||||||
|
|
||||||
// ContainerList indicates an expected call of ContainerList.
|
// containerList indicates an expected call of containerList.
|
||||||
func (mr *MockClientMockRecorder) ContainerList(arg0, arg1 interface{}) *gomock.Call {
|
func (mr *MockClientMockRecorder) containerList(arg0, arg1 interface{}) *gomock.Call {
|
||||||
mr.mock.ctrl.T.Helper()
|
mr.mock.ctrl.T.Helper()
|
||||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContainerList", reflect.TypeOf((*MockClient)(nil).ContainerList), arg0, arg1)
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "containerList", reflect.TypeOf((*MockClient)(nil).containerList), arg0, arg1)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ContainerPut mocks base method.
|
// containerPut mocks base method.
|
||||||
func (m *MockClient) ContainerPut(arg0 context.Context, arg1 PrmContainerPut) (*id.ID, error) {
|
func (m *MockClient) containerPut(arg0 context.Context, arg1 PrmContainerPut) (*id.ID, error) {
|
||||||
m.ctrl.T.Helper()
|
m.ctrl.T.Helper()
|
||||||
ret := m.ctrl.Call(m, "ContainerPut", arg0, arg1)
|
ret := m.ctrl.Call(m, "containerPut", arg0, arg1)
|
||||||
ret0, _ := ret[0].(*id.ID)
|
ret0, _ := ret[0].(*id.ID)
|
||||||
ret1, _ := ret[1].(error)
|
ret1, _ := ret[1].(error)
|
||||||
return ret0, ret1
|
return ret0, ret1
|
||||||
}
|
}
|
||||||
|
|
||||||
// ContainerPut indicates an expected call of ContainerPut.
|
// containerPut indicates an expected call of containerPut.
|
||||||
func (mr *MockClientMockRecorder) ContainerPut(arg0, arg1 interface{}) *gomock.Call {
|
func (mr *MockClientMockRecorder) containerPut(arg0, arg1 interface{}) *gomock.Call {
|
||||||
mr.mock.ctrl.T.Helper()
|
mr.mock.ctrl.T.Helper()
|
||||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContainerPut", reflect.TypeOf((*MockClient)(nil).ContainerPut), arg0, arg1)
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "containerPut", reflect.TypeOf((*MockClient)(nil).containerPut), arg0, arg1)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ContainerSetEACL mocks base method.
|
// containerSetEACL mocks base method.
|
||||||
func (m *MockClient) ContainerSetEACL(arg0 context.Context, arg1 PrmContainerSetEACL) error {
|
func (m *MockClient) containerSetEACL(arg0 context.Context, arg1 PrmContainerSetEACL) error {
|
||||||
m.ctrl.T.Helper()
|
m.ctrl.T.Helper()
|
||||||
ret := m.ctrl.Call(m, "ContainerSetEACL", arg0, arg1)
|
ret := m.ctrl.Call(m, "containerSetEACL", arg0, arg1)
|
||||||
ret0, _ := ret[0].(error)
|
ret0, _ := ret[0].(error)
|
||||||
return ret0
|
return ret0
|
||||||
}
|
}
|
||||||
|
|
||||||
// ContainerSetEACL indicates an expected call of ContainerSetEACL.
|
// containerSetEACL indicates an expected call of containerSetEACL.
|
||||||
func (mr *MockClientMockRecorder) ContainerSetEACL(arg0, arg1 interface{}) *gomock.Call {
|
func (mr *MockClientMockRecorder) containerSetEACL(arg0, arg1 interface{}) *gomock.Call {
|
||||||
mr.mock.ctrl.T.Helper()
|
mr.mock.ctrl.T.Helper()
|
||||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContainerSetEACL", reflect.TypeOf((*MockClient)(nil).ContainerSetEACL), arg0, arg1)
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "containerSetEACL", reflect.TypeOf((*MockClient)(nil).containerSetEACL), arg0, arg1)
|
||||||
}
|
}
|
||||||
|
|
||||||
// EndpointInfo mocks base method.
|
// endpointInfo mocks base method.
|
||||||
func (m *MockClient) EndpointInfo(arg0 context.Context, arg1 PrmEndpointInfo) (*netmap.NodeInfo, error) {
|
func (m *MockClient) endpointInfo(arg0 context.Context, arg1 prmEndpointInfo) (*netmap.NodeInfo, error) {
|
||||||
m.ctrl.T.Helper()
|
m.ctrl.T.Helper()
|
||||||
ret := m.ctrl.Call(m, "EndpointInfo", arg0, arg1)
|
ret := m.ctrl.Call(m, "endpointInfo", arg0, arg1)
|
||||||
ret0, _ := ret[0].(*netmap.NodeInfo)
|
ret0, _ := ret[0].(*netmap.NodeInfo)
|
||||||
ret1, _ := ret[1].(error)
|
ret1, _ := ret[1].(error)
|
||||||
return ret0, ret1
|
return ret0, ret1
|
||||||
}
|
}
|
||||||
|
|
||||||
// EndpointInfo indicates an expected call of EndpointInfo.
|
// endpointInfo indicates an expected call of endpointInfo.
|
||||||
func (mr *MockClientMockRecorder) EndpointInfo(arg0, arg1 interface{}) *gomock.Call {
|
func (mr *MockClientMockRecorder) endpointInfo(arg0, arg1 interface{}) *gomock.Call {
|
||||||
mr.mock.ctrl.T.Helper()
|
mr.mock.ctrl.T.Helper()
|
||||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EndpointInfo", reflect.TypeOf((*MockClient)(nil).EndpointInfo), arg0, arg1)
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "endpointInfo", reflect.TypeOf((*MockClient)(nil).endpointInfo), arg0, arg1)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NetworkInfo mocks base method.
|
// networkInfo mocks base method.
|
||||||
func (m *MockClient) NetworkInfo(arg0 context.Context, arg1 PrmNetworkInfo) (*netmap.NetworkInfo, error) {
|
func (m *MockClient) networkInfo(arg0 context.Context, arg1 prmNetworkInfo) (*netmap.NetworkInfo, error) {
|
||||||
m.ctrl.T.Helper()
|
m.ctrl.T.Helper()
|
||||||
ret := m.ctrl.Call(m, "NetworkInfo", arg0, arg1)
|
ret := m.ctrl.Call(m, "networkInfo", arg0, arg1)
|
||||||
ret0, _ := ret[0].(*netmap.NetworkInfo)
|
ret0, _ := ret[0].(*netmap.NetworkInfo)
|
||||||
ret1, _ := ret[1].(error)
|
ret1, _ := ret[1].(error)
|
||||||
return ret0, ret1
|
return ret0, ret1
|
||||||
}
|
}
|
||||||
|
|
||||||
// NetworkInfo indicates an expected call of NetworkInfo.
|
// networkInfo indicates an expected call of networkInfo.
|
||||||
func (mr *MockClientMockRecorder) NetworkInfo(arg0, arg1 interface{}) *gomock.Call {
|
func (mr *MockClientMockRecorder) networkInfo(arg0, arg1 interface{}) *gomock.Call {
|
||||||
mr.mock.ctrl.T.Helper()
|
mr.mock.ctrl.T.Helper()
|
||||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NetworkInfo", reflect.TypeOf((*MockClient)(nil).NetworkInfo), arg0, arg1)
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "networkInfo", reflect.TypeOf((*MockClient)(nil).networkInfo), arg0, arg1)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ObjectDelete mocks base method.
|
// objectDelete mocks base method.
|
||||||
func (m *MockClient) ObjectDelete(arg0 context.Context, arg1 PrmObjectDelete) error {
|
func (m *MockClient) objectDelete(arg0 context.Context, arg1 PrmObjectDelete) error {
|
||||||
m.ctrl.T.Helper()
|
m.ctrl.T.Helper()
|
||||||
ret := m.ctrl.Call(m, "ObjectDelete", arg0, arg1)
|
ret := m.ctrl.Call(m, "objectDelete", arg0, arg1)
|
||||||
ret0, _ := ret[0].(error)
|
ret0, _ := ret[0].(error)
|
||||||
return ret0
|
return ret0
|
||||||
}
|
}
|
||||||
|
|
||||||
// ObjectDelete indicates an expected call of ObjectDelete.
|
// objectDelete indicates an expected call of objectDelete.
|
||||||
func (mr *MockClientMockRecorder) ObjectDelete(arg0, arg1 interface{}) *gomock.Call {
|
func (mr *MockClientMockRecorder) objectDelete(arg0, arg1 interface{}) *gomock.Call {
|
||||||
mr.mock.ctrl.T.Helper()
|
mr.mock.ctrl.T.Helper()
|
||||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ObjectDelete", reflect.TypeOf((*MockClient)(nil).ObjectDelete), arg0, arg1)
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "objectDelete", reflect.TypeOf((*MockClient)(nil).objectDelete), arg0, arg1)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ObjectGet mocks base method.
|
// objectGet mocks base method.
|
||||||
func (m *MockClient) ObjectGet(arg0 context.Context, arg1 PrmObjectGet) (*ResGetObject, error) {
|
func (m *MockClient) objectGet(arg0 context.Context, arg1 PrmObjectGet) (*ResGetObject, error) {
|
||||||
m.ctrl.T.Helper()
|
m.ctrl.T.Helper()
|
||||||
ret := m.ctrl.Call(m, "ObjectGet", arg0, arg1)
|
ret := m.ctrl.Call(m, "objectGet", arg0, arg1)
|
||||||
ret0, _ := ret[0].(*ResGetObject)
|
ret0, _ := ret[0].(*ResGetObject)
|
||||||
ret1, _ := ret[1].(error)
|
ret1, _ := ret[1].(error)
|
||||||
return ret0, ret1
|
return ret0, ret1
|
||||||
}
|
}
|
||||||
|
|
||||||
// ObjectGet indicates an expected call of ObjectGet.
|
// objectGet indicates an expected call of objectGet.
|
||||||
func (mr *MockClientMockRecorder) ObjectGet(arg0, arg1 interface{}) *gomock.Call {
|
func (mr *MockClientMockRecorder) objectGet(arg0, arg1 interface{}) *gomock.Call {
|
||||||
mr.mock.ctrl.T.Helper()
|
mr.mock.ctrl.T.Helper()
|
||||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ObjectGet", reflect.TypeOf((*MockClient)(nil).ObjectGet), arg0, arg1)
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "objectGet", reflect.TypeOf((*MockClient)(nil).objectGet), arg0, arg1)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ObjectHead mocks base method.
|
// objectHead mocks base method.
|
||||||
func (m *MockClient) ObjectHead(arg0 context.Context, arg1 PrmObjectHead) (*object.Object, error) {
|
func (m *MockClient) objectHead(arg0 context.Context, arg1 PrmObjectHead) (*object.Object, error) {
|
||||||
m.ctrl.T.Helper()
|
m.ctrl.T.Helper()
|
||||||
ret := m.ctrl.Call(m, "ObjectHead", arg0, arg1)
|
ret := m.ctrl.Call(m, "objectHead", arg0, arg1)
|
||||||
ret0, _ := ret[0].(*object.Object)
|
ret0, _ := ret[0].(*object.Object)
|
||||||
ret1, _ := ret[1].(error)
|
ret1, _ := ret[1].(error)
|
||||||
return ret0, ret1
|
return ret0, ret1
|
||||||
}
|
}
|
||||||
|
|
||||||
// ObjectHead indicates an expected call of ObjectHead.
|
// objectHead indicates an expected call of objectHead.
|
||||||
func (mr *MockClientMockRecorder) ObjectHead(arg0, arg1 interface{}) *gomock.Call {
|
func (mr *MockClientMockRecorder) objectHead(arg0, arg1 interface{}) *gomock.Call {
|
||||||
mr.mock.ctrl.T.Helper()
|
mr.mock.ctrl.T.Helper()
|
||||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ObjectHead", reflect.TypeOf((*MockClient)(nil).ObjectHead), arg0, arg1)
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "objectHead", reflect.TypeOf((*MockClient)(nil).objectHead), arg0, arg1)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ObjectPut mocks base method.
|
// objectPut mocks base method.
|
||||||
func (m *MockClient) ObjectPut(arg0 context.Context, arg1 PrmObjectPut) (*id0.ID, error) {
|
func (m *MockClient) objectPut(arg0 context.Context, arg1 PrmObjectPut) (*id0.ID, error) {
|
||||||
m.ctrl.T.Helper()
|
m.ctrl.T.Helper()
|
||||||
ret := m.ctrl.Call(m, "ObjectPut", arg0, arg1)
|
ret := m.ctrl.Call(m, "objectPut", arg0, arg1)
|
||||||
ret0, _ := ret[0].(*id0.ID)
|
ret0, _ := ret[0].(*id0.ID)
|
||||||
ret1, _ := ret[1].(error)
|
ret1, _ := ret[1].(error)
|
||||||
return ret0, ret1
|
return ret0, ret1
|
||||||
}
|
}
|
||||||
|
|
||||||
// ObjectPut indicates an expected call of ObjectPut.
|
// objectPut indicates an expected call of objectPut.
|
||||||
func (mr *MockClientMockRecorder) ObjectPut(arg0, arg1 interface{}) *gomock.Call {
|
func (mr *MockClientMockRecorder) objectPut(arg0, arg1 interface{}) *gomock.Call {
|
||||||
mr.mock.ctrl.T.Helper()
|
mr.mock.ctrl.T.Helper()
|
||||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ObjectPut", reflect.TypeOf((*MockClient)(nil).ObjectPut), arg0, arg1)
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "objectPut", reflect.TypeOf((*MockClient)(nil).objectPut), arg0, arg1)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ObjectRange mocks base method.
|
// objectRange mocks base method.
|
||||||
func (m *MockClient) ObjectRange(arg0 context.Context, arg1 PrmObjectRange) (*ResObjectRange, error) {
|
func (m *MockClient) objectRange(arg0 context.Context, arg1 PrmObjectRange) (*ResObjectRange, error) {
|
||||||
m.ctrl.T.Helper()
|
m.ctrl.T.Helper()
|
||||||
ret := m.ctrl.Call(m, "ObjectRange", arg0, arg1)
|
ret := m.ctrl.Call(m, "objectRange", arg0, arg1)
|
||||||
ret0, _ := ret[0].(*ResObjectRange)
|
ret0, _ := ret[0].(*ResObjectRange)
|
||||||
ret1, _ := ret[1].(error)
|
ret1, _ := ret[1].(error)
|
||||||
return ret0, ret1
|
return ret0, ret1
|
||||||
}
|
}
|
||||||
|
|
||||||
// ObjectRange indicates an expected call of ObjectRange.
|
// objectRange indicates an expected call of objectRange.
|
||||||
func (mr *MockClientMockRecorder) ObjectRange(arg0, arg1 interface{}) *gomock.Call {
|
func (mr *MockClientMockRecorder) objectRange(arg0, arg1 interface{}) *gomock.Call {
|
||||||
mr.mock.ctrl.T.Helper()
|
mr.mock.ctrl.T.Helper()
|
||||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ObjectRange", reflect.TypeOf((*MockClient)(nil).ObjectRange), arg0, arg1)
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "objectRange", reflect.TypeOf((*MockClient)(nil).objectRange), arg0, arg1)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ObjectSearch mocks base method.
|
// objectSearch mocks base method.
|
||||||
func (m *MockClient) ObjectSearch(arg0 context.Context, arg1 PrmObjectSearch) (*ResObjectSearch, error) {
|
func (m *MockClient) objectSearch(arg0 context.Context, arg1 PrmObjectSearch) (*ResObjectSearch, error) {
|
||||||
m.ctrl.T.Helper()
|
m.ctrl.T.Helper()
|
||||||
ret := m.ctrl.Call(m, "ObjectSearch", arg0, arg1)
|
ret := m.ctrl.Call(m, "objectSearch", arg0, arg1)
|
||||||
ret0, _ := ret[0].(*ResObjectSearch)
|
ret0, _ := ret[0].(*ResObjectSearch)
|
||||||
ret1, _ := ret[1].(error)
|
ret1, _ := ret[1].(error)
|
||||||
return ret0, ret1
|
return ret0, ret1
|
||||||
}
|
}
|
||||||
|
|
||||||
// ObjectSearch indicates an expected call of ObjectSearch.
|
// objectSearch indicates an expected call of objectSearch.
|
||||||
func (mr *MockClientMockRecorder) ObjectSearch(arg0, arg1 interface{}) *gomock.Call {
|
func (mr *MockClientMockRecorder) objectSearch(arg0, arg1 interface{}) *gomock.Call {
|
||||||
mr.mock.ctrl.T.Helper()
|
mr.mock.ctrl.T.Helper()
|
||||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ObjectSearch", reflect.TypeOf((*MockClient)(nil).ObjectSearch), arg0, arg1)
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "objectSearch", reflect.TypeOf((*MockClient)(nil).objectSearch), arg0, arg1)
|
||||||
}
|
}
|
||||||
|
|
||||||
// SessionCreate mocks base method.
|
// sessionCreate mocks base method.
|
||||||
func (m *MockClient) SessionCreate(arg0 context.Context, arg1 PrmCreateSession) (*ResCreateSession, error) {
|
func (m *MockClient) sessionCreate(arg0 context.Context, arg1 prmCreateSession) (*resCreateSession, error) {
|
||||||
m.ctrl.T.Helper()
|
m.ctrl.T.Helper()
|
||||||
ret := m.ctrl.Call(m, "SessionCreate", arg0, arg1)
|
ret := m.ctrl.Call(m, "sessionCreate", arg0, arg1)
|
||||||
ret0, _ := ret[0].(*ResCreateSession)
|
ret0, _ := ret[0].(*resCreateSession)
|
||||||
ret1, _ := ret[1].(error)
|
ret1, _ := ret[1].(error)
|
||||||
return ret0, ret1
|
return ret0, ret1
|
||||||
}
|
}
|
||||||
|
|
||||||
// SessionCreate indicates an expected call of SessionCreate.
|
// sessionCreate indicates an expected call of sessionCreate.
|
||||||
func (mr *MockClientMockRecorder) SessionCreate(arg0, arg1 interface{}) *gomock.Call {
|
func (mr *MockClientMockRecorder) sessionCreate(arg0, arg1 interface{}) *gomock.Call {
|
||||||
mr.mock.ctrl.T.Helper()
|
mr.mock.ctrl.T.Helper()
|
||||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SessionCreate", reflect.TypeOf((*MockClient)(nil).SessionCreate), arg0, arg1)
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "sessionCreate", reflect.TypeOf((*MockClient)(nil).sessionCreate), arg0, arg1)
|
||||||
}
|
}
|
||||||
|
|
132
pool/pool.go
132
pool/pool.go
|
@ -33,22 +33,22 @@ import (
|
||||||
|
|
||||||
// client represents virtual connection to the single NeoFS network endpoint from which Pool is formed.
|
// client represents virtual connection to the single NeoFS network endpoint from which Pool is formed.
|
||||||
type client interface {
|
type client interface {
|
||||||
BalanceGet(context.Context, PrmBalanceGet) (*accounting.Decimal, error)
|
balanceGet(context.Context, PrmBalanceGet) (*accounting.Decimal, error)
|
||||||
ContainerPut(context.Context, PrmContainerPut) (*cid.ID, error)
|
containerPut(context.Context, PrmContainerPut) (*cid.ID, error)
|
||||||
ContainerGet(context.Context, PrmContainerGet) (*container.Container, error)
|
containerGet(context.Context, PrmContainerGet) (*container.Container, error)
|
||||||
ContainerList(context.Context, PrmContainerList) ([]cid.ID, error)
|
containerList(context.Context, PrmContainerList) ([]cid.ID, error)
|
||||||
ContainerDelete(context.Context, PrmContainerDelete) error
|
containerDelete(context.Context, PrmContainerDelete) error
|
||||||
ContainerEACL(context.Context, PrmContainerEACL) (*eacl.Table, error)
|
containerEACL(context.Context, PrmContainerEACL) (*eacl.Table, error)
|
||||||
ContainerSetEACL(context.Context, PrmContainerSetEACL) error
|
containerSetEACL(context.Context, PrmContainerSetEACL) error
|
||||||
EndpointInfo(context.Context, PrmEndpointInfo) (*netmap.NodeInfo, error)
|
endpointInfo(context.Context, prmEndpointInfo) (*netmap.NodeInfo, error)
|
||||||
NetworkInfo(context.Context, PrmNetworkInfo) (*netmap.NetworkInfo, error)
|
networkInfo(context.Context, prmNetworkInfo) (*netmap.NetworkInfo, error)
|
||||||
ObjectPut(context.Context, PrmObjectPut) (*oid.ID, error)
|
objectPut(context.Context, PrmObjectPut) (*oid.ID, error)
|
||||||
ObjectDelete(context.Context, PrmObjectDelete) error
|
objectDelete(context.Context, PrmObjectDelete) error
|
||||||
ObjectGet(context.Context, PrmObjectGet) (*ResGetObject, error)
|
objectGet(context.Context, PrmObjectGet) (*ResGetObject, error)
|
||||||
ObjectHead(context.Context, PrmObjectHead) (*object.Object, error)
|
objectHead(context.Context, PrmObjectHead) (*object.Object, error)
|
||||||
ObjectRange(context.Context, PrmObjectRange) (*ResObjectRange, error)
|
objectRange(context.Context, PrmObjectRange) (*ResObjectRange, error)
|
||||||
ObjectSearch(context.Context, PrmObjectSearch) (*ResObjectSearch, error)
|
objectSearch(context.Context, PrmObjectSearch) (*ResObjectSearch, error)
|
||||||
SessionCreate(context.Context, PrmCreateSession) (*ResCreateSession, error)
|
sessionCreate(context.Context, prmCreateSession) (*resCreateSession, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
// clientWrapper is used by default, alternative implementations are intended for testing purposes only.
|
// clientWrapper is used by default, alternative implementations are intended for testing purposes only.
|
||||||
|
@ -96,7 +96,7 @@ func newWrapper(prm wrapperPrm) (*clientWrapper, error) {
|
||||||
return &clientWrapper{client: &c, key: prm.key}, c.Dial(prmDial)
|
return &clientWrapper{client: &c, key: prm.key}, c.Dial(prmDial)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *clientWrapper) BalanceGet(ctx context.Context, prm PrmBalanceGet) (*accounting.Decimal, error) {
|
func (c *clientWrapper) balanceGet(ctx context.Context, prm PrmBalanceGet) (*accounting.Decimal, error) {
|
||||||
var cliPrm sdkClient.PrmBalanceGet
|
var cliPrm sdkClient.PrmBalanceGet
|
||||||
cliPrm.SetAccount(prm.ownerID)
|
cliPrm.SetAccount(prm.ownerID)
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ func (c *clientWrapper) BalanceGet(ctx context.Context, prm PrmBalanceGet) (*acc
|
||||||
return res.Amount(), nil
|
return res.Amount(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *clientWrapper) ContainerPut(ctx context.Context, prm PrmContainerPut) (*cid.ID, error) {
|
func (c *clientWrapper) containerPut(ctx context.Context, prm PrmContainerPut) (*cid.ID, error) {
|
||||||
var cliPrm sdkClient.PrmContainerPut
|
var cliPrm sdkClient.PrmContainerPut
|
||||||
cliPrm.SetContainer(prm.cnr)
|
cliPrm.SetContainer(prm.cnr)
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ func (c *clientWrapper) ContainerPut(ctx context.Context, prm PrmContainerPut) (
|
||||||
return res.ID(), waitForContainerPresence(ctx, c, res.ID(), &prm.waitParams)
|
return res.ID(), waitForContainerPresence(ctx, c, res.ID(), &prm.waitParams)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *clientWrapper) ContainerGet(ctx context.Context, prm PrmContainerGet) (*container.Container, error) {
|
func (c *clientWrapper) containerGet(ctx context.Context, prm PrmContainerGet) (*container.Container, error) {
|
||||||
var cliPrm sdkClient.PrmContainerGet
|
var cliPrm sdkClient.PrmContainerGet
|
||||||
cliPrm.SetContainer(prm.cnrID)
|
cliPrm.SetContainer(prm.cnrID)
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ func (c *clientWrapper) ContainerGet(ctx context.Context, prm PrmContainerGet) (
|
||||||
return res.Container(), nil
|
return res.Container(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *clientWrapper) ContainerList(ctx context.Context, prm PrmContainerList) ([]cid.ID, error) {
|
func (c *clientWrapper) containerList(ctx context.Context, prm PrmContainerList) ([]cid.ID, error) {
|
||||||
var cliPrm sdkClient.PrmContainerList
|
var cliPrm sdkClient.PrmContainerList
|
||||||
cliPrm.SetAccount(prm.ownerID)
|
cliPrm.SetAccount(prm.ownerID)
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ func (c *clientWrapper) ContainerList(ctx context.Context, prm PrmContainerList)
|
||||||
return res.Containers(), nil
|
return res.Containers(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *clientWrapper) ContainerDelete(ctx context.Context, prm PrmContainerDelete) error {
|
func (c *clientWrapper) containerDelete(ctx context.Context, prm PrmContainerDelete) error {
|
||||||
var cliPrm sdkClient.PrmContainerDelete
|
var cliPrm sdkClient.PrmContainerDelete
|
||||||
cliPrm.SetContainer(prm.cnrID)
|
cliPrm.SetContainer(prm.cnrID)
|
||||||
cliPrm.SetSessionToken(prm.stoken)
|
cliPrm.SetSessionToken(prm.stoken)
|
||||||
|
@ -161,7 +161,7 @@ func (c *clientWrapper) ContainerDelete(ctx context.Context, prm PrmContainerDel
|
||||||
return waitForContainerRemoved(ctx, c, &prm.cnrID, &prm.waitParams)
|
return waitForContainerRemoved(ctx, c, &prm.cnrID, &prm.waitParams)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *clientWrapper) ContainerEACL(ctx context.Context, prm PrmContainerEACL) (*eacl.Table, error) {
|
func (c *clientWrapper) containerEACL(ctx context.Context, prm PrmContainerEACL) (*eacl.Table, error) {
|
||||||
var cliPrm sdkClient.PrmContainerEACL
|
var cliPrm sdkClient.PrmContainerEACL
|
||||||
cliPrm.SetContainer(prm.cnrID)
|
cliPrm.SetContainer(prm.cnrID)
|
||||||
|
|
||||||
|
@ -172,7 +172,7 @@ func (c *clientWrapper) ContainerEACL(ctx context.Context, prm PrmContainerEACL)
|
||||||
return res.Table(), nil
|
return res.Table(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *clientWrapper) ContainerSetEACL(ctx context.Context, prm PrmContainerSetEACL) error {
|
func (c *clientWrapper) containerSetEACL(ctx context.Context, prm PrmContainerSetEACL) error {
|
||||||
var cliPrm sdkClient.PrmContainerSetEACL
|
var cliPrm sdkClient.PrmContainerSetEACL
|
||||||
cliPrm.SetTable(prm.table)
|
cliPrm.SetTable(prm.table)
|
||||||
|
|
||||||
|
@ -187,7 +187,7 @@ func (c *clientWrapper) ContainerSetEACL(ctx context.Context, prm PrmContainerSe
|
||||||
return waitForEACLPresence(ctx, c, prm.table.CID(), &prm.table, &prm.waitParams)
|
return waitForEACLPresence(ctx, c, prm.table.CID(), &prm.table, &prm.waitParams)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *clientWrapper) EndpointInfo(ctx context.Context, _ PrmEndpointInfo) (*netmap.NodeInfo, error) {
|
func (c *clientWrapper) endpointInfo(ctx context.Context, _ prmEndpointInfo) (*netmap.NodeInfo, error) {
|
||||||
res, err := c.client.EndpointInfo(ctx, sdkClient.PrmEndpointInfo{})
|
res, err := c.client.EndpointInfo(ctx, sdkClient.PrmEndpointInfo{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -195,7 +195,7 @@ func (c *clientWrapper) EndpointInfo(ctx context.Context, _ PrmEndpointInfo) (*n
|
||||||
return res.NodeInfo(), nil
|
return res.NodeInfo(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *clientWrapper) NetworkInfo(ctx context.Context, _ PrmNetworkInfo) (*netmap.NetworkInfo, error) {
|
func (c *clientWrapper) networkInfo(ctx context.Context, _ prmNetworkInfo) (*netmap.NetworkInfo, error) {
|
||||||
res, err := c.client.NetworkInfo(ctx, sdkClient.PrmNetworkInfo{})
|
res, err := c.client.NetworkInfo(ctx, sdkClient.PrmNetworkInfo{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -203,7 +203,7 @@ func (c *clientWrapper) NetworkInfo(ctx context.Context, _ PrmNetworkInfo) (*net
|
||||||
return res.Info(), nil
|
return res.Info(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *clientWrapper) ObjectPut(ctx context.Context, prm PrmObjectPut) (*oid.ID, error) {
|
func (c *clientWrapper) objectPut(ctx context.Context, prm PrmObjectPut) (*oid.ID, error) {
|
||||||
var cliPrm sdkClient.PrmObjectPutInit
|
var cliPrm sdkClient.PrmObjectPutInit
|
||||||
wObj, err := c.client.ObjectPutInit(ctx, cliPrm)
|
wObj, err := c.client.ObjectPutInit(ctx, cliPrm)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -275,7 +275,7 @@ func (c *clientWrapper) ObjectPut(ctx context.Context, prm PrmObjectPut) (*oid.I
|
||||||
return &id, nil
|
return &id, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *clientWrapper) ObjectDelete(ctx context.Context, prm PrmObjectDelete) error {
|
func (c *clientWrapper) objectDelete(ctx context.Context, prm PrmObjectDelete) error {
|
||||||
var cliPrm sdkClient.PrmObjectDelete
|
var cliPrm sdkClient.PrmObjectDelete
|
||||||
|
|
||||||
if cnr := prm.addr.ContainerID(); cnr != nil {
|
if cnr := prm.addr.ContainerID(); cnr != nil {
|
||||||
|
@ -299,7 +299,7 @@ func (c *clientWrapper) ObjectDelete(ctx context.Context, prm PrmObjectDelete) e
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *clientWrapper) ObjectGet(ctx context.Context, prm PrmObjectGet) (*ResGetObject, error) {
|
func (c *clientWrapper) objectGet(ctx context.Context, prm PrmObjectGet) (*ResGetObject, error) {
|
||||||
var cliPrm sdkClient.PrmObjectGet
|
var cliPrm sdkClient.PrmObjectGet
|
||||||
|
|
||||||
if cnr := prm.addr.ContainerID(); cnr != nil {
|
if cnr := prm.addr.ContainerID(); cnr != nil {
|
||||||
|
@ -345,7 +345,7 @@ func (c *clientWrapper) ObjectGet(ctx context.Context, prm PrmObjectGet) (*ResGe
|
||||||
return &res, nil
|
return &res, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *clientWrapper) ObjectHead(ctx context.Context, prm PrmObjectHead) (*object.Object, error) {
|
func (c *clientWrapper) objectHead(ctx context.Context, prm PrmObjectHead) (*object.Object, error) {
|
||||||
var cliPrm sdkClient.PrmObjectHead
|
var cliPrm sdkClient.PrmObjectHead
|
||||||
|
|
||||||
if cnr := prm.addr.ContainerID(); cnr != nil {
|
if cnr := prm.addr.ContainerID(); cnr != nil {
|
||||||
|
@ -379,7 +379,7 @@ func (c *clientWrapper) ObjectHead(ctx context.Context, prm PrmObjectHead) (*obj
|
||||||
return &obj, nil
|
return &obj, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *clientWrapper) ObjectRange(ctx context.Context, prm PrmObjectRange) (*ResObjectRange, error) {
|
func (c *clientWrapper) objectRange(ctx context.Context, prm PrmObjectRange) (*ResObjectRange, error) {
|
||||||
var cliPrm sdkClient.PrmObjectRange
|
var cliPrm sdkClient.PrmObjectRange
|
||||||
|
|
||||||
cliPrm.SetOffset(prm.off)
|
cliPrm.SetOffset(prm.off)
|
||||||
|
@ -410,7 +410,7 @@ func (c *clientWrapper) ObjectRange(ctx context.Context, prm PrmObjectRange) (*R
|
||||||
return &ResObjectRange{payload: res}, nil
|
return &ResObjectRange{payload: res}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *clientWrapper) ObjectSearch(ctx context.Context, prm PrmObjectSearch) (*ResObjectSearch, error) {
|
func (c *clientWrapper) objectSearch(ctx context.Context, prm PrmObjectSearch) (*ResObjectSearch, error) {
|
||||||
var cliPrm sdkClient.PrmObjectSearch
|
var cliPrm sdkClient.PrmObjectSearch
|
||||||
|
|
||||||
cliPrm.InContainer(prm.cnrID)
|
cliPrm.InContainer(prm.cnrID)
|
||||||
|
@ -433,7 +433,7 @@ func (c *clientWrapper) ObjectSearch(ctx context.Context, prm PrmObjectSearch) (
|
||||||
return &ResObjectSearch{r: res}, nil
|
return &ResObjectSearch{r: res}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *clientWrapper) SessionCreate(ctx context.Context, prm PrmCreateSession) (*ResCreateSession, error) {
|
func (c *clientWrapper) sessionCreate(ctx context.Context, prm prmCreateSession) (*resCreateSession, error) {
|
||||||
var cliPrm sdkClient.PrmSessionCreate
|
var cliPrm sdkClient.PrmSessionCreate
|
||||||
cliPrm.SetExp(prm.exp)
|
cliPrm.SetExp(prm.exp)
|
||||||
|
|
||||||
|
@ -442,7 +442,7 @@ func (c *clientWrapper) SessionCreate(ctx context.Context, prm PrmCreateSession)
|
||||||
return nil, fmt.Errorf("session creation on client: %w", err)
|
return nil, fmt.Errorf("session creation on client: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return &ResCreateSession{
|
return &resCreateSession{
|
||||||
id: res.ID(),
|
id: res.ID(),
|
||||||
sessionKey: res.PublicKey(),
|
sessionKey: res.PublicKey(),
|
||||||
}, nil
|
}, nil
|
||||||
|
@ -828,23 +828,24 @@ func (x *PrmBalanceGet) SetOwnerID(ownerID owner.ID) {
|
||||||
x.ownerID = ownerID
|
x.ownerID = ownerID
|
||||||
}
|
}
|
||||||
|
|
||||||
type PrmCreateSession struct {
|
// prmEndpointInfo groups parameters of sessionCreate operation.
|
||||||
|
type prmCreateSession struct {
|
||||||
exp uint64
|
exp uint64
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetExp sets number of the last NeoFS epoch in the lifetime of the session after which it will be expired.
|
// SetExp sets number of the last NeoFS epoch in the lifetime of the session after which it will be expired.
|
||||||
func (x *PrmCreateSession) SetExp(exp uint64) {
|
func (x *prmCreateSession) SetExp(exp uint64) {
|
||||||
x.exp = exp
|
x.exp = exp
|
||||||
}
|
}
|
||||||
|
|
||||||
// PrmEndpointInfo groups parameters of EndpointInfo operation.
|
// prmEndpointInfo groups parameters of endpointInfo operation.
|
||||||
type PrmEndpointInfo struct{}
|
type prmEndpointInfo struct{}
|
||||||
|
|
||||||
// PrmNetworkInfo groups parameters of NetworkInfo operation.
|
// prmNetworkInfo groups parameters of networkInfo operation.
|
||||||
type PrmNetworkInfo struct{}
|
type prmNetworkInfo struct{}
|
||||||
|
|
||||||
// ResCreateSession groups resulting values of SessionCreate operation.
|
// resCreateSession groups resulting values of sessionCreate operation.
|
||||||
type ResCreateSession struct {
|
type resCreateSession struct {
|
||||||
id []byte
|
id []byte
|
||||||
|
|
||||||
sessionKey []byte
|
sessionKey []byte
|
||||||
|
@ -1086,7 +1087,7 @@ func (p *Pool) updateInnerNodesHealth(ctx context.Context, i int, bufferWeights
|
||||||
healthyChanged := false
|
healthyChanged := false
|
||||||
wg := sync.WaitGroup{}
|
wg := sync.WaitGroup{}
|
||||||
|
|
||||||
var prmEndpoint PrmEndpointInfo
|
var prmEndpoint prmEndpointInfo
|
||||||
|
|
||||||
for j, cPack := range pool.clientPacks {
|
for j, cPack := range pool.clientPacks {
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
|
@ -1096,7 +1097,7 @@ func (p *Pool) updateInnerNodesHealth(ctx context.Context, i int, bufferWeights
|
||||||
tctx, c := context.WithTimeout(ctx, options.nodeRequestTimeout)
|
tctx, c := context.WithTimeout(ctx, options.nodeRequestTimeout)
|
||||||
defer c()
|
defer c()
|
||||||
|
|
||||||
if _, err := cli.EndpointInfo(tctx, prmEndpoint); err != nil {
|
if _, err := cli.endpointInfo(tctx, prmEndpoint); err != nil {
|
||||||
ok = false
|
ok = false
|
||||||
bufferWeights[j] = 0
|
bufferWeights[j] = 0
|
||||||
}
|
}
|
||||||
|
@ -1200,7 +1201,7 @@ func (p *Pool) checkSessionTokenErr(err error, address string) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
func createSessionTokenForDuration(ctx context.Context, c client, ownerID *owner.ID, dur uint64) (*session.Token, error) {
|
func createSessionTokenForDuration(ctx context.Context, c client, ownerID *owner.ID, dur uint64) (*session.Token, error) {
|
||||||
ni, err := c.NetworkInfo(ctx, PrmNetworkInfo{})
|
ni, err := c.networkInfo(ctx, prmNetworkInfo{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -1213,10 +1214,10 @@ func createSessionTokenForDuration(ctx context.Context, c client, ownerID *owner
|
||||||
} else {
|
} else {
|
||||||
exp = epoch + dur
|
exp = epoch + dur
|
||||||
}
|
}
|
||||||
var prm PrmCreateSession
|
var prm prmCreateSession
|
||||||
prm.SetExp(exp)
|
prm.SetExp(exp)
|
||||||
|
|
||||||
res, err := c.SessionCreate(ctx, prm)
|
res, err := c.sessionCreate(ctx, prm)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -1338,14 +1339,13 @@ func (p *Pool) PutObject(ctx context.Context, prm PrmObjectPut) (*oid.ID, error)
|
||||||
|
|
||||||
if ctxCall.sessionDefault {
|
if ctxCall.sessionDefault {
|
||||||
ctxCall.sessionTarget = prm.UseSession
|
ctxCall.sessionTarget = prm.UseSession
|
||||||
err = p.openDefaultSession(&ctxCall)
|
if err := p.openDefaultSession(&ctxCall); err != nil {
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("open default session: %w", err)
|
return nil, fmt.Errorf("open default session: %w", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
prm.key = ctxCall.key
|
prm.key = ctxCall.key
|
||||||
|
|
||||||
id, err := ctxCall.client.ObjectPut(ctx, prm)
|
id, err := ctxCall.client.objectPut(ctx, prm)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// removes session token from cache in case of token error
|
// removes session token from cache in case of token error
|
||||||
p.checkSessionTokenErr(err, ctxCall.endpoint)
|
p.checkSessionTokenErr(err, ctxCall.endpoint)
|
||||||
|
@ -1376,7 +1376,7 @@ func (p *Pool) DeleteObject(ctx context.Context, prm PrmObjectDelete) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
return p.call(&cc, func() error {
|
return p.call(&cc, func() error {
|
||||||
if err = cc.client.ObjectDelete(ctx, prm); err != nil {
|
if err = cc.client.objectDelete(ctx, prm); err != nil {
|
||||||
return fmt.Errorf("remove object via client: %w", err)
|
return fmt.Errorf("remove object via client: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1422,7 +1422,7 @@ func (p *Pool) GetObject(ctx context.Context, prm PrmObjectGet) (*ResGetObject,
|
||||||
|
|
||||||
var res *ResGetObject
|
var res *ResGetObject
|
||||||
return res, p.call(&cc, func() error {
|
return res, p.call(&cc, func() error {
|
||||||
res, err = cc.client.ObjectGet(ctx, prm)
|
res, err = cc.client.objectGet(ctx, prm)
|
||||||
return err
|
return err
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -1446,7 +1446,7 @@ func (p *Pool) HeadObject(ctx context.Context, prm PrmObjectHead) (*object.Objec
|
||||||
|
|
||||||
var obj *object.Object
|
var obj *object.Object
|
||||||
return obj, p.call(&cc, func() error {
|
return obj, p.call(&cc, func() error {
|
||||||
obj, err = cc.client.ObjectHead(ctx, prm)
|
obj, err = cc.client.objectHead(ctx, prm)
|
||||||
return err
|
return err
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -1492,7 +1492,7 @@ func (p *Pool) ObjectRange(ctx context.Context, prm PrmObjectRange) (*ResObjectR
|
||||||
var res *ResObjectRange
|
var res *ResObjectRange
|
||||||
|
|
||||||
return res, p.call(&cc, func() error {
|
return res, p.call(&cc, func() error {
|
||||||
res, err = cc.client.ObjectRange(ctx, prm)
|
res, err = cc.client.objectRange(ctx, prm)
|
||||||
return err
|
return err
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -1557,7 +1557,7 @@ func (p *Pool) SearchObjects(ctx context.Context, prm PrmObjectSearch) (*ResObje
|
||||||
var res *ResObjectSearch
|
var res *ResObjectSearch
|
||||||
|
|
||||||
return res, p.call(&cc, func() error {
|
return res, p.call(&cc, func() error {
|
||||||
res, err = cc.client.ObjectSearch(ctx, prm)
|
res, err = cc.client.objectSearch(ctx, prm)
|
||||||
return err
|
return err
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -1575,7 +1575,7 @@ func (p *Pool) PutContainer(ctx context.Context, prm PrmContainerPut) (*cid.ID,
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return cp.client.ContainerPut(ctx, prm)
|
return cp.client.containerPut(ctx, prm)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetContainer reads NeoFS container by ID.
|
// GetContainer reads NeoFS container by ID.
|
||||||
|
@ -1585,7 +1585,7 @@ func (p *Pool) GetContainer(ctx context.Context, prm PrmContainerGet) (*containe
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return cp.client.ContainerGet(ctx, prm)
|
return cp.client.containerGet(ctx, prm)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListContainers requests identifiers of the account-owned containers.
|
// ListContainers requests identifiers of the account-owned containers.
|
||||||
|
@ -1595,7 +1595,7 @@ func (p *Pool) ListContainers(ctx context.Context, prm PrmContainerList) ([]cid.
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return cp.client.ContainerList(ctx, prm)
|
return cp.client.containerList(ctx, prm)
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeleteContainer sends request to remove the NeoFS container and waits for the operation to complete.
|
// DeleteContainer sends request to remove the NeoFS container and waits for the operation to complete.
|
||||||
|
@ -1611,7 +1611,7 @@ func (p *Pool) DeleteContainer(ctx context.Context, prm PrmContainerDelete) erro
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
return cp.client.ContainerDelete(ctx, prm)
|
return cp.client.containerDelete(ctx, prm)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetEACL reads eACL table of the NeoFS container.
|
// GetEACL reads eACL table of the NeoFS container.
|
||||||
|
@ -1621,7 +1621,7 @@ func (p *Pool) GetEACL(ctx context.Context, prm PrmContainerEACL) (*eacl.Table,
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return cp.client.ContainerEACL(ctx, prm)
|
return cp.client.containerEACL(ctx, prm)
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetEACL sends request to update eACL table of the NeoFS container and waits for the operation to complete.
|
// SetEACL sends request to update eACL table of the NeoFS container and waits for the operation to complete.
|
||||||
|
@ -1637,7 +1637,7 @@ func (p *Pool) SetEACL(ctx context.Context, prm PrmContainerSetEACL) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
return cp.client.ContainerSetEACL(ctx, prm)
|
return cp.client.containerSetEACL(ctx, prm)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Balance requests current balance of the NeoFS account.
|
// Balance requests current balance of the NeoFS account.
|
||||||
|
@ -1647,7 +1647,7 @@ func (p *Pool) Balance(ctx context.Context, prm PrmBalanceGet) (*accounting.Deci
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return cp.client.BalanceGet(ctx, prm)
|
return cp.client.balanceGet(ctx, prm)
|
||||||
}
|
}
|
||||||
|
|
||||||
// waitForContainerPresence waits until the container is found on the NeoFS network.
|
// waitForContainerPresence waits until the container is found on the NeoFS network.
|
||||||
|
@ -1658,7 +1658,7 @@ func waitForContainerPresence(ctx context.Context, cli client, cnrID *cid.ID, wa
|
||||||
}
|
}
|
||||||
|
|
||||||
return waitFor(ctx, waitParams, func(ctx context.Context) bool {
|
return waitFor(ctx, waitParams, func(ctx context.Context) bool {
|
||||||
_, err := cli.ContainerGet(ctx, prm)
|
_, err := cli.containerGet(ctx, prm)
|
||||||
return err == nil
|
return err == nil
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -1671,7 +1671,7 @@ func waitForEACLPresence(ctx context.Context, cli client, cnrID *cid.ID, table *
|
||||||
}
|
}
|
||||||
|
|
||||||
return waitFor(ctx, waitParams, func(ctx context.Context) bool {
|
return waitFor(ctx, waitParams, func(ctx context.Context) bool {
|
||||||
eaclTable, err := cli.ContainerEACL(ctx, prm)
|
eaclTable, err := cli.containerEACL(ctx, prm)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
return eacl.EqualTables(*table, *eaclTable)
|
return eacl.EqualTables(*table, *eaclTable)
|
||||||
}
|
}
|
||||||
|
@ -1687,7 +1687,7 @@ func waitForContainerRemoved(ctx context.Context, cli client, cnrID *cid.ID, wai
|
||||||
}
|
}
|
||||||
|
|
||||||
return waitFor(ctx, waitParams, func(ctx context.Context) bool {
|
return waitFor(ctx, waitParams, func(ctx context.Context) bool {
|
||||||
_, err := cli.ContainerGet(ctx, prm)
|
_, err := cli.containerGet(ctx, prm)
|
||||||
return sdkClient.IsErrContainerNotFound(err)
|
return sdkClient.IsErrContainerNotFound(err)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -1722,7 +1722,7 @@ func (p *Pool) NetworkInfo(ctx context.Context) (*netmap.NetworkInfo, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return cp.client.NetworkInfo(ctx, PrmNetworkInfo{})
|
return cp.client.networkInfo(ctx, prmNetworkInfo{})
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close closes the Pool and releases all the associated resources.
|
// Close closes the Pool and releases all the associated resources.
|
||||||
|
@ -1732,7 +1732,7 @@ func (p *Pool) Close() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// creates new session token with specified owner from SessionCreate call result.
|
// creates new session token with specified owner from SessionCreate call result.
|
||||||
func sessionTokenForOwner(id *owner.ID, cliRes *ResCreateSession, exp uint64) *session.Token {
|
func sessionTokenForOwner(id *owner.ID, cliRes *resCreateSession, exp uint64) *session.Token {
|
||||||
st := session.NewToken()
|
st := session.NewToken()
|
||||||
st.SetOwnerID(id)
|
st.SetOwnerID(id)
|
||||||
st.SetID(cliRes.id)
|
st.SetID(cliRes.id)
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package pool
|
package pool
|
||||||
|
|
||||||
// To generate mock define 'type Client client' in pool.go
|
//go:generate mockgen -destination mock_test.go -source pool.go -mock_names client=MockClient -package pool . client
|
||||||
//go:generate mockgen -destination mock_test.go -package pool . Client
|
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
@ -51,9 +50,9 @@ func TestBuildPoolCreateSessionFailed(t *testing.T) {
|
||||||
|
|
||||||
clientBuilder := func(_ string) (client, error) {
|
clientBuilder := func(_ string) (client, error) {
|
||||||
mockClient := NewMockClient(ctrl)
|
mockClient := NewMockClient(ctrl)
|
||||||
mockClient.EXPECT().SessionCreate(gomock.Any(), gomock.Any()).Return(nil, fmt.Errorf("error session")).AnyTimes()
|
mockClient.EXPECT().sessionCreate(gomock.Any(), gomock.Any()).Return(nil, fmt.Errorf("error session")).AnyTimes()
|
||||||
mockClient.EXPECT().EndpointInfo(gomock.Any(), gomock.Any()).Return(&netmap.NodeInfo{}, nil).AnyTimes()
|
mockClient.EXPECT().endpointInfo(gomock.Any(), gomock.Any()).Return(&netmap.NodeInfo{}, nil).AnyTimes()
|
||||||
mockClient.EXPECT().NetworkInfo(gomock.Any(), gomock.Any()).Return(&netmap.NetworkInfo{}, nil).AnyTimes()
|
mockClient.EXPECT().networkInfo(gomock.Any(), gomock.Any()).Return(&netmap.NetworkInfo{}, nil).AnyTimes()
|
||||||
return mockClient, nil
|
return mockClient, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,25 +87,25 @@ func TestBuildPoolOneNodeFailed(t *testing.T) {
|
||||||
clientCount++
|
clientCount++
|
||||||
mockClient := NewMockClient(ctrl)
|
mockClient := NewMockClient(ctrl)
|
||||||
mockInvokes := 0
|
mockInvokes := 0
|
||||||
mockClient.EXPECT().SessionCreate(gomock.Any(), gomock.Any()).DoAndReturn(func(_, _ interface{}, _ ...interface{}) (*ResCreateSession, error) {
|
mockClient.EXPECT().sessionCreate(gomock.Any(), gomock.Any()).DoAndReturn(func(_, _ interface{}, _ ...interface{}) (*resCreateSession, error) {
|
||||||
mockInvokes++
|
mockInvokes++
|
||||||
if mockInvokes == 1 {
|
if mockInvokes == 1 {
|
||||||
expectedToken = newToken(t)
|
expectedToken = newToken(t)
|
||||||
return nil, fmt.Errorf("error session")
|
return nil, fmt.Errorf("error session")
|
||||||
}
|
}
|
||||||
return &ResCreateSession{
|
return &resCreateSession{
|
||||||
sessionKey: expectedToken.SessionKey(),
|
sessionKey: expectedToken.SessionKey(),
|
||||||
id: expectedToken.ID(),
|
id: expectedToken.ID(),
|
||||||
}, nil
|
}, nil
|
||||||
}).AnyTimes()
|
}).AnyTimes()
|
||||||
|
|
||||||
mockClient.EXPECT().EndpointInfo(gomock.Any(), gomock.Any()).Return(nil, nil).AnyTimes()
|
mockClient.EXPECT().endpointInfo(gomock.Any(), gomock.Any()).Return(nil, nil).AnyTimes()
|
||||||
mockClient.EXPECT().NetworkInfo(gomock.Any(), gomock.Any()).Return(&netmap.NetworkInfo{}, nil).AnyTimes()
|
mockClient.EXPECT().networkInfo(gomock.Any(), gomock.Any()).Return(&netmap.NetworkInfo{}, nil).AnyTimes()
|
||||||
|
|
||||||
mockClient2 := NewMockClient(ctrl2)
|
mockClient2 := NewMockClient(ctrl2)
|
||||||
mockClient2.EXPECT().SessionCreate(gomock.Any(), gomock.Any()).Return(&ResCreateSession{}, nil).AnyTimes()
|
mockClient2.EXPECT().sessionCreate(gomock.Any(), gomock.Any()).Return(&resCreateSession{}, nil).AnyTimes()
|
||||||
mockClient2.EXPECT().EndpointInfo(gomock.Any(), gomock.Any()).Return(nil, nil).AnyTimes()
|
mockClient2.EXPECT().endpointInfo(gomock.Any(), gomock.Any()).Return(nil, nil).AnyTimes()
|
||||||
mockClient2.EXPECT().NetworkInfo(gomock.Any(), gomock.Any()).Return(&netmap.NetworkInfo{}, nil).AnyTimes()
|
mockClient2.EXPECT().networkInfo(gomock.Any(), gomock.Any()).Return(&netmap.NetworkInfo{}, nil).AnyTimes()
|
||||||
|
|
||||||
if clientCount == 0 {
|
if clientCount == 0 {
|
||||||
return mockClient, nil
|
return mockClient, nil
|
||||||
|
@ -161,16 +160,16 @@ func TestOneNode(t *testing.T) {
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
tok.SetID(uid)
|
tok.SetID(uid)
|
||||||
|
|
||||||
tokRes := &ResCreateSession{
|
tokRes := &resCreateSession{
|
||||||
id: tok.ID(),
|
id: tok.ID(),
|
||||||
sessionKey: tok.SessionKey(),
|
sessionKey: tok.SessionKey(),
|
||||||
}
|
}
|
||||||
|
|
||||||
clientBuilder := func(_ string) (client, error) {
|
clientBuilder := func(_ string) (client, error) {
|
||||||
mockClient := NewMockClient(ctrl)
|
mockClient := NewMockClient(ctrl)
|
||||||
mockClient.EXPECT().SessionCreate(gomock.Any(), gomock.Any()).Return(tokRes, nil)
|
mockClient.EXPECT().sessionCreate(gomock.Any(), gomock.Any()).Return(tokRes, nil)
|
||||||
mockClient.EXPECT().EndpointInfo(gomock.Any(), gomock.Any()).Return(&netmap.NodeInfo{}, nil).AnyTimes()
|
mockClient.EXPECT().endpointInfo(gomock.Any(), gomock.Any()).Return(&netmap.NodeInfo{}, nil).AnyTimes()
|
||||||
mockClient.EXPECT().NetworkInfo(gomock.Any(), gomock.Any()).Return(&netmap.NetworkInfo{}, nil).AnyTimes()
|
mockClient.EXPECT().networkInfo(gomock.Any(), gomock.Any()).Return(&netmap.NetworkInfo{}, nil).AnyTimes()
|
||||||
return mockClient, nil
|
return mockClient, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -206,19 +205,19 @@ func TestTwoNodes(t *testing.T) {
|
||||||
var tokens []*session.Token
|
var tokens []*session.Token
|
||||||
clientBuilder := func(_ string) (client, error) {
|
clientBuilder := func(_ string) (client, error) {
|
||||||
mockClient := NewMockClient(ctrl)
|
mockClient := NewMockClient(ctrl)
|
||||||
mockClient.EXPECT().SessionCreate(gomock.Any(), gomock.Any()).DoAndReturn(func(_, _ interface{}) (*ResCreateSession, error) {
|
mockClient.EXPECT().sessionCreate(gomock.Any(), gomock.Any()).DoAndReturn(func(_, _ interface{}) (*resCreateSession, error) {
|
||||||
tok := session.NewToken()
|
tok := session.NewToken()
|
||||||
uid, err := uuid.New().MarshalBinary()
|
uid, err := uuid.New().MarshalBinary()
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
tok.SetID(uid)
|
tok.SetID(uid)
|
||||||
tokens = append(tokens, tok)
|
tokens = append(tokens, tok)
|
||||||
return &ResCreateSession{
|
return &resCreateSession{
|
||||||
id: tok.ID(),
|
id: tok.ID(),
|
||||||
sessionKey: tok.SessionKey(),
|
sessionKey: tok.SessionKey(),
|
||||||
}, err
|
}, err
|
||||||
})
|
})
|
||||||
mockClient.EXPECT().EndpointInfo(gomock.Any(), gomock.Any()).Return(&netmap.NodeInfo{}, nil).AnyTimes()
|
mockClient.EXPECT().endpointInfo(gomock.Any(), gomock.Any()).Return(&netmap.NodeInfo{}, nil).AnyTimes()
|
||||||
mockClient.EXPECT().NetworkInfo(gomock.Any(), gomock.Any()).Return(&netmap.NetworkInfo{}, nil).AnyTimes()
|
mockClient.EXPECT().networkInfo(gomock.Any(), gomock.Any()).Return(&netmap.NetworkInfo{}, nil).AnyTimes()
|
||||||
return mockClient, nil
|
return mockClient, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -261,30 +260,30 @@ func TestOneOfTwoFailed(t *testing.T) {
|
||||||
clientBuilder := func(_ string) (client, error) {
|
clientBuilder := func(_ string) (client, error) {
|
||||||
clientCount++
|
clientCount++
|
||||||
mockClient := NewMockClient(ctrl)
|
mockClient := NewMockClient(ctrl)
|
||||||
mockClient.EXPECT().SessionCreate(gomock.Any(), gomock.Any()).DoAndReturn(func(_, _ interface{}) (*ResCreateSession, error) {
|
mockClient.EXPECT().sessionCreate(gomock.Any(), gomock.Any()).DoAndReturn(func(_, _ interface{}) (*resCreateSession, error) {
|
||||||
tok := newToken(t)
|
tok := newToken(t)
|
||||||
tokens = append(tokens, tok)
|
tokens = append(tokens, tok)
|
||||||
return &ResCreateSession{
|
return &resCreateSession{
|
||||||
id: tok.ID(),
|
id: tok.ID(),
|
||||||
sessionKey: tok.SessionKey(),
|
sessionKey: tok.SessionKey(),
|
||||||
}, nil
|
}, nil
|
||||||
}).AnyTimes()
|
}).AnyTimes()
|
||||||
mockClient.EXPECT().EndpointInfo(gomock.Any(), gomock.Any()).Return(nil, nil).AnyTimes()
|
mockClient.EXPECT().endpointInfo(gomock.Any(), gomock.Any()).Return(nil, nil).AnyTimes()
|
||||||
mockClient.EXPECT().NetworkInfo(gomock.Any(), gomock.Any()).Return(&netmap.NetworkInfo{}, nil).AnyTimes()
|
mockClient.EXPECT().networkInfo(gomock.Any(), gomock.Any()).Return(&netmap.NetworkInfo{}, nil).AnyTimes()
|
||||||
|
|
||||||
mockClient2 := NewMockClient(ctrl2)
|
mockClient2 := NewMockClient(ctrl2)
|
||||||
mockClient2.EXPECT().SessionCreate(gomock.Any(), gomock.Any()).DoAndReturn(func(_, _ interface{}) (*ResCreateSession, error) {
|
mockClient2.EXPECT().sessionCreate(gomock.Any(), gomock.Any()).DoAndReturn(func(_, _ interface{}) (*resCreateSession, error) {
|
||||||
tok := newToken(t)
|
tok := newToken(t)
|
||||||
tokens = append(tokens, tok)
|
tokens = append(tokens, tok)
|
||||||
return &ResCreateSession{
|
return &resCreateSession{
|
||||||
id: tok.ID(),
|
id: tok.ID(),
|
||||||
sessionKey: tok.SessionKey(),
|
sessionKey: tok.SessionKey(),
|
||||||
}, nil
|
}, nil
|
||||||
}).AnyTimes()
|
}).AnyTimes()
|
||||||
mockClient2.EXPECT().EndpointInfo(gomock.Any(), gomock.Any()).DoAndReturn(func(_ interface{}, _ ...interface{}) (*netmap.NodeInfo, error) {
|
mockClient2.EXPECT().endpointInfo(gomock.Any(), gomock.Any()).DoAndReturn(func(_ interface{}, _ ...interface{}) (*netmap.NodeInfo, error) {
|
||||||
return nil, fmt.Errorf("error")
|
return nil, fmt.Errorf("error")
|
||||||
}).AnyTimes()
|
}).AnyTimes()
|
||||||
mockClient2.EXPECT().NetworkInfo(gomock.Any(), gomock.Any()).DoAndReturn(func(_ interface{}, _ ...interface{}) (*netmap.NetworkInfo, error) {
|
mockClient2.EXPECT().networkInfo(gomock.Any(), gomock.Any()).DoAndReturn(func(_ interface{}, _ ...interface{}) (*netmap.NetworkInfo, error) {
|
||||||
return nil, fmt.Errorf("error")
|
return nil, fmt.Errorf("error")
|
||||||
}).AnyTimes()
|
}).AnyTimes()
|
||||||
|
|
||||||
|
@ -327,9 +326,9 @@ func TestTwoFailed(t *testing.T) {
|
||||||
|
|
||||||
clientBuilder := func(_ string) (client, error) {
|
clientBuilder := func(_ string) (client, error) {
|
||||||
mockClient := NewMockClient(ctrl)
|
mockClient := NewMockClient(ctrl)
|
||||||
mockClient.EXPECT().SessionCreate(gomock.Any(), gomock.Any()).Return(&ResCreateSession{}, nil).AnyTimes()
|
mockClient.EXPECT().sessionCreate(gomock.Any(), gomock.Any()).Return(&resCreateSession{}, nil).AnyTimes()
|
||||||
mockClient.EXPECT().EndpointInfo(gomock.Any(), gomock.Any()).Return(nil, fmt.Errorf("error")).AnyTimes()
|
mockClient.EXPECT().endpointInfo(gomock.Any(), gomock.Any()).Return(nil, fmt.Errorf("error")).AnyTimes()
|
||||||
mockClient.EXPECT().NetworkInfo(gomock.Any(), gomock.Any()).Return(&netmap.NetworkInfo{}, nil).AnyTimes()
|
mockClient.EXPECT().networkInfo(gomock.Any(), gomock.Any()).Return(&netmap.NetworkInfo{}, nil).AnyTimes()
|
||||||
return mockClient, nil
|
return mockClient, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -363,21 +362,21 @@ func TestSessionCache(t *testing.T) {
|
||||||
var tokens []*session.Token
|
var tokens []*session.Token
|
||||||
clientBuilder := func(_ string) (client, error) {
|
clientBuilder := func(_ string) (client, error) {
|
||||||
mockClient := NewMockClient(ctrl)
|
mockClient := NewMockClient(ctrl)
|
||||||
mockClient.EXPECT().SessionCreate(gomock.Any(), gomock.Any()).DoAndReturn(func(_, _ interface{}, _ ...interface{}) (*ResCreateSession, error) {
|
mockClient.EXPECT().sessionCreate(gomock.Any(), gomock.Any()).DoAndReturn(func(_, _ interface{}, _ ...interface{}) (*resCreateSession, error) {
|
||||||
tok := session.NewToken()
|
tok := session.NewToken()
|
||||||
uid, err := uuid.New().MarshalBinary()
|
uid, err := uuid.New().MarshalBinary()
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
tok.SetID(uid)
|
tok.SetID(uid)
|
||||||
tokens = append(tokens, tok)
|
tokens = append(tokens, tok)
|
||||||
return &ResCreateSession{
|
return &resCreateSession{
|
||||||
id: tok.ID(),
|
id: tok.ID(),
|
||||||
sessionKey: tok.SessionKey(),
|
sessionKey: tok.SessionKey(),
|
||||||
}, err
|
}, err
|
||||||
}).MaxTimes(3)
|
}).MaxTimes(3)
|
||||||
mockClient.EXPECT().NetworkInfo(gomock.Any(), gomock.Any()).Return(&netmap.NetworkInfo{}, nil).AnyTimes()
|
mockClient.EXPECT().networkInfo(gomock.Any(), gomock.Any()).Return(&netmap.NetworkInfo{}, nil).AnyTimes()
|
||||||
|
|
||||||
mockClient.EXPECT().ObjectGet(gomock.Any(), gomock.Any()).Return(nil, fmt.Errorf("session token does not exist"))
|
mockClient.EXPECT().objectGet(gomock.Any(), gomock.Any()).Return(nil, fmt.Errorf("session token does not exist"))
|
||||||
mockClient.EXPECT().ObjectPut(gomock.Any(), gomock.Any()).Return(nil, nil)
|
mockClient.EXPECT().objectPut(gomock.Any(), gomock.Any()).Return(nil, nil)
|
||||||
|
|
||||||
return mockClient, nil
|
return mockClient, nil
|
||||||
}
|
}
|
||||||
|
@ -439,28 +438,28 @@ func TestPriority(t *testing.T) {
|
||||||
tokens := make([]*session.Token, 2)
|
tokens := make([]*session.Token, 2)
|
||||||
clientBuilder := func(endpoint string) (client, error) {
|
clientBuilder := func(endpoint string) (client, error) {
|
||||||
mockClient := NewMockClient(ctrl)
|
mockClient := NewMockClient(ctrl)
|
||||||
mockClient.EXPECT().SessionCreate(gomock.Any(), gomock.Any()).DoAndReturn(func(_, _ interface{}) (*ResCreateSession, error) {
|
mockClient.EXPECT().sessionCreate(gomock.Any(), gomock.Any()).DoAndReturn(func(_, _ interface{}) (*resCreateSession, error) {
|
||||||
tok := newToken(t)
|
tok := newToken(t)
|
||||||
tokens[0] = tok
|
tokens[0] = tok
|
||||||
return &ResCreateSession{
|
return &resCreateSession{
|
||||||
id: tok.ID(),
|
id: tok.ID(),
|
||||||
sessionKey: tok.SessionKey(),
|
sessionKey: tok.SessionKey(),
|
||||||
}, nil
|
}, nil
|
||||||
}).AnyTimes()
|
}).AnyTimes()
|
||||||
mockClient.EXPECT().EndpointInfo(gomock.Any(), gomock.Any()).Return(nil, fmt.Errorf("error")).AnyTimes()
|
mockClient.EXPECT().endpointInfo(gomock.Any(), gomock.Any()).Return(nil, fmt.Errorf("error")).AnyTimes()
|
||||||
mockClient.EXPECT().NetworkInfo(gomock.Any(), gomock.Any()).Return(&netmap.NetworkInfo{}, nil).AnyTimes()
|
mockClient.EXPECT().networkInfo(gomock.Any(), gomock.Any()).Return(&netmap.NetworkInfo{}, nil).AnyTimes()
|
||||||
|
|
||||||
mockClient2 := NewMockClient(ctrl2)
|
mockClient2 := NewMockClient(ctrl2)
|
||||||
mockClient2.EXPECT().SessionCreate(gomock.Any(), gomock.Any()).DoAndReturn(func(_, _ interface{}) (*ResCreateSession, error) {
|
mockClient2.EXPECT().sessionCreate(gomock.Any(), gomock.Any()).DoAndReturn(func(_, _ interface{}) (*resCreateSession, error) {
|
||||||
tok := newToken(t)
|
tok := newToken(t)
|
||||||
tokens[1] = tok
|
tokens[1] = tok
|
||||||
return &ResCreateSession{
|
return &resCreateSession{
|
||||||
id: tok.ID(),
|
id: tok.ID(),
|
||||||
sessionKey: tok.SessionKey(),
|
sessionKey: tok.SessionKey(),
|
||||||
}, nil
|
}, nil
|
||||||
}).AnyTimes()
|
}).AnyTimes()
|
||||||
mockClient2.EXPECT().EndpointInfo(gomock.Any(), gomock.Any()).Return(&netmap.NodeInfo{}, nil).AnyTimes()
|
mockClient2.EXPECT().endpointInfo(gomock.Any(), gomock.Any()).Return(&netmap.NodeInfo{}, nil).AnyTimes()
|
||||||
mockClient2.EXPECT().NetworkInfo(gomock.Any(), gomock.Any()).Return(&netmap.NetworkInfo{}, nil).AnyTimes()
|
mockClient2.EXPECT().networkInfo(gomock.Any(), gomock.Any()).Return(&netmap.NetworkInfo{}, nil).AnyTimes()
|
||||||
|
|
||||||
if endpoint == "peer0" {
|
if endpoint == "peer0" {
|
||||||
return mockClient, nil
|
return mockClient, nil
|
||||||
|
@ -511,20 +510,20 @@ func TestSessionCacheWithKey(t *testing.T) {
|
||||||
var tokens []*session.Token
|
var tokens []*session.Token
|
||||||
clientBuilder := func(_ string) (client, error) {
|
clientBuilder := func(_ string) (client, error) {
|
||||||
mockClient := NewMockClient(ctrl)
|
mockClient := NewMockClient(ctrl)
|
||||||
mockClient.EXPECT().SessionCreate(gomock.Any(), gomock.Any()).DoAndReturn(func(_, _ interface{}) (*ResCreateSession, error) {
|
mockClient.EXPECT().sessionCreate(gomock.Any(), gomock.Any()).DoAndReturn(func(_, _ interface{}) (*resCreateSession, error) {
|
||||||
tok := session.NewToken()
|
tok := session.NewToken()
|
||||||
uid, err := uuid.New().MarshalBinary()
|
uid, err := uuid.New().MarshalBinary()
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
tok.SetID(uid)
|
tok.SetID(uid)
|
||||||
tokens = append(tokens, tok)
|
tokens = append(tokens, tok)
|
||||||
return &ResCreateSession{
|
return &resCreateSession{
|
||||||
id: tok.ID(),
|
id: tok.ID(),
|
||||||
sessionKey: tok.SessionKey(),
|
sessionKey: tok.SessionKey(),
|
||||||
}, err
|
}, err
|
||||||
}).MaxTimes(2)
|
}).MaxTimes(2)
|
||||||
|
|
||||||
mockClient.EXPECT().NetworkInfo(gomock.Any(), gomock.Any()).Return(&netmap.NetworkInfo{}, nil).AnyTimes()
|
mockClient.EXPECT().networkInfo(gomock.Any(), gomock.Any()).Return(&netmap.NetworkInfo{}, nil).AnyTimes()
|
||||||
mockClient.EXPECT().ObjectGet(gomock.Any(), gomock.Any()).Return(nil, nil)
|
mockClient.EXPECT().objectGet(gomock.Any(), gomock.Any()).Return(nil, nil)
|
||||||
|
|
||||||
return mockClient, nil
|
return mockClient, nil
|
||||||
}
|
}
|
||||||
|
@ -576,9 +575,9 @@ func TestSessionTokenOwner(t *testing.T) {
|
||||||
ctrl := gomock.NewController(t)
|
ctrl := gomock.NewController(t)
|
||||||
clientBuilder := func(_ string) (client, error) {
|
clientBuilder := func(_ string) (client, error) {
|
||||||
mockClient := NewMockClient(ctrl)
|
mockClient := NewMockClient(ctrl)
|
||||||
mockClient.EXPECT().SessionCreate(gomock.Any(), gomock.Any()).Return(&ResCreateSession{}, nil).AnyTimes()
|
mockClient.EXPECT().sessionCreate(gomock.Any(), gomock.Any()).Return(&resCreateSession{}, nil).AnyTimes()
|
||||||
mockClient.EXPECT().EndpointInfo(gomock.Any(), gomock.Any()).Return(&netmap.NodeInfo{}, nil).AnyTimes()
|
mockClient.EXPECT().endpointInfo(gomock.Any(), gomock.Any()).Return(&netmap.NodeInfo{}, nil).AnyTimes()
|
||||||
mockClient.EXPECT().NetworkInfo(gomock.Any(), gomock.Any()).Return(&netmap.NetworkInfo{}, nil).AnyTimes()
|
mockClient.EXPECT().networkInfo(gomock.Any(), gomock.Any()).Return(&netmap.NetworkInfo{}, nil).AnyTimes()
|
||||||
return mockClient, nil
|
return mockClient, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -624,10 +623,10 @@ func TestWaitPresence(t *testing.T) {
|
||||||
ctrl := gomock.NewController(t)
|
ctrl := gomock.NewController(t)
|
||||||
|
|
||||||
mockClient := NewMockClient(ctrl)
|
mockClient := NewMockClient(ctrl)
|
||||||
mockClient.EXPECT().SessionCreate(gomock.Any(), gomock.Any()).Return(nil, nil).AnyTimes()
|
mockClient.EXPECT().sessionCreate(gomock.Any(), gomock.Any()).Return(nil, nil).AnyTimes()
|
||||||
mockClient.EXPECT().EndpointInfo(gomock.Any(), gomock.Any()).Return(nil, nil).AnyTimes()
|
mockClient.EXPECT().endpointInfo(gomock.Any(), gomock.Any()).Return(nil, nil).AnyTimes()
|
||||||
mockClient.EXPECT().NetworkInfo(gomock.Any(), gomock.Any()).Return(&netmap.NetworkInfo{}, nil).AnyTimes()
|
mockClient.EXPECT().networkInfo(gomock.Any(), gomock.Any()).Return(&netmap.NetworkInfo{}, nil).AnyTimes()
|
||||||
mockClient.EXPECT().ContainerGet(gomock.Any(), gomock.Any()).Return(&container.Container{}, nil).AnyTimes()
|
mockClient.EXPECT().containerGet(gomock.Any(), gomock.Any()).Return(&container.Container{}, nil).AnyTimes()
|
||||||
|
|
||||||
cache, err := newCache()
|
cache, err := newCache()
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
|
@ -48,11 +48,11 @@ type clientMock struct {
|
||||||
err error
|
err error
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *clientMock) EndpointInfo(context.Context, PrmEndpointInfo) (*netmap.NodeInfo, error) {
|
func (c *clientMock) endpointInfo(context.Context, prmEndpointInfo) (*netmap.NodeInfo, error) {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *clientMock) NetworkInfo(context.Context, PrmNetworkInfo) (*netmap.NetworkInfo, error) {
|
func (c *clientMock) networkInfo(context.Context, prmNetworkInfo) (*netmap.NetworkInfo, error) {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue