Compare commits

..
Author SHA1 Message Date
mcrakhman 21a9ce6035 Fix openingWaitCount logic 2023-07-14 16:19:38 +02:00
Sergey Cherepanov 4bccbf1faf Merge pull request #45 from anyproto/dependabot/go_modules/golang.org/x/net-0.12.0
Bump golang.org/x/net from 0.11.0 to 0.12.0
2023-07-10 19:13:21 +02:00
Sergey Cherepanov 26b18fba87 Merge pull request #44 from anyproto/dependabot/go_modules/golang.org/x/crypto-0.11.0
Bump golang.org/x/crypto from 0.10.0 to 0.11.0
2023-07-10 19:13:11 +02:00
dependabot[bot] fc0c3d54f1 Bump golang.org/x/net from 0.11.0 to 0.12.0
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.11.0 to 0.12.0.
- [Commits](https://github.com/golang/net/compare/v0.11.0...v0.12.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-10 15:26:07 +00:00
dependabot[bot] 9dde29a280 Bump golang.org/x/crypto from 0.10.0 to 0.11.0
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.10.0 to 0.11.0.
- [Commits](https://github.com/golang/crypto/compare/v0.10.0...v0.11.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-10 15:25:50 +00:00
52 changed files with 265 additions and 220 deletions

No files matched your search

+1 -1
View File
@@ -3,7 +3,7 @@ package mock_accountservice
import (
"github.com/anyproto/any-sync/accountservice"
"github.com/anyproto/any-sync/commonspace/object/accountdata"
"go.uber.org/mock/gomock"
"github.com/golang/mock/gomock"
)
func NewAccountServiceWithAccount(ctrl *gomock.Controller, acc *accountdata.AccountKeys) *MockService {
@@ -9,7 +9,7 @@ import (
app "github.com/anyproto/any-sync/app"
accountdata "github.com/anyproto/any-sync/commonspace/object/accountdata"
gomock "go.uber.org/mock/gomock"
gomock "github.com/golang/mock/gomock"
)
// MockService is a mock of Service interface.
+1 -1
View File
@@ -9,7 +9,7 @@ import (
reflect "reflect"
ldiff "github.com/anyproto/any-sync/app/ldiff"
gomock "go.uber.org/mock/gomock"
gomock "github.com/golang/mock/gomock"
)
// MockDiff is a mock of Diff interface.
@@ -10,7 +10,7 @@ import (
app "github.com/anyproto/any-sync/app"
spacesyncproto "github.com/anyproto/any-sync/commonspace/spacesyncproto"
gomock "go.uber.org/mock/gomock"
gomock "github.com/golang/mock/gomock"
)
// MockCredentialProvider is a mock of CredentialProvider interface.
@@ -3,8 +3,8 @@ package deletionstate
import (
"github.com/anyproto/any-sync/commonspace/spacestorage"
"github.com/anyproto/any-sync/commonspace/spacestorage/mock_spacestorage"
"github.com/golang/mock/gomock"
"github.com/stretchr/testify/require"
"go.uber.org/mock/gomock"
"sort"
"testing"
)
@@ -9,7 +9,7 @@ import (
app "github.com/anyproto/any-sync/app"
deletionstate "github.com/anyproto/any-sync/commonspace/deletionstate"
gomock "go.uber.org/mock/gomock"
gomock "github.com/golang/mock/gomock"
)
// MockObjectDeletionState is a mock of ObjectDeletionState interface.
+1 -1
View File
@@ -14,8 +14,8 @@ import (
"github.com/anyproto/any-sync/commonspace/spacesyncproto"
"github.com/anyproto/any-sync/consensus/consensusproto"
"github.com/anyproto/any-sync/net/peer"
"github.com/golang/mock/gomock"
"github.com/stretchr/testify/require"
"go.uber.org/mock/gomock"
"storj.io/drpc"
)
+1 -1
View File
@@ -23,8 +23,8 @@ import (
"github.com/anyproto/any-sync/commonspace/syncstatus"
"github.com/anyproto/any-sync/nodeconf"
"github.com/anyproto/any-sync/nodeconf/mock_nodeconf"
"github.com/golang/mock/gomock"
"github.com/stretchr/testify/require"
"go.uber.org/mock/gomock"
"sync/atomic"
"testing"
)
@@ -8,7 +8,7 @@ import (
context "context"
reflect "reflect"
gomock "go.uber.org/mock/gomock"
gomock "github.com/golang/mock/gomock"
)
// MockDiffSyncer is a mock of DiffSyncer interface.
@@ -10,7 +10,7 @@ import (
list "github.com/anyproto/any-sync/commonspace/object/acl/list"
consensusproto "github.com/anyproto/any-sync/consensus/consensusproto"
crypto "github.com/anyproto/any-sync/util/crypto"
gomock "go.uber.org/mock/gomock"
gomock "github.com/golang/mock/gomock"
)
// MockAclList is a mock of AclList interface.
@@ -9,7 +9,7 @@ import (
reflect "reflect"
consensusproto "github.com/anyproto/any-sync/consensus/consensusproto"
gomock "go.uber.org/mock/gomock"
gomock "github.com/golang/mock/gomock"
)
// MockListStorage is a mock of ListStorage interface.
@@ -13,7 +13,7 @@ import (
objecttree "github.com/anyproto/any-sync/commonspace/object/tree/objecttree"
treechangeproto "github.com/anyproto/any-sync/commonspace/object/tree/treechangeproto"
treestorage "github.com/anyproto/any-sync/commonspace/object/tree/treestorage"
gomock "go.uber.org/mock/gomock"
gomock "github.com/golang/mock/gomock"
)
// MockObjectTree is a mock of ObjectTree interface.
@@ -15,7 +15,7 @@ import (
treechangeproto "github.com/anyproto/any-sync/commonspace/object/tree/treechangeproto"
treestorage "github.com/anyproto/any-sync/commonspace/object/tree/treestorage"
spacesyncproto "github.com/anyproto/any-sync/commonspace/spacesyncproto"
gomock "go.uber.org/mock/gomock"
gomock "github.com/golang/mock/gomock"
)
// MockSyncTree is a mock of SyncTree interface.
@@ -11,8 +11,8 @@ import (
"github.com/anyproto/any-sync/commonspace/objectsync"
"github.com/anyproto/any-sync/commonspace/syncstatus"
"github.com/anyproto/any-sync/nodeconf"
"github.com/golang/mock/gomock"
"github.com/stretchr/testify/require"
"go.uber.org/mock/gomock"
"testing"
)
@@ -9,8 +9,8 @@ import (
"github.com/anyproto/any-sync/commonspace/object/tree/synctree/mock_synctree"
"github.com/anyproto/any-sync/commonspace/object/tree/treechangeproto"
"github.com/anyproto/any-sync/commonspace/syncstatus"
"github.com/golang/mock/gomock"
"github.com/stretchr/testify/require"
"go.uber.org/mock/gomock"
)
type testObjTreeMock struct {
@@ -12,8 +12,8 @@ import (
"github.com/anyproto/any-sync/net/peer"
"github.com/anyproto/any-sync/net/peer/mock_peer"
"github.com/gogo/protobuf/proto"
"github.com/golang/mock/gomock"
"github.com/stretchr/testify/require"
"go.uber.org/mock/gomock"
)
type treeRemoteGetterFixture struct {
@@ -8,8 +8,8 @@ import (
"github.com/anyproto/any-sync/commonspace/object/tree/objecttree/mock_objecttree"
"github.com/anyproto/any-sync/commonspace/object/tree/synctree/mock_synctree"
"github.com/anyproto/any-sync/commonspace/object/tree/treechangeproto"
"github.com/golang/mock/gomock"
"github.com/stretchr/testify/require"
"go.uber.org/mock/gomock"
"testing"
)
@@ -8,7 +8,7 @@ import (
reflect "reflect"
objecttree "github.com/anyproto/any-sync/commonspace/object/tree/objecttree"
gomock "go.uber.org/mock/gomock"
gomock "github.com/golang/mock/gomock"
)
// MockUpdateListener is a mock of UpdateListener interface.
@@ -9,7 +9,7 @@ import (
reflect "reflect"
treechangeproto "github.com/anyproto/any-sync/commonspace/object/tree/treechangeproto"
gomock "go.uber.org/mock/gomock"
gomock "github.com/golang/mock/gomock"
)
// MockTreeStorage is a mock of TreeStorage interface.
@@ -11,7 +11,7 @@ import (
app "github.com/anyproto/any-sync/app"
objecttree "github.com/anyproto/any-sync/commonspace/object/tree/objecttree"
treemanager "github.com/anyproto/any-sync/commonspace/object/treemanager"
gomock "go.uber.org/mock/gomock"
gomock "github.com/golang/mock/gomock"
)
// MockTreeManager is a mock of TreeManager interface.
@@ -12,7 +12,7 @@ import (
app "github.com/anyproto/any-sync/app"
objectsync "github.com/anyproto/any-sync/commonspace/objectsync"
spacesyncproto "github.com/anyproto/any-sync/commonspace/spacesyncproto"
gomock "go.uber.org/mock/gomock"
gomock "github.com/golang/mock/gomock"
)
// MockObjectSync is a mock of ObjectSync interface.
@@ -12,7 +12,7 @@ import (
updatelistener "github.com/anyproto/any-sync/commonspace/object/tree/synctree/updatelistener"
treestorage "github.com/anyproto/any-sync/commonspace/object/tree/treestorage"
objecttreebuilder "github.com/anyproto/any-sync/commonspace/objecttreebuilder"
gomock "go.uber.org/mock/gomock"
gomock "github.com/golang/mock/gomock"
)
// MockTreeBuilder is a mock of TreeBuilder interface.
@@ -11,7 +11,7 @@ import (
app "github.com/anyproto/any-sync/app"
spacesyncproto "github.com/anyproto/any-sync/commonspace/spacesyncproto"
peer "github.com/anyproto/any-sync/net/peer"
gomock "go.uber.org/mock/gomock"
gomock "github.com/golang/mock/gomock"
)
// MockPeerManager is a mock of PeerManager interface.
@@ -12,8 +12,8 @@ import (
"github.com/anyproto/any-sync/net/peer"
"github.com/anyproto/any-sync/net/peer/mock_peer"
"github.com/anyproto/any-sync/net/pool/mock_pool"
"github.com/golang/mock/gomock"
"github.com/stretchr/testify/require"
"go.uber.org/mock/gomock"
"storj.io/drpc"
"storj.io/drpc/drpcconn"
)
+1 -1
View File
@@ -6,7 +6,7 @@ import (
"github.com/anyproto/any-sync/commonspace/object/tree/treestorage"
"github.com/anyproto/any-sync/commonspace/object/treemanager/mock_treemanager"
"github.com/anyproto/any-sync/commonspace/spacestorage/mock_spacestorage"
"go.uber.org/mock/gomock"
"github.com/golang/mock/gomock"
"testing"
)
+1 -1
View File
@@ -6,8 +6,8 @@ import (
"github.com/anyproto/any-sync/commonspace/object/treemanager/mock_treemanager"
"github.com/anyproto/any-sync/commonspace/settings/mock_settings"
"github.com/anyproto/any-sync/commonspace/settings/settingsstate"
"github.com/golang/mock/gomock"
"github.com/stretchr/testify/require"
"go.uber.org/mock/gomock"
"testing"
)
@@ -9,7 +9,7 @@ import (
reflect "reflect"
settingsstate "github.com/anyproto/any-sync/commonspace/settings/settingsstate"
gomock "go.uber.org/mock/gomock"
gomock "github.com/golang/mock/gomock"
)
// MockDeletionManager is a mock of DeletionManager interface.
+1 -1
View File
@@ -16,8 +16,8 @@ import (
"github.com/anyproto/any-sync/commonspace/settings/settingsstate"
"github.com/anyproto/any-sync/commonspace/settings/settingsstate/mock_settingsstate"
"github.com/anyproto/any-sync/commonspace/spacestorage/mock_spacestorage"
"github.com/golang/mock/gomock"
"github.com/stretchr/testify/require"
"go.uber.org/mock/gomock"
"sync"
"testing"
"time"
@@ -9,7 +9,7 @@ import (
objecttree "github.com/anyproto/any-sync/commonspace/object/tree/objecttree"
settingsstate "github.com/anyproto/any-sync/commonspace/settings/settingsstate"
gomock "go.uber.org/mock/gomock"
gomock "github.com/golang/mock/gomock"
)
// MockStateBuilder is a mock of StateBuilder interface.
@@ -4,8 +4,8 @@ import (
"github.com/anyproto/any-sync/commonspace/object/tree/objecttree"
"github.com/anyproto/any-sync/commonspace/object/tree/objecttree/mock_objecttree"
"github.com/anyproto/any-sync/commonspace/spacesyncproto"
"github.com/golang/mock/gomock"
"github.com/stretchr/testify/require"
"go.uber.org/mock/gomock"
"testing"
)
@@ -13,7 +13,7 @@ import (
treechangeproto "github.com/anyproto/any-sync/commonspace/object/tree/treechangeproto"
treestorage "github.com/anyproto/any-sync/commonspace/object/tree/treestorage"
spacesyncproto "github.com/anyproto/any-sync/commonspace/spacesyncproto"
gomock "go.uber.org/mock/gomock"
gomock "github.com/golang/mock/gomock"
)
// MockSpaceStorage is a mock of SpaceStorage interface.
@@ -9,7 +9,7 @@ import (
reflect "reflect"
spacesyncproto "github.com/anyproto/any-sync/commonspace/spacesyncproto"
gomock "go.uber.org/mock/gomock"
gomock "github.com/golang/mock/gomock"
drpc "storj.io/drpc"
)
+20 -22
View File
@@ -36,13 +36,13 @@ type Watcher interface {
type Service interface {
// AddLog adds new log to consensus servers
AddLog(ctx context.Context, rec *consensusproto.RawRecordWithId) (err error)
AddLog(ctx context.Context, clog *consensusproto.Log) (err error)
// AddRecord adds new record to consensus servers
AddRecord(ctx context.Context, logId string, rec *consensusproto.RawRecord) (record *consensusproto.RawRecordWithId, err error)
AddRecord(ctx context.Context, logId []byte, clog *consensusproto.RawRecord) (record *consensusproto.RawRecordWithId, err error)
// Watch starts watching to given logId and calls watcher when any relative event received
Watch(logId string, w Watcher) (err error)
Watch(logId []byte, w Watcher) (err error)
// UnWatch stops watching given logId and removes watcher
UnWatch(logId string) (err error)
UnWatch(logId []byte) (err error)
app.ComponentRunnable
}
@@ -86,10 +86,10 @@ func (s *service) doClient(ctx context.Context, fn func(cl consensusproto.DRPCCo
return fn(consensusproto.NewDRPCConsensusClient(dc))
}
func (s *service) AddLog(ctx context.Context, rec *consensusproto.RawRecordWithId) (err error) {
func (s *service) AddLog(ctx context.Context, clog *consensusproto.Log) (err error) {
return s.doClient(ctx, func(cl consensusproto.DRPCConsensusClient) error {
if _, err = cl.LogAdd(ctx, &consensusproto.LogAddRequest{
Record: rec,
Log: clog,
}); err != nil {
return rpcerr.Unwrap(err)
}
@@ -97,11 +97,11 @@ func (s *service) AddLog(ctx context.Context, rec *consensusproto.RawRecordWithI
})
}
func (s *service) AddRecord(ctx context.Context, logId string, rec *consensusproto.RawRecord) (record *consensusproto.RawRecordWithId, err error) {
func (s *service) AddRecord(ctx context.Context, logId []byte, clog *consensusproto.RawRecord) (record *consensusproto.RawRecordWithId, err error) {
err = s.doClient(ctx, func(cl consensusproto.DRPCConsensusClient) error {
if record, err = cl.RecordAdd(ctx, &consensusproto.RecordAddRequest{
LogId: logId,
Record: rec,
Record: clog,
}); err != nil {
return rpcerr.Unwrap(err)
}
@@ -110,30 +110,30 @@ func (s *service) AddRecord(ctx context.Context, logId string, rec *consensuspro
return
}
func (s *service) Watch(logId string, w Watcher) (err error) {
func (s *service) Watch(logId []byte, w Watcher) (err error) {
s.mu.Lock()
defer s.mu.Unlock()
if _, ok := s.watchers[logId]; ok {
if _, ok := s.watchers[string(logId)]; ok {
return ErrWatcherExists
}
s.watchers[logId] = w
s.watchers[string(logId)] = w
if s.stream != nil {
if wErr := s.stream.WatchIds([]string{logId}); wErr != nil {
if wErr := s.stream.WatchIds([][]byte{logId}); wErr != nil {
log.Warn("WatchIds error", zap.Error(wErr))
}
}
return
}
func (s *service) UnWatch(logId string) (err error) {
func (s *service) UnWatch(logId []byte) (err error) {
s.mu.Lock()
defer s.mu.Unlock()
if _, ok := s.watchers[logId]; !ok {
if _, ok := s.watchers[string(logId)]; !ok {
return ErrWatcherNotExists
}
delete(s.watchers, logId)
delete(s.watchers, string(logId))
if s.stream != nil {
if wErr := s.stream.UnwatchIds([]string{logId}); wErr != nil {
if wErr := s.stream.UnwatchIds([][]byte{logId}); wErr != nil {
log.Warn("UnWatchIds error", zap.Error(wErr))
}
}
@@ -182,9 +182,9 @@ func (s *service) streamWatcher() {
// collect ids and setup stream
s.mu.Lock()
var logIds = make([]string, 0, len(s.watchers))
var logIds = make([][]byte, 0, len(s.watchers))
for id := range s.watchers {
logIds = append(logIds, id)
logIds = append(logIds, []byte(id))
}
s.stream = st
s.mu.Unlock()
@@ -212,19 +212,17 @@ func (s *service) streamReader() error {
if len(events) == 0 {
return s.stream.Err()
}
s.mu.Lock()
for _, e := range events {
if w, ok := s.watchers[e.LogId]; ok {
if w, ok := s.watchers[string(e.LogId)]; ok {
if e.Error == nil {
w.AddConsensusRecords(e.Records)
} else {
w.AddConsensusError(rpcerr.Err(uint64(e.Error.Error)))
}
} else {
log.Warn("received unexpected log id", zap.String("logId", e.LogId))
log.Warn("received unexpected log id", zap.Binary("logId", e.LogId))
}
}
s.mu.Unlock()
}
}
+13 -13
View File
@@ -12,9 +12,9 @@ import (
"github.com/anyproto/any-sync/nodeconf/mock_nodeconf"
"github.com/anyproto/any-sync/testutil/accounttest"
"github.com/anyproto/any-sync/util/cidutil"
"github.com/golang/mock/gomock"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.uber.org/mock/gomock"
"sync"
"testing"
"time"
@@ -24,13 +24,13 @@ func TestService_Watch(t *testing.T) {
t.Run("not found error", func(t *testing.T) {
fx := newFixture(t).run(t)
defer fx.Finish()
var logId = "1"
var logId = []byte{'1'}
w := &testWatcher{ready: make(chan struct{})}
require.NoError(t, fx.Watch(logId, w))
st := fx.testServer.waitStream(t)
req, err := st.Recv()
require.NoError(t, err)
assert.Equal(t, []string{logId}, req.WatchIds)
assert.Equal(t, [][]byte{logId}, req.WatchIds)
require.NoError(t, st.Send(&consensusproto.LogWatchEvent{
LogId: logId,
Error: &consensusproto.Err{
@@ -44,7 +44,7 @@ func TestService_Watch(t *testing.T) {
t.Run("watcherExists error", func(t *testing.T) {
fx := newFixture(t).run(t)
defer fx.Finish()
var logId = "1"
var logId = []byte{'1'}
w := &testWatcher{}
require.NoError(t, fx.Watch(logId, w))
require.Error(t, fx.Watch(logId, w))
@@ -55,20 +55,20 @@ func TestService_Watch(t *testing.T) {
t.Run("watch", func(t *testing.T) {
fx := newFixture(t).run(t)
defer fx.Finish()
var logId1 = "1"
var logId1 = []byte{'1'}
w := &testWatcher{}
require.NoError(t, fx.Watch(logId1, w))
st := fx.testServer.waitStream(t)
req, err := st.Recv()
require.NoError(t, err)
assert.Equal(t, []string{logId1}, req.WatchIds)
assert.Equal(t, [][]byte{logId1}, req.WatchIds)
var logId2 = "2"
var logId2 = []byte{'2'}
w = &testWatcher{}
require.NoError(t, fx.Watch(logId2, w))
req, err = st.Recv()
require.NoError(t, err)
assert.Equal(t, []string{logId2}, req.WatchIds)
assert.Equal(t, [][]byte{logId2}, req.WatchIds)
fx.testServer.releaseStream <- nil
})
@@ -78,14 +78,14 @@ func TestService_UnWatch(t *testing.T) {
t.Run("no watcher", func(t *testing.T) {
fx := newFixture(t).run(t)
defer fx.Finish()
require.Error(t, fx.UnWatch("1"))
require.Error(t, fx.UnWatch([]byte{'1'}))
})
t.Run("success", func(t *testing.T) {
fx := newFixture(t).run(t)
defer fx.Finish()
w := &testWatcher{}
require.NoError(t, fx.Watch("1", w))
assert.NoError(t, fx.UnWatch("1"))
require.NoError(t, fx.Watch([]byte{'1'}, w))
assert.NoError(t, fx.UnWatch([]byte{'1'}))
})
}
@@ -113,13 +113,13 @@ func TestService_Init(t *testing.T) {
func TestService_AddLog(t *testing.T) {
fx := newFixture(t).run(t)
defer fx.Finish()
assert.NoError(t, fx.AddLog(ctx, &consensusproto.RawRecordWithId{}))
assert.NoError(t, fx.AddLog(ctx, &consensusproto.Log{}))
}
func TestService_AddRecord(t *testing.T) {
fx := newFixture(t).run(t)
defer fx.Finish()
rec, err := fx.AddRecord(ctx, "1", &consensusproto.RawRecord{})
rec, err := fx.AddRecord(ctx, []byte{'1'}, &consensusproto.RawRecord{})
require.NoError(t, err)
assert.NotEmpty(t, rec)
}
@@ -11,7 +11,7 @@ import (
app "github.com/anyproto/any-sync/app"
consensusclient "github.com/anyproto/any-sync/consensus/consensusclient"
consensusproto "github.com/anyproto/any-sync/consensus/consensusproto"
gomock "go.uber.org/mock/gomock"
gomock "github.com/golang/mock/gomock"
)
// MockService is a mock of Service interface.
@@ -38,7 +38,7 @@ func (m *MockService) EXPECT() *MockServiceMockRecorder {
}
// AddLog mocks base method.
func (m *MockService) AddLog(arg0 context.Context, arg1 *consensusproto.RawRecordWithId) error {
func (m *MockService) AddLog(arg0 context.Context, arg1 *consensusproto.Log) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "AddLog", arg0, arg1)
ret0, _ := ret[0].(error)
@@ -52,7 +52,7 @@ func (mr *MockServiceMockRecorder) AddLog(arg0, arg1 interface{}) *gomock.Call {
}
// AddRecord mocks base method.
func (m *MockService) AddRecord(arg0 context.Context, arg1 string, arg2 *consensusproto.RawRecord) (*consensusproto.RawRecordWithId, error) {
func (m *MockService) AddRecord(arg0 context.Context, arg1 []byte, arg2 *consensusproto.RawRecord) (*consensusproto.RawRecordWithId, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "AddRecord", arg0, arg1, arg2)
ret0, _ := ret[0].(*consensusproto.RawRecordWithId)
@@ -123,7 +123,7 @@ func (mr *MockServiceMockRecorder) Run(arg0 interface{}) *gomock.Call {
}
// UnWatch mocks base method.
func (m *MockService) UnWatch(arg0 string) error {
func (m *MockService) UnWatch(arg0 []byte) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "UnWatch", arg0)
ret0, _ := ret[0].(error)
@@ -137,7 +137,7 @@ func (mr *MockServiceMockRecorder) UnWatch(arg0 interface{}) *gomock.Call {
}
// Watch mocks base method.
func (m *MockService) Watch(arg0 string, arg1 consensusclient.Watcher) error {
func (m *MockService) Watch(arg0 []byte, arg1 consensusclient.Watcher) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Watch", arg0, arg1)
ret0, _ := ret[0].(error)
+2 -2
View File
@@ -23,13 +23,13 @@ type stream struct {
err error
}
func (s *stream) WatchIds(logIds []string) (err error) {
func (s *stream) WatchIds(logIds [][]byte) (err error) {
return s.rpcStream.Send(&consensusproto.LogWatchRequest{
WatchIds: logIds,
})
}
func (s *stream) UnwatchIds(logIds []string) (err error) {
func (s *stream) UnwatchIds(logIds [][]byte) (err error) {
return s.rpcStream.Send(&consensusproto.LogWatchRequest{
UnwatchIds: logIds,
})
+157 -106
View File
@@ -29,8 +29,6 @@ const (
ErrCodes_LogExists ErrCodes = 1
ErrCodes_LogNotFound ErrCodes = 2
ErrCodes_RecordConflict ErrCodes = 3
ErrCodes_Forbidden ErrCodes = 4
ErrCodes_InvalidPayload ErrCodes = 5
ErrCodes_ErrorOffset ErrCodes = 500
)
@@ -39,8 +37,6 @@ var ErrCodes_name = map[int32]string{
1: "LogExists",
2: "LogNotFound",
3: "RecordConflict",
4: "Forbidden",
5: "InvalidPayload",
500: "ErrorOffset",
}
@@ -49,8 +45,6 @@ var ErrCodes_value = map[string]int32{
"LogExists": 1,
"LogNotFound": 2,
"RecordConflict": 3,
"Forbidden": 4,
"InvalidPayload": 5,
"ErrorOffset": 500,
}
@@ -63,7 +57,8 @@ func (ErrCodes) EnumDescriptor() ([]byte, []int) {
}
type Log struct {
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
Id []byte `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
Payload []byte `protobuf:"bytes,2,opt,name=payload,proto3" json:"payload,omitempty"`
Records []*RawRecordWithId `protobuf:"bytes,3,rep,name=records,proto3" json:"records,omitempty"`
}
@@ -100,11 +95,18 @@ func (m *Log) XXX_DiscardUnknown() {
var xxx_messageInfo_Log proto.InternalMessageInfo
func (m *Log) GetId() string {
func (m *Log) GetId() []byte {
if m != nil {
return m.Id
}
return ""
return nil
}
func (m *Log) GetPayload() []byte {
if m != nil {
return m.Payload
}
return nil
}
func (m *Log) GetRecords() []*RawRecordWithId {
@@ -342,8 +344,7 @@ func (m *Ok) XXX_DiscardUnknown() {
var xxx_messageInfo_Ok proto.InternalMessageInfo
type LogAddRequest struct {
// first record in the log, consensus node not sign it
Record *RawRecordWithId `protobuf:"bytes,1,opt,name=record,proto3" json:"record,omitempty"`
Log *Log `protobuf:"bytes,1,opt,name=log,proto3" json:"log,omitempty"`
}
func (m *LogAddRequest) Reset() { *m = LogAddRequest{} }
@@ -379,15 +380,15 @@ func (m *LogAddRequest) XXX_DiscardUnknown() {
var xxx_messageInfo_LogAddRequest proto.InternalMessageInfo
func (m *LogAddRequest) GetRecord() *RawRecordWithId {
func (m *LogAddRequest) GetLog() *Log {
if m != nil {
return m.Record
return m.Log
}
return nil
}
type RecordAddRequest struct {
LogId string `protobuf:"bytes,1,opt,name=logId,proto3" json:"logId,omitempty"`
LogId []byte `protobuf:"bytes,1,opt,name=logId,proto3" json:"logId,omitempty"`
Record *RawRecord `protobuf:"bytes,2,opt,name=record,proto3" json:"record,omitempty"`
}
@@ -424,11 +425,11 @@ func (m *RecordAddRequest) XXX_DiscardUnknown() {
var xxx_messageInfo_RecordAddRequest proto.InternalMessageInfo
func (m *RecordAddRequest) GetLogId() string {
func (m *RecordAddRequest) GetLogId() []byte {
if m != nil {
return m.LogId
}
return ""
return nil
}
func (m *RecordAddRequest) GetRecord() *RawRecord {
@@ -439,8 +440,8 @@ func (m *RecordAddRequest) GetRecord() *RawRecord {
}
type LogWatchRequest struct {
WatchIds []string `protobuf:"bytes,1,rep,name=watchIds,proto3" json:"watchIds,omitempty"`
UnwatchIds []string `protobuf:"bytes,2,rep,name=unwatchIds,proto3" json:"unwatchIds,omitempty"`
WatchIds [][]byte `protobuf:"bytes,1,rep,name=watchIds,proto3" json:"watchIds,omitempty"`
UnwatchIds [][]byte `protobuf:"bytes,2,rep,name=unwatchIds,proto3" json:"unwatchIds,omitempty"`
}
func (m *LogWatchRequest) Reset() { *m = LogWatchRequest{} }
@@ -476,14 +477,14 @@ func (m *LogWatchRequest) XXX_DiscardUnknown() {
var xxx_messageInfo_LogWatchRequest proto.InternalMessageInfo
func (m *LogWatchRequest) GetWatchIds() []string {
func (m *LogWatchRequest) GetWatchIds() [][]byte {
if m != nil {
return m.WatchIds
}
return nil
}
func (m *LogWatchRequest) GetUnwatchIds() []string {
func (m *LogWatchRequest) GetUnwatchIds() [][]byte {
if m != nil {
return m.UnwatchIds
}
@@ -491,7 +492,7 @@ func (m *LogWatchRequest) GetUnwatchIds() []string {
}
type LogWatchEvent struct {
LogId string `protobuf:"bytes,1,opt,name=logId,proto3" json:"logId,omitempty"`
LogId []byte `protobuf:"bytes,1,opt,name=logId,proto3" json:"logId,omitempty"`
Records []*RawRecordWithId `protobuf:"bytes,2,rep,name=records,proto3" json:"records,omitempty"`
Error *Err `protobuf:"bytes,3,opt,name=error,proto3" json:"error,omitempty"`
}
@@ -529,11 +530,11 @@ func (m *LogWatchEvent) XXX_DiscardUnknown() {
var xxx_messageInfo_LogWatchEvent proto.InternalMessageInfo
func (m *LogWatchEvent) GetLogId() string {
func (m *LogWatchEvent) GetLogId() []byte {
if m != nil {
return m.LogId
}
return ""
return nil
}
func (m *LogWatchEvent) GetRecords() []*RawRecordWithId {
@@ -613,47 +614,46 @@ func init() {
}
var fileDescriptor_b8d7f1c16b400059 = []byte{
// 625 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0xcd, 0x6e, 0xd3, 0x40,
0x10, 0xce, 0xda, 0x69, 0x1a, 0x4f, 0x68, 0x6a, 0x06, 0x84, 0x4c, 0x44, 0xdd, 0xc8, 0xa7, 0x50,
0xa1, 0x14, 0x82, 0x10, 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, 0xe3, 0xdc, 0x25, 0x5f, 0x2e,
0xdc, 0xd2, 0xd9, 0x85, 0x5b, 0xfa, 0x7e, 0xe1, 0x96, 0xde, 0x3b, 0xb3, 0xbe, 0x95, 0xbb, 0x15,
0xfd, 0xf7, 0xf4, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0x20, 0xdd, 0xae, 0xec, 0x4e, 0x05, 0x00,
0x00,
// 618 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0xcf, 0x6e, 0xd3, 0x4e,
0x10, 0xce, 0xda, 0x6d, 0x1a, 0x4f, 0x7e, 0x4d, 0xfd, 0x1b, 0x10, 0x32, 0x11, 0x75, 0x23, 0x4b,
0x48, 0xa5, 0x42, 0x29, 0x04, 0x81, 0x84, 0x7a, 0x82, 0x2a, 0x48, 0x91, 0x42, 0x8b, 0x8c, 0x50,
0x25, 0xb8, 0x60, 0xbc, 0x5b, 0xd7, 0x34, 0xf5, 0x86, 0xdd, 0x4d, 0xff, 0x3c, 0x03, 0x17, 0x5e,
0x80, 0xf7, 0xe1, 0xd8, 0x23, 0x47, 0xd4, 0x5e, 0x78, 0x00, 0x1e, 0x00, 0x79, 0x1d, 0x3b, 0x6e,
0x9a, 0x80, 0xb8, 0x24, 0x3b, 0xdf, 0xfc, 0xfb, 0x66, 0xe6, 0x93, 0x61, 0x33, 0xe4, 0x89, 0x64,
0x89, 0x1c, 0xc9, 0xc9, 0x6b, 0x28, 0xb8, 0xe2, 0x9b, 0xfa, 0xb7, 0x84, 0xb6, 0x35, 0x80, 0x8d,
0x02, 0x78, 0x95, 0xda, 0xde, 0x47, 0x30, 0xfb, 0x3c, 0xc2, 0x06, 0x18, 0x31, 0x75, 0x48, 0x8b,
0xac, 0xff, 0xe7, 0x1b, 0x31, 0x45, 0x07, 0x96, 0x86, 0xc1, 0xd9, 0x80, 0x07, 0xd4, 0x31, 0x34,
0x98,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, 0xe7, 0x27, 0x01, 0x6b, 0x3b, 0x27, 0x81, 0x5b, 0x50, 0xcd, 0x84, 0x81, 0xab, 0x33, 0x44,
0x30, 0xb9, 0x7a, 0x13, 0xa7, 0xdd, 0xbb, 0x87, 0xb8, 0x03, 0x56, 0xa1, 0x0e, 0x6c, 0x5d, 0xdb,
0xe2, 0x94, 0x70, 0x9a, 0x7f, 0xdb, 0x33, 0xee, 0x40, 0x2d, 0x3f, 0x20, 0xae, 0xcd, 0xa0, 0x53,
0x96, 0x4a, 0x73, 0x75, 0x5e, 0x80, 0xbe, 0xfd, 0x3a, 0x79, 0x40, 0x9e, 0x77, 0xbe, 0x5d, 0xb8,
0xe4, 0xfc, 0xc2, 0x25, 0x3f, 0x2e, 0x5c, 0xf2, 0xe5, 0xd2, 0xad, 0x9c, 0x5f, 0xba, 0x95, 0xef,
0x97, 0x6e, 0xe5, 0xad, 0x33, 0xef, 0x7b, 0xf8, 0xa1, 0xaa, 0xff, 0x1e, 0xfd, 0x0e, 0x00, 0x00,
0xff, 0xff, 0xbc, 0x83, 0xcb, 0xc1, 0x32, 0x05, 0x00, 0x00,
}
func (m *Log) Marshal() (dAtA []byte, err error) {
@@ -690,6 +690,13 @@ func (m *Log) MarshalToSizedBuffer(dAtA []byte) (int, error) {
dAtA[i] = 0x1a
}
}
if len(m.Payload) > 0 {
i -= len(m.Payload)
copy(dAtA[i:], m.Payload)
i = encodeVarintConsensus(dAtA, i, uint64(len(m.Payload)))
i--
dAtA[i] = 0x12
}
if len(m.Id) > 0 {
i -= len(m.Id)
copy(dAtA[i:], m.Id)
@@ -880,9 +887,9 @@ func (m *LogAddRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i
var l int
_ = l
if m.Record != nil {
if m.Log != nil {
{
size, err := m.Record.MarshalToSizedBuffer(dAtA[:i])
size, err := m.Log.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
@@ -1083,6 +1090,10 @@ func (m *Log) Size() (n int) {
if l > 0 {
n += 1 + l + sovConsensus(uint64(l))
}
l = len(m.Payload)
if l > 0 {
n += 1 + l + sovConsensus(uint64(l))
}
if len(m.Records) > 0 {
for _, e := range m.Records {
l = e.Size()
@@ -1173,8 +1184,8 @@ func (m *LogAddRequest) Size() (n int) {
}
var l int
_ = l
if m.Record != nil {
l = m.Record.Size()
if m.Log != nil {
l = m.Log.Size()
n += 1 + l + sovConsensus(uint64(l))
}
return n
@@ -1204,14 +1215,14 @@ func (m *LogWatchRequest) Size() (n int) {
var l int
_ = l
if len(m.WatchIds) > 0 {
for _, s := range m.WatchIds {
l = len(s)
for _, b := range m.WatchIds {
l = len(b)
n += 1 + l + sovConsensus(uint64(l))
}
}
if len(m.UnwatchIds) > 0 {
for _, s := range m.UnwatchIds {
l = len(s)
for _, b := range m.UnwatchIds {
l = len(b)
n += 1 + l + sovConsensus(uint64(l))
}
}
@@ -1292,7 +1303,7 @@ func (m *Log) Unmarshal(dAtA []byte) error {
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType)
}
var stringLen uint64
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowConsensus
@@ -1302,23 +1313,59 @@ func (m *Log) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
if byteLen < 0 {
return ErrInvalidLengthConsensus
}
postIndex := iNdEx + intStringLen
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthConsensus
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Id = string(dAtA[iNdEx:postIndex])
m.Id = append(m.Id[:0], dAtA[iNdEx:postIndex]...)
if m.Id == nil {
m.Id = []byte{}
}
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Payload", wireType)
}
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowConsensus
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
return ErrInvalidLengthConsensus
}
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthConsensus
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Payload = append(m.Payload[:0], dAtA[iNdEx:postIndex]...)
if m.Payload == nil {
m.Payload = []byte{}
}
iNdEx = postIndex
case 3:
if wireType != 2 {
@@ -1927,7 +1974,7 @@ func (m *LogAddRequest) Unmarshal(dAtA []byte) error {
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Record", wireType)
return fmt.Errorf("proto: wrong wireType = %d for field Log", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
@@ -1954,10 +2001,10 @@ func (m *LogAddRequest) Unmarshal(dAtA []byte) error {
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.Record == nil {
m.Record = &RawRecordWithId{}
if m.Log == nil {
m.Log = &Log{}
}
if err := m.Record.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
if err := m.Log.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
@@ -2015,7 +2062,7 @@ func (m *RecordAddRequest) Unmarshal(dAtA []byte) error {
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field LogId", wireType)
}
var stringLen uint64
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowConsensus
@@ -2025,23 +2072,25 @@ func (m *RecordAddRequest) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
if byteLen < 0 {
return ErrInvalidLengthConsensus
}
postIndex := iNdEx + intStringLen
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthConsensus
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.LogId = string(dAtA[iNdEx:postIndex])
m.LogId = append(m.LogId[:0], dAtA[iNdEx:postIndex]...)
if m.LogId == nil {
m.LogId = []byte{}
}
iNdEx = postIndex
case 2:
if wireType != 2 {
@@ -2133,7 +2182,7 @@ func (m *LogWatchRequest) Unmarshal(dAtA []byte) error {
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field WatchIds", wireType)
}
var stringLen uint64
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowConsensus
@@ -2143,29 +2192,29 @@ func (m *LogWatchRequest) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
if byteLen < 0 {
return ErrInvalidLengthConsensus
}
postIndex := iNdEx + intStringLen
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthConsensus
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.WatchIds = append(m.WatchIds, string(dAtA[iNdEx:postIndex]))
m.WatchIds = append(m.WatchIds, make([]byte, postIndex-iNdEx))
copy(m.WatchIds[len(m.WatchIds)-1], dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field UnwatchIds", wireType)
}
var stringLen uint64
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowConsensus
@@ -2175,23 +2224,23 @@ func (m *LogWatchRequest) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
if byteLen < 0 {
return ErrInvalidLengthConsensus
}
postIndex := iNdEx + intStringLen
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthConsensus
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.UnwatchIds = append(m.UnwatchIds, string(dAtA[iNdEx:postIndex]))
m.UnwatchIds = append(m.UnwatchIds, make([]byte, postIndex-iNdEx))
copy(m.UnwatchIds[len(m.UnwatchIds)-1], dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
@@ -2247,7 +2296,7 @@ func (m *LogWatchEvent) Unmarshal(dAtA []byte) error {
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field LogId", wireType)
}
var stringLen uint64
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowConsensus
@@ -2257,23 +2306,25 @@ func (m *LogWatchEvent) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
if byteLen < 0 {
return ErrInvalidLengthConsensus
}
postIndex := iNdEx + intStringLen
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthConsensus
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.LogId = string(dAtA[iNdEx:postIndex])
m.LogId = append(m.LogId[:0], dAtA[iNdEx:postIndex]...)
if m.LogId == nil {
m.LogId = []byte{}
}
iNdEx = postIndex
case 2:
if wireType != 2 {
@@ -9,10 +9,8 @@ import (
var (
errGroup = rpcerr.ErrGroup(consensusproto.ErrCodes_ErrorOffset)
ErrUnexpected = errGroup.Register(fmt.Errorf("unexpected consensus error"), uint64(consensusproto.ErrCodes_Unexpected))
ErrConflict = errGroup.Register(fmt.Errorf("records conflict"), uint64(consensusproto.ErrCodes_RecordConflict))
ErrLogExists = errGroup.Register(fmt.Errorf("log exists"), uint64(consensusproto.ErrCodes_LogExists))
ErrLogNotFound = errGroup.Register(fmt.Errorf("log not found"), uint64(consensusproto.ErrCodes_LogNotFound))
ErrForbidden = errGroup.Register(fmt.Errorf("forbidden"), uint64(consensusproto.ErrCodes_Forbidden))
ErrInvalidPayload = errGroup.Register(fmt.Errorf("invalid payload"), uint64(consensusproto.ErrCodes_InvalidPayload))
ErrUnexpected = errGroup.Register(fmt.Errorf("unexpected consensus error"), uint64(consensusproto.ErrCodes_Unexpected))
ErrConflict = errGroup.Register(fmt.Errorf("records conflict"), uint64(consensusproto.ErrCodes_RecordConflict))
ErrLogExists = errGroup.Register(fmt.Errorf("log exists"), uint64(consensusproto.ErrCodes_LogExists))
ErrLogNotFound = errGroup.Register(fmt.Errorf("log not found"), uint64(consensusproto.ErrCodes_LogNotFound))
)
@@ -8,14 +8,13 @@ enum ErrCodes {
LogExists = 1;
LogNotFound = 2;
RecordConflict = 3;
Forbidden = 4;
InvalidPayload = 5;
ErrorOffset = 500;
}
message Log {
string id = 1;
bytes id = 1;
bytes payload = 2;
repeated RawRecordWithId records = 3;
}
@@ -54,22 +53,21 @@ service Consensus {
message Ok {}
message LogAddRequest {
// first record in the log, consensus node not sign it
RawRecordWithId record = 1;
Log log = 1;
}
message RecordAddRequest {
string logId = 1;
bytes logId = 1;
RawRecord record = 2;
}
message LogWatchRequest {
repeated string watchIds = 1;
repeated string unwatchIds = 2;
repeated bytes watchIds = 1;
repeated bytes unwatchIds = 2;
}
message LogWatchEvent {
string logId = 1;
bytes logId = 1;
repeated RawRecordWithId records = 2;
Err error = 3;
}
@@ -12,7 +12,7 @@ import (
treechangeproto "github.com/anyproto/any-sync/commonspace/object/tree/treechangeproto"
coordinatorclient "github.com/anyproto/any-sync/coordinator/coordinatorclient"
coordinatorproto "github.com/anyproto/any-sync/coordinator/coordinatorproto"
gomock "go.uber.org/mock/gomock"
gomock "github.com/golang/mock/gomock"
)
// MockCoordinatorClient is a mock of CoordinatorClient interface.
+4 -4
View File
@@ -12,6 +12,7 @@ require (
github.com/gobwas/glob v0.2.3
github.com/goccy/go-graphviz v0.1.1
github.com/gogo/protobuf v1.3.2
github.com/golang/mock v1.6.0
github.com/google/uuid v1.3.0
github.com/hashicorp/yamux v0.1.1
github.com/huandu/skiplist v1.2.0
@@ -33,11 +34,10 @@ require (
github.com/tyler-smith/go-bip39 v1.1.0
github.com/zeebo/blake3 v0.2.3
go.uber.org/atomic v1.11.0
go.uber.org/mock v0.2.0
go.uber.org/zap v1.24.0
golang.org/x/crypto v0.10.0
golang.org/x/crypto v0.11.0
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1
golang.org/x/net v0.11.0
golang.org/x/net v0.12.0
gopkg.in/yaml.v3 v3.0.1
storj.io/drpc v0.0.33
)
@@ -99,7 +99,7 @@ require (
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/image v0.6.0 // indirect
golang.org/x/sync v0.2.0 // indirect
golang.org/x/sys v0.9.0 // indirect
golang.org/x/sys v0.10.0 // indirect
golang.org/x/tools v0.9.3 // indirect
google.golang.org/protobuf v1.30.0 // indirect
lukechampine.com/blake3 v1.2.1 // indirect
+9 -9
View File
@@ -54,6 +54,7 @@ github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF08vX0COfcOBJRhZ8lUbR+ZWIs0Y5g=
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k=
github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc=
github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=
@@ -280,8 +281,6 @@ go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE=
go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0=
go.uber.org/goleak v1.1.11-0.20210813005559-691160354723/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ=
go.uber.org/goleak v1.1.12 h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA=
go.uber.org/mock v0.2.0 h1:TaP3xedm7JaAgScZO7tlvlKrqT0p7I6OsdGB5YNSMDU=
go.uber.org/mock v0.2.0/go.mod h1:J0y0rp9L3xiff1+ZBfKxlC1fz2+aO16tw0tsDOixfuM=
go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU=
go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU=
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
@@ -299,8 +298,8 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U
golang.org/x/crypto v0.0.0-20200602180216-279210d13fed/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.10.0 h1:LKqV2xt9+kDzSTfOhx4FrkEBcMrAgHSYgzywV9zcGmM=
golang.org/x/crypto v0.10.0/go.mod h1:o4eNf7Ede1fv+hwOwZsTHl9EsPFO6q6ZvYR8vYfY45I=
golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA=
golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio=
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1 h1:k/i9J1pBpvlfR+9QsetwPyERsqu1GIbi967PQMq3Ivc=
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1/go.mod h1:V1LtkGg67GoY2N1AnLN78QLrzxkLyJw7RJb1gzOOz9w=
golang.org/x/image v0.6.0 h1:bR8b5okrPI3g/gyZakLZHeWxAR8Dn5CyxXv1hLH5g/4=
@@ -322,8 +321,8 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.11.0 h1:Gi2tvZIJyBtO9SDr1q9h5hEQCp/4L2RQ+ar0qjx2oNU=
golang.org/x/net v0.11.0/go.mod h1:2L/ixqYpgIVXmeoSA/4Lu7BzTG4KIyPIryS4IsOd1oQ=
golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50=
golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@@ -347,8 +346,8 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s=
golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA=
golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
@@ -357,7 +356,7 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/text v0.10.0 h1:UpjohKhiEgNc0CSauXmwYftY1+LlaC75SJwh0SgCX58=
golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
@@ -366,6 +365,7 @@ golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtn
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
+1 -1
View File
@@ -9,7 +9,7 @@ import (
reflect "reflect"
time "time"
gomock "go.uber.org/mock/gomock"
gomock "github.com/golang/mock/gomock"
drpc "storj.io/drpc"
)
+2 -2
View File
@@ -106,10 +106,10 @@ func (p *peer) AcquireDrpcConn(ctx context.Context) (drpc.Conn, error) {
p.mu.Lock()
if len(p.inactive) == 0 {
wait := p.limiter.wait(len(p.active) + int(p.openingWaitCount.Load()))
p.openingWaitCount.Add(1)
defer p.openingWaitCount.Add(-1)
p.mu.Unlock()
if wait != nil {
p.openingWaitCount.Add(1)
defer p.openingWaitCount.Add(-1)
// throttle new connection opening
select {
case <-ctx.Done():
+1 -1
View File
@@ -6,9 +6,9 @@ import (
"github.com/anyproto/any-sync/net/secureservice/handshake"
"github.com/anyproto/any-sync/net/secureservice/handshake/handshakeproto"
"github.com/anyproto/any-sync/net/transport/mock_transport"
"github.com/golang/mock/gomock"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.uber.org/mock/gomock"
"io"
"net"
_ "net/http/pprof"
+1 -1
View File
@@ -9,7 +9,7 @@ import (
reflect "reflect"
peer "github.com/anyproto/any-sync/net/peer"
gomock "go.uber.org/mock/gomock"
gomock "github.com/golang/mock/gomock"
)
// MockPool is a mock of Pool interface.
+1 -1
View File
@@ -9,9 +9,9 @@ import (
"github.com/anyproto/any-sync/nodeconf"
"github.com/anyproto/any-sync/nodeconf/mock_nodeconf"
"github.com/anyproto/any-sync/testutil/testnodeconf"
"github.com/golang/mock/gomock"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.uber.org/mock/gomock"
"net"
"testing"
)
@@ -10,7 +10,7 @@ import (
reflect "reflect"
transport "github.com/anyproto/any-sync/net/transport"
gomock "go.uber.org/mock/gomock"
gomock "github.com/golang/mock/gomock"
)
// MockTransport is a mock of Transport interface.
+1 -1
View File
@@ -10,9 +10,9 @@ import (
"github.com/anyproto/any-sync/nodeconf/mock_nodeconf"
"github.com/anyproto/any-sync/testutil/accounttest"
"github.com/anyproto/any-sync/testutil/testnodeconf"
"github.com/golang/mock/gomock"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.uber.org/mock/gomock"
"io"
"net"
"sync"
+1 -1
View File
@@ -11,7 +11,7 @@ import (
app "github.com/anyproto/any-sync/app"
nodeconf "github.com/anyproto/any-sync/nodeconf"
chash "github.com/anyproto/go-chash"
gomock "go.uber.org/mock/gomock"
gomock "github.com/golang/mock/gomock"
)
// MockService is a mock of Service interface.
@@ -7,7 +7,7 @@ package mock_periodicsync
import (
reflect "reflect"
gomock "go.uber.org/mock/gomock"
gomock "github.com/golang/mock/gomock"
)
// MockPeriodicSync is a mock of PeriodicSync interface.
+1 -1
View File
@@ -3,8 +3,8 @@ package periodicsync
import (
"context"
"github.com/anyproto/any-sync/app/logger"
"github.com/golang/mock/gomock"
"github.com/stretchr/testify/require"
"go.uber.org/mock/gomock"
"testing"
"time"
)