1
0
Fork 0
mirror of https://github.com/anyproto/anytype-heart.git synced 2025-06-10 01:51:07 +09:00

GO-3504 Merge branch 'main' into go-3504-links-resolver-mvp

This commit is contained in:
kirillston 2024-06-25 15:32:44 +02:00
commit 948de868eb
No known key found for this signature in database
GPG key ID: 88218A7F1109754B
4 changed files with 19 additions and 714 deletions

View file

@ -14,21 +14,23 @@ jobs:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v1
- uses: actions/setup-go@v5
with:
go-version: 1.22 #// doesn't work with 20
go-version: 1.22
cache: false
env:
GOPRIVATE: "github.com/anyproto"
- name: git config
run: git config --global url.https://${{ secrets.ANYTYPE_PAT }}@github.com/.insteadOf https://github.com/
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Go get
run: go get ./...
- name: golangci-lint
uses: golangci/golangci-lint-action@v3.7.0
uses: golangci/golangci-lint-action@v6
with:
skip-cache: true
version: latest
only-new-issues: true
args: --timeout 25m --skip-files ".*_test.go" --skip-files "testMock/*" --verbose
args: --timeout 25m --verbose

View file

@ -4,10 +4,16 @@ run:
# didn't run linter on tests
tests: false
# don't check generated protobuf files
skip-dirs:
- pkg/lib/pb
go: '1.22'
issues:
exclude-generated: disable
exclude-dirs:
- pkg/lib/pb
exclude-files:
- '.*_test.go'
- 'testMock/*'
linters-settings:
unused:
field-writes-are-uses: false

View file

@ -317,14 +317,14 @@ install-linter:
run-linter:
ifdef GOLANGCI_LINT_BRANCH
@golangci-lint run -v ./... --new-from-rev=$(GOLANGCI_LINT_BRANCH) --skip-files ".*_test.go" --skip-files "testMock/*" --timeout 15m --verbose
@golangci-lint run -v ./... --new-from-rev=$(GOLANGCI_LINT_BRANCH) --timeout 15m --verbose
else
@golangci-lint run -v ./... --new-from-rev=origin/main --skip-files ".*_test.go" --skip-files "testMock/*" --timeout 15m --verbose
@golangci-lint run -v ./... --new-from-rev=origin/main --timeout 15m --verbose
endif
run-linter-fix:
ifdef GOLANGCI_LINT_BRANCH
@golangci-lint run -v ./... --new-from-rev=$(GOLANGCI_LINT_BRANCH) --skip-files ".*_test.go" --skip-files "testMock/*" --timeout 15m --fix
@golangci-lint run -v ./... --new-from-rev=$(GOLANGCI_LINT_BRANCH) --timeout 15m --fix
else
@golangci-lint run -v ./... --new-from-rev=origin/main --skip-files ".*_test.go" --skip-files "testMock/*" --timeout 15m --fix
@golangci-lint run -v ./... --new-from-rev=origin/main --timeout 15m --fix
endif

View file

@ -1,703 +0,0 @@
// Code generated by mockery. DO NOT EDIT.
package mock_rpcstore
import (
blocks "github.com/ipfs/go-block-format"
cid "github.com/ipfs/go-cid"
context "context"
domain "github.com/anyproto/anytype-heart/core/domain"
fileproto "github.com/anyproto/any-sync/commonfile/fileproto"
mock "github.com/stretchr/testify/mock"
)
// MockRpcStore is an autogenerated mock type for the RpcStore type
type MockRpcStore struct {
mock.Mock
}
type MockRpcStore_Expecter struct {
mock *mock.Mock
}
func (_m *MockRpcStore) EXPECT() *MockRpcStore_Expecter {
return &MockRpcStore_Expecter{mock: &_m.Mock}
}
// AccountInfo provides a mock function with given fields: ctx
func (_m *MockRpcStore) AccountInfo(ctx context.Context) (*fileproto.AccountInfoResponse, error) {
ret := _m.Called(ctx)
if len(ret) == 0 {
panic("no return value specified for AccountInfo")
}
var r0 *fileproto.AccountInfoResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context) (*fileproto.AccountInfoResponse, error)); ok {
return rf(ctx)
}
if rf, ok := ret.Get(0).(func(context.Context) *fileproto.AccountInfoResponse); ok {
r0 = rf(ctx)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*fileproto.AccountInfoResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context) error); ok {
r1 = rf(ctx)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockRpcStore_AccountInfo_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AccountInfo'
type MockRpcStore_AccountInfo_Call struct {
*mock.Call
}
// AccountInfo is a helper method to define mock.On call
// - ctx context.Context
func (_e *MockRpcStore_Expecter) AccountInfo(ctx interface{}) *MockRpcStore_AccountInfo_Call {
return &MockRpcStore_AccountInfo_Call{Call: _e.mock.On("AccountInfo", ctx)}
}
func (_c *MockRpcStore_AccountInfo_Call) Run(run func(ctx context.Context)) *MockRpcStore_AccountInfo_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context))
})
return _c
}
func (_c *MockRpcStore_AccountInfo_Call) Return(info *fileproto.AccountInfoResponse, err error) *MockRpcStore_AccountInfo_Call {
_c.Call.Return(info, err)
return _c
}
func (_c *MockRpcStore_AccountInfo_Call) RunAndReturn(run func(context.Context) (*fileproto.AccountInfoResponse, error)) *MockRpcStore_AccountInfo_Call {
_c.Call.Return(run)
return _c
}
// Add provides a mock function with given fields: ctx, b
func (_m *MockRpcStore) Add(ctx context.Context, b []blocks.Block) error {
ret := _m.Called(ctx, b)
if len(ret) == 0 {
panic("no return value specified for Add")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, []blocks.Block) error); ok {
r0 = rf(ctx, b)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockRpcStore_Add_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Add'
type MockRpcStore_Add_Call struct {
*mock.Call
}
// Add is a helper method to define mock.On call
// - ctx context.Context
// - b []blocks.Block
func (_e *MockRpcStore_Expecter) Add(ctx interface{}, b interface{}) *MockRpcStore_Add_Call {
return &MockRpcStore_Add_Call{Call: _e.mock.On("Add", ctx, b)}
}
func (_c *MockRpcStore_Add_Call) Run(run func(ctx context.Context, b []blocks.Block)) *MockRpcStore_Add_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].([]blocks.Block))
})
return _c
}
func (_c *MockRpcStore_Add_Call) Return(_a0 error) *MockRpcStore_Add_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockRpcStore_Add_Call) RunAndReturn(run func(context.Context, []blocks.Block) error) *MockRpcStore_Add_Call {
_c.Call.Return(run)
return _c
}
// AddToFile provides a mock function with given fields: ctx, spaceId, fileId, bs
func (_m *MockRpcStore) AddToFile(ctx context.Context, spaceId string, fileId domain.FileId, bs []blocks.Block) error {
ret := _m.Called(ctx, spaceId, fileId, bs)
if len(ret) == 0 {
panic("no return value specified for AddToFile")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, string, domain.FileId, []blocks.Block) error); ok {
r0 = rf(ctx, spaceId, fileId, bs)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockRpcStore_AddToFile_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddToFile'
type MockRpcStore_AddToFile_Call struct {
*mock.Call
}
// AddToFile is a helper method to define mock.On call
// - ctx context.Context
// - spaceId string
// - fileId domain.FileId
// - bs []blocks.Block
func (_e *MockRpcStore_Expecter) AddToFile(ctx interface{}, spaceId interface{}, fileId interface{}, bs interface{}) *MockRpcStore_AddToFile_Call {
return &MockRpcStore_AddToFile_Call{Call: _e.mock.On("AddToFile", ctx, spaceId, fileId, bs)}
}
func (_c *MockRpcStore_AddToFile_Call) Run(run func(ctx context.Context, spaceId string, fileId domain.FileId, bs []blocks.Block)) *MockRpcStore_AddToFile_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string), args[2].(domain.FileId), args[3].([]blocks.Block))
})
return _c
}
func (_c *MockRpcStore_AddToFile_Call) Return(err error) *MockRpcStore_AddToFile_Call {
_c.Call.Return(err)
return _c
}
func (_c *MockRpcStore_AddToFile_Call) RunAndReturn(run func(context.Context, string, domain.FileId, []blocks.Block) error) *MockRpcStore_AddToFile_Call {
_c.Call.Return(run)
return _c
}
// BindCids provides a mock function with given fields: ctx, spaceID, fileId, cids
func (_m *MockRpcStore) BindCids(ctx context.Context, spaceID string, fileId domain.FileId, cids []cid.Cid) error {
ret := _m.Called(ctx, spaceID, fileId, cids)
if len(ret) == 0 {
panic("no return value specified for BindCids")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, string, domain.FileId, []cid.Cid) error); ok {
r0 = rf(ctx, spaceID, fileId, cids)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockRpcStore_BindCids_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'BindCids'
type MockRpcStore_BindCids_Call struct {
*mock.Call
}
// BindCids is a helper method to define mock.On call
// - ctx context.Context
// - spaceID string
// - fileId domain.FileId
// - cids []cid.Cid
func (_e *MockRpcStore_Expecter) BindCids(ctx interface{}, spaceID interface{}, fileId interface{}, cids interface{}) *MockRpcStore_BindCids_Call {
return &MockRpcStore_BindCids_Call{Call: _e.mock.On("BindCids", ctx, spaceID, fileId, cids)}
}
func (_c *MockRpcStore_BindCids_Call) Run(run func(ctx context.Context, spaceID string, fileId domain.FileId, cids []cid.Cid)) *MockRpcStore_BindCids_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string), args[2].(domain.FileId), args[3].([]cid.Cid))
})
return _c
}
func (_c *MockRpcStore_BindCids_Call) Return(err error) *MockRpcStore_BindCids_Call {
_c.Call.Return(err)
return _c
}
func (_c *MockRpcStore_BindCids_Call) RunAndReturn(run func(context.Context, string, domain.FileId, []cid.Cid) error) *MockRpcStore_BindCids_Call {
_c.Call.Return(run)
return _c
}
// CheckAvailability provides a mock function with given fields: ctx, spaceID, cids
func (_m *MockRpcStore) CheckAvailability(ctx context.Context, spaceID string, cids []cid.Cid) ([]*fileproto.BlockAvailability, error) {
ret := _m.Called(ctx, spaceID, cids)
if len(ret) == 0 {
panic("no return value specified for CheckAvailability")
}
var r0 []*fileproto.BlockAvailability
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, string, []cid.Cid) ([]*fileproto.BlockAvailability, error)); ok {
return rf(ctx, spaceID, cids)
}
if rf, ok := ret.Get(0).(func(context.Context, string, []cid.Cid) []*fileproto.BlockAvailability); ok {
r0 = rf(ctx, spaceID, cids)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*fileproto.BlockAvailability)
}
}
if rf, ok := ret.Get(1).(func(context.Context, string, []cid.Cid) error); ok {
r1 = rf(ctx, spaceID, cids)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockRpcStore_CheckAvailability_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CheckAvailability'
type MockRpcStore_CheckAvailability_Call struct {
*mock.Call
}
// CheckAvailability is a helper method to define mock.On call
// - ctx context.Context
// - spaceID string
// - cids []cid.Cid
func (_e *MockRpcStore_Expecter) CheckAvailability(ctx interface{}, spaceID interface{}, cids interface{}) *MockRpcStore_CheckAvailability_Call {
return &MockRpcStore_CheckAvailability_Call{Call: _e.mock.On("CheckAvailability", ctx, spaceID, cids)}
}
func (_c *MockRpcStore_CheckAvailability_Call) Run(run func(ctx context.Context, spaceID string, cids []cid.Cid)) *MockRpcStore_CheckAvailability_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string), args[2].([]cid.Cid))
})
return _c
}
func (_c *MockRpcStore_CheckAvailability_Call) Return(checkResult []*fileproto.BlockAvailability, err error) *MockRpcStore_CheckAvailability_Call {
_c.Call.Return(checkResult, err)
return _c
}
func (_c *MockRpcStore_CheckAvailability_Call) RunAndReturn(run func(context.Context, string, []cid.Cid) ([]*fileproto.BlockAvailability, error)) *MockRpcStore_CheckAvailability_Call {
_c.Call.Return(run)
return _c
}
// Delete provides a mock function with given fields: ctx, c
func (_m *MockRpcStore) Delete(ctx context.Context, c cid.Cid) error {
ret := _m.Called(ctx, c)
if len(ret) == 0 {
panic("no return value specified for Delete")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, cid.Cid) error); ok {
r0 = rf(ctx, c)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockRpcStore_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete'
type MockRpcStore_Delete_Call struct {
*mock.Call
}
// Delete is a helper method to define mock.On call
// - ctx context.Context
// - c cid.Cid
func (_e *MockRpcStore_Expecter) Delete(ctx interface{}, c interface{}) *MockRpcStore_Delete_Call {
return &MockRpcStore_Delete_Call{Call: _e.mock.On("Delete", ctx, c)}
}
func (_c *MockRpcStore_Delete_Call) Run(run func(ctx context.Context, c cid.Cid)) *MockRpcStore_Delete_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(cid.Cid))
})
return _c
}
func (_c *MockRpcStore_Delete_Call) Return(_a0 error) *MockRpcStore_Delete_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockRpcStore_Delete_Call) RunAndReturn(run func(context.Context, cid.Cid) error) *MockRpcStore_Delete_Call {
_c.Call.Return(run)
return _c
}
// DeleteFiles provides a mock function with given fields: ctx, spaceId, fileIds
func (_m *MockRpcStore) DeleteFiles(ctx context.Context, spaceId string, fileIds ...domain.FileId) error {
_va := make([]interface{}, len(fileIds))
for _i := range fileIds {
_va[_i] = fileIds[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, spaceId)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for DeleteFiles")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, string, ...domain.FileId) error); ok {
r0 = rf(ctx, spaceId, fileIds...)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockRpcStore_DeleteFiles_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteFiles'
type MockRpcStore_DeleteFiles_Call struct {
*mock.Call
}
// DeleteFiles is a helper method to define mock.On call
// - ctx context.Context
// - spaceId string
// - fileIds ...domain.FileId
func (_e *MockRpcStore_Expecter) DeleteFiles(ctx interface{}, spaceId interface{}, fileIds ...interface{}) *MockRpcStore_DeleteFiles_Call {
return &MockRpcStore_DeleteFiles_Call{Call: _e.mock.On("DeleteFiles",
append([]interface{}{ctx, spaceId}, fileIds...)...)}
}
func (_c *MockRpcStore_DeleteFiles_Call) Run(run func(ctx context.Context, spaceId string, fileIds ...domain.FileId)) *MockRpcStore_DeleteFiles_Call {
_c.Call.Run(func(args mock.Arguments) {
variadicArgs := make([]domain.FileId, len(args)-2)
for i, a := range args[2:] {
if a != nil {
variadicArgs[i] = a.(domain.FileId)
}
}
run(args[0].(context.Context), args[1].(string), variadicArgs...)
})
return _c
}
func (_c *MockRpcStore_DeleteFiles_Call) Return(err error) *MockRpcStore_DeleteFiles_Call {
_c.Call.Return(err)
return _c
}
func (_c *MockRpcStore_DeleteFiles_Call) RunAndReturn(run func(context.Context, string, ...domain.FileId) error) *MockRpcStore_DeleteFiles_Call {
_c.Call.Return(run)
return _c
}
// FilesInfo provides a mock function with given fields: ctx, spaceId, fileIds
func (_m *MockRpcStore) FilesInfo(ctx context.Context, spaceId string, fileIds ...domain.FileId) ([]*fileproto.FileInfo, error) {
_va := make([]interface{}, len(fileIds))
for _i := range fileIds {
_va[_i] = fileIds[_i]
}
var _ca []interface{}
_ca = append(_ca, ctx, spaceId)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for FilesInfo")
}
var r0 []*fileproto.FileInfo
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, string, ...domain.FileId) ([]*fileproto.FileInfo, error)); ok {
return rf(ctx, spaceId, fileIds...)
}
if rf, ok := ret.Get(0).(func(context.Context, string, ...domain.FileId) []*fileproto.FileInfo); ok {
r0 = rf(ctx, spaceId, fileIds...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*fileproto.FileInfo)
}
}
if rf, ok := ret.Get(1).(func(context.Context, string, ...domain.FileId) error); ok {
r1 = rf(ctx, spaceId, fileIds...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockRpcStore_FilesInfo_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FilesInfo'
type MockRpcStore_FilesInfo_Call struct {
*mock.Call
}
// FilesInfo is a helper method to define mock.On call
// - ctx context.Context
// - spaceId string
// - fileIds ...domain.FileId
func (_e *MockRpcStore_Expecter) FilesInfo(ctx interface{}, spaceId interface{}, fileIds ...interface{}) *MockRpcStore_FilesInfo_Call {
return &MockRpcStore_FilesInfo_Call{Call: _e.mock.On("FilesInfo",
append([]interface{}{ctx, spaceId}, fileIds...)...)}
}
func (_c *MockRpcStore_FilesInfo_Call) Run(run func(ctx context.Context, spaceId string, fileIds ...domain.FileId)) *MockRpcStore_FilesInfo_Call {
_c.Call.Run(func(args mock.Arguments) {
variadicArgs := make([]domain.FileId, len(args)-2)
for i, a := range args[2:] {
if a != nil {
variadicArgs[i] = a.(domain.FileId)
}
}
run(args[0].(context.Context), args[1].(string), variadicArgs...)
})
return _c
}
func (_c *MockRpcStore_FilesInfo_Call) Return(_a0 []*fileproto.FileInfo, _a1 error) *MockRpcStore_FilesInfo_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockRpcStore_FilesInfo_Call) RunAndReturn(run func(context.Context, string, ...domain.FileId) ([]*fileproto.FileInfo, error)) *MockRpcStore_FilesInfo_Call {
_c.Call.Return(run)
return _c
}
// Get provides a mock function with given fields: ctx, k
func (_m *MockRpcStore) Get(ctx context.Context, k cid.Cid) (blocks.Block, error) {
ret := _m.Called(ctx, k)
if len(ret) == 0 {
panic("no return value specified for Get")
}
var r0 blocks.Block
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, cid.Cid) (blocks.Block, error)); ok {
return rf(ctx, k)
}
if rf, ok := ret.Get(0).(func(context.Context, cid.Cid) blocks.Block); ok {
r0 = rf(ctx, k)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(blocks.Block)
}
}
if rf, ok := ret.Get(1).(func(context.Context, cid.Cid) error); ok {
r1 = rf(ctx, k)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockRpcStore_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get'
type MockRpcStore_Get_Call struct {
*mock.Call
}
// Get is a helper method to define mock.On call
// - ctx context.Context
// - k cid.Cid
func (_e *MockRpcStore_Expecter) Get(ctx interface{}, k interface{}) *MockRpcStore_Get_Call {
return &MockRpcStore_Get_Call{Call: _e.mock.On("Get", ctx, k)}
}
func (_c *MockRpcStore_Get_Call) Run(run func(ctx context.Context, k cid.Cid)) *MockRpcStore_Get_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(cid.Cid))
})
return _c
}
func (_c *MockRpcStore_Get_Call) Return(_a0 blocks.Block, _a1 error) *MockRpcStore_Get_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockRpcStore_Get_Call) RunAndReturn(run func(context.Context, cid.Cid) (blocks.Block, error)) *MockRpcStore_Get_Call {
_c.Call.Return(run)
return _c
}
// GetMany provides a mock function with given fields: ctx, ks
func (_m *MockRpcStore) GetMany(ctx context.Context, ks []cid.Cid) <-chan blocks.Block {
ret := _m.Called(ctx, ks)
if len(ret) == 0 {
panic("no return value specified for GetMany")
}
var r0 <-chan blocks.Block
if rf, ok := ret.Get(0).(func(context.Context, []cid.Cid) <-chan blocks.Block); ok {
r0 = rf(ctx, ks)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(<-chan blocks.Block)
}
}
return r0
}
// MockRpcStore_GetMany_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetMany'
type MockRpcStore_GetMany_Call struct {
*mock.Call
}
// GetMany is a helper method to define mock.On call
// - ctx context.Context
// - ks []cid.Cid
func (_e *MockRpcStore_Expecter) GetMany(ctx interface{}, ks interface{}) *MockRpcStore_GetMany_Call {
return &MockRpcStore_GetMany_Call{Call: _e.mock.On("GetMany", ctx, ks)}
}
func (_c *MockRpcStore_GetMany_Call) Run(run func(ctx context.Context, ks []cid.Cid)) *MockRpcStore_GetMany_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].([]cid.Cid))
})
return _c
}
func (_c *MockRpcStore_GetMany_Call) Return(_a0 <-chan blocks.Block) *MockRpcStore_GetMany_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockRpcStore_GetMany_Call) RunAndReturn(run func(context.Context, []cid.Cid) <-chan blocks.Block) *MockRpcStore_GetMany_Call {
_c.Call.Return(run)
return _c
}
// IterateFiles provides a mock function with given fields: ctx, iterFunc
func (_m *MockRpcStore) IterateFiles(ctx context.Context, iterFunc func(domain.FullFileId)) error {
ret := _m.Called(ctx, iterFunc)
if len(ret) == 0 {
panic("no return value specified for IterateFiles")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, func(domain.FullFileId)) error); ok {
r0 = rf(ctx, iterFunc)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockRpcStore_IterateFiles_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IterateFiles'
type MockRpcStore_IterateFiles_Call struct {
*mock.Call
}
// IterateFiles is a helper method to define mock.On call
// - ctx context.Context
// - iterFunc func(domain.FullFileId)
func (_e *MockRpcStore_Expecter) IterateFiles(ctx interface{}, iterFunc interface{}) *MockRpcStore_IterateFiles_Call {
return &MockRpcStore_IterateFiles_Call{Call: _e.mock.On("IterateFiles", ctx, iterFunc)}
}
func (_c *MockRpcStore_IterateFiles_Call) Run(run func(ctx context.Context, iterFunc func(domain.FullFileId))) *MockRpcStore_IterateFiles_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(func(domain.FullFileId)))
})
return _c
}
func (_c *MockRpcStore_IterateFiles_Call) Return(_a0 error) *MockRpcStore_IterateFiles_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockRpcStore_IterateFiles_Call) RunAndReturn(run func(context.Context, func(domain.FullFileId)) error) *MockRpcStore_IterateFiles_Call {
_c.Call.Return(run)
return _c
}
// SpaceInfo provides a mock function with given fields: ctx, spaceId
func (_m *MockRpcStore) SpaceInfo(ctx context.Context, spaceId string) (*fileproto.SpaceInfoResponse, error) {
ret := _m.Called(ctx, spaceId)
if len(ret) == 0 {
panic("no return value specified for SpaceInfo")
}
var r0 *fileproto.SpaceInfoResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, string) (*fileproto.SpaceInfoResponse, error)); ok {
return rf(ctx, spaceId)
}
if rf, ok := ret.Get(0).(func(context.Context, string) *fileproto.SpaceInfoResponse); ok {
r0 = rf(ctx, spaceId)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*fileproto.SpaceInfoResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, string) error); ok {
r1 = rf(ctx, spaceId)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockRpcStore_SpaceInfo_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SpaceInfo'
type MockRpcStore_SpaceInfo_Call struct {
*mock.Call
}
// SpaceInfo is a helper method to define mock.On call
// - ctx context.Context
// - spaceId string
func (_e *MockRpcStore_Expecter) SpaceInfo(ctx interface{}, spaceId interface{}) *MockRpcStore_SpaceInfo_Call {
return &MockRpcStore_SpaceInfo_Call{Call: _e.mock.On("SpaceInfo", ctx, spaceId)}
}
func (_c *MockRpcStore_SpaceInfo_Call) Run(run func(ctx context.Context, spaceId string)) *MockRpcStore_SpaceInfo_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string))
})
return _c
}
func (_c *MockRpcStore_SpaceInfo_Call) Return(info *fileproto.SpaceInfoResponse, err error) *MockRpcStore_SpaceInfo_Call {
_c.Call.Return(info, err)
return _c
}
func (_c *MockRpcStore_SpaceInfo_Call) RunAndReturn(run func(context.Context, string) (*fileproto.SpaceInfoResponse, error)) *MockRpcStore_SpaceInfo_Call {
_c.Call.Return(run)
return _c
}
// NewMockRpcStore creates a new instance of MockRpcStore. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewMockRpcStore(t interface {
mock.TestingT
Cleanup(func())
}) *MockRpcStore {
mock := &MockRpcStore{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}