Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
3ddd528
dummy handler and test
zarkone Mar 7, 2025
9f32d43
stream, wip
zarkone Mar 11, 2025
6b2b6aa
wip
zarkone Mar 12, 2025
2030e4a
dummy inbox service
zarkone Mar 13, 2025
3b628fa
add some logs
zarkone Mar 13, 2025
2c1f7a8
init inbox_test
zarkone Mar 14, 2025
dabc3b8
wip
zarkone Mar 14, 2025
d762d75
close chan err
zarkone Mar 17, 2025
c06a27f
add inbox message go structs for mongo
zarkone Mar 17, 2025
838897a
AddInboxMessage
zarkone Mar 17, 2025
b07f762
inbox add message rpc and init mongo
zarkone Mar 17, 2025
ce4ac2f
add notifyStreams; connect to mongo insert
zarkone Mar 18, 2025
3a852e2
test, send event to myself
zarkone Mar 18, 2025
747248b
rm stream/ for now
zarkone Mar 19, 2025
1b2938c
move key type to payload
zarkone Mar 19, 2025
41b7874
inbox fetch offset
zarkone Mar 19, 2025
47d1e59
use accountid instead of peerid
zarkone Mar 21, 2025
b951ad8
add support for hasMore
zarkone Mar 21, 2025
be19cef
verify message body with account key
zarkone Mar 21, 2025
b3107d7
fill msg fields
zarkone Mar 21, 2025
986748b
use stream context done to free subscribe handler
zarkone Mar 24, 2025
084ff48
use peerId map to keep streams
zarkone Mar 24, 2025
d50dae7
add, remove, waitClose streams (streams cleanup)
zarkone Mar 25, 2025
973be26
fmt
zarkone Mar 25, 2025
3a007ee
move inbox coll from db to inbox
zarkone Mar 25, 2025
d4d518e
inbox_test: setup db mock
zarkone Mar 25, 2025
0095758
move inbox create and verify out of rpc
zarkone Mar 25, 2025
c7b12fc
inbox add message test wip
zarkone Mar 25, 2025
acd274a
move logic out of rpc handler
zarkone Mar 26, 2025
9d329fb
add message verify simple
zarkone Mar 26, 2025
d003d88
InboxVerifyFail test
zarkone Mar 26, 2025
cb89763
test: InboxAddMessage / Fetch
zarkone Mar 28, 2025
61544f8
test: InboxFetch + offset
zarkone Mar 28, 2025
56f84f7
test: InboxFetch adds HasMore
zarkone Mar 28, 2025
3524285
go mod
zarkone Mar 28, 2025
f553c45
remove query for ts; add index
zarkone Mar 31, 2025
17b4dbd
add lock for notifyClient
zarkone Mar 31, 2025
d3c7263
preseed db to reduce test time
zarkone Apr 4, 2025
1042f50
Setup RPC / integration tests env
zarkone Apr 4, 2025
04e59ef
give same nodeconfig to both client and server
zarkone Apr 4, 2025
9342658
wip: mongo stream.Next is not triggered
zarkone Apr 4, 2025
c9ba5be
re-subs to mongostream in tests
zarkone Apr 7, 2025
3f4cc79
test, get notification and fetch after
zarkone Apr 7, 2025
f93977b
use amount var
zarkone Apr 7, 2025
56f886f
wrapped inbox wip
zarkone Apr 7, 2025
a60139a
move subscribe out from inbox
zarkone Apr 9, 2025
34f52b3
codereview
zarkone Apr 10, 2025
199d7f3
inboxrpctest, use the same account
zarkone Apr 11, 2025
8d203a1
bump Id and Time types
zarkone Apr 11, 2025
5685ee5
subsclientwrapper
zarkone Apr 11, 2025
d27bfde
hack to wait; todo
zarkone Apr 11, 2025
f7288f0
add mock_inbox; fix coordinator test
zarkone Apr 11, 2025
fea44a4
subscribeService
zarkone Apr 14, 2025
58f25e9
sort by id
zarkone Apr 14, 2025
c597fac
unify NotifySubscribe; move Subscribe out of inbox
zarkone Apr 14, 2025
6c01bfb
add subscribe mock
zarkone Apr 15, 2025
37ba056
inbox service, add mocks
zarkone Apr 15, 2025
ed32d20
fix inboxrpc test
zarkone Apr 15, 2025
b7e727f
pass context with cancel to mongo stream listener
zarkone Apr 22, 2025
c65a073
inbox, move constants to config
zarkone Apr 22, 2025
4a65d24
fix config in inbox test
zarkone Apr 22, 2025
f781a20
instead of errorf, use coordinator error codes
zarkone Apr 22, 2025
e417177
nodesync
zarkone Sep 29, 2025
4c3aa79
adopt validateSpaceHeader for V1 space header
zarkone Oct 8, 2025
169ca1d
Merge remote-tracking branch 'origin/main' into go-6218-generate-shar…
zarkone Oct 8, 2025
7f0db8d
Merge branch 'go-6218-generate-shared-identity' into go-4493-inbox-fo…
zarkone Oct 8, 2025
a3d0a12
conf limits
zarkone Oct 8, 2025
a2fffcb
verify oneToOne space header on SpaceSign
zarkone Oct 8, 2025
3fac9d1
Merge branch 'go-6218-generate-shared-identity' into go-4493-inbox-fo…
zarkone Oct 8, 2025
3f944da
fix typo
zarkone Oct 10, 2025
5ad8db9
bump anysync@main
zarkone Oct 24, 2025
394ff57
Merge remote-tracking branch 'origin/main' into go-4493-inbox-for-inv…
zarkone Oct 24, 2025
9d750e3
remove printf
zarkone Oct 24, 2025
528d4a8
any-sync v0.11.1
zarkone Oct 24, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.PHONY: build test deps build-dev
SHELL=/bin/bash
SHELL=/usr/bin/env bash
export GOPRIVATE=github.com/anyproto
export PATH:=$(CURDIR)/deps:$(PATH)
export CGO_ENABLED:=1
Expand Down Expand Up @@ -28,4 +28,3 @@ deps:
mocks:
echo 'Generating mocks...'
go generate ./...

4 changes: 4 additions & 0 deletions cmd/coordinator/coordinator.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ import (
"github.com/anyproto/any-sync-coordinator/db"
"github.com/anyproto/any-sync-coordinator/deletionlog"
"github.com/anyproto/any-sync-coordinator/identityrepo"
"github.com/anyproto/any-sync-coordinator/inbox"
"github.com/anyproto/any-sync-coordinator/nodeconfsource"
"github.com/anyproto/any-sync-coordinator/spacestatus"
"github.com/anyproto/any-sync-coordinator/subscribe"

// import this to keep govvv in go.mod on mod tidy
_ "github.com/ahmetb/govvv/integration-test/app-different-package/mypkg"
Expand Down Expand Up @@ -124,6 +126,8 @@ func Bootstrap(a *app.App) {
Register(spacestatus.New()).
Register(consensusclient.New()).
Register(acl.New()).
Register(subscribe.New()).
Register(inbox.New()).
Register(accountlimit.New()).
Register(identityrepo.New()).
Register(coordinator.New()).
Expand Down
6 changes: 6 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (

"github.com/anyproto/any-sync-coordinator/accountlimit"
"github.com/anyproto/any-sync-coordinator/db"
"github.com/anyproto/any-sync-coordinator/inbox"
"github.com/anyproto/any-sync-coordinator/spacestatus"
)

Expand All @@ -40,6 +41,7 @@ type Config struct {
NetworkUpdateIntervalSec int `yaml:"networkUpdateIntervalSec"`
Mongo db.Mongo `yaml:"mongo"`
SpaceStatus spacestatus.Config `yaml:"spaceStatus"`
Inbox inbox.Config `yaml:"inbox"`
Yamux yamux.Config `yaml:"yamux"`
Quic quic.Config `yaml:"quic"`
AccountLimits accountlimit.SpaceLimits `yaml:"defaultLimits"`
Expand Down Expand Up @@ -77,6 +79,10 @@ func (c Config) GetSpaceStatus() spacestatus.Config {
return c.SpaceStatus
}

func (c Config) GetInbox() inbox.Config {
return c.Inbox
}

func (c Config) GetNodeConfStorePath() string {
return c.NetworkStorePath
}
Expand Down
17 changes: 16 additions & 1 deletion coordinator/coordinator.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ import (
"github.com/anyproto/any-sync-coordinator/config"
"github.com/anyproto/any-sync-coordinator/coordinatorlog"
"github.com/anyproto/any-sync-coordinator/deletionlog"
"github.com/anyproto/any-sync-coordinator/inbox"
"github.com/anyproto/any-sync-coordinator/spacestatus"
"github.com/anyproto/any-sync-coordinator/subscribe"
)

var (
Expand Down Expand Up @@ -68,6 +70,8 @@ type coordinator struct {
deletionLog deletionlog.DeletionLog
accountLimit accountlimit.AccountLimit
acl acl.AclService
inbox inbox.InboxService
subscribe subscribe.SubscribeService
drpcHandler *rpcHandler
pool pool.Service
}
Expand All @@ -81,8 +85,10 @@ func (c *coordinator) Init(a *app.App) (err error) {
c.spaceStatus = a.MustComponent(spacestatus.CName).(spacestatus.SpaceStatus)
c.coordinatorLog = a.MustComponent(coordinatorlog.CName).(coordinatorlog.CoordinatorLog)
c.metric = a.MustComponent(metric.CName).(metric.Metric)
c.subscribe = a.MustComponent(subscribe.CName).(subscribe.SubscribeService)
c.deletionLog = app.MustComponent[deletionlog.DeletionLog](a)
c.acl = app.MustComponent[acl.AclService](a)
c.inbox = app.MustComponent[inbox.InboxService](a)
c.accountLimit = app.MustComponent[accountlimit.AccountLimit](a)
c.aclEventLog = app.MustComponent[acleventlog.AclEventLog](a)
c.pool = a.MustComponent(pool.CName).(pool.Service)
Expand Down Expand Up @@ -208,7 +214,7 @@ func (c *coordinator) SpaceSign(ctx context.Context, spaceId string, spaceHeader
if err != nil {
return
}
err = spacepayloads.ValidateSpaceHeader(&spacesyncproto.RawSpaceHeaderWithId{RawHeader: spaceHeader, Id: spaceId}, accountPubKey)
_, err = spacepayloads.ValidateSpaceHeader(&spacesyncproto.RawSpaceHeaderWithId{RawHeader: spaceHeader, Id: spaceId}, accountPubKey, nil, nil)
if err != nil {
return
}
Expand Down Expand Up @@ -465,3 +471,12 @@ func (c *coordinator) MakeSpaceUnshareable(ctx context.Context, spaceId, aclHead
EntryType: acleventlog.EntryTypeSpaceUnshared,
})
}

func (c *coordinator) InboxAddMessage(ctx context.Context, message *inbox.InboxMessage) (err error) {
err = c.inbox.InboxAddMessage(ctx, message)
return
}

func (c *coordinator) AddStream(eventType coordinatorproto.NotifyEventType, accountId, peerId string, stream coordinatorproto.DRPCCoordinator_NotifySubscribeStream) error {
return c.subscribe.AddStream(eventType, accountId, peerId, stream)
}
12 changes: 12 additions & 0 deletions coordinator/coordinator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,12 @@ import (
"github.com/anyproto/any-sync-coordinator/coordinatorlog/mock_coordinatorlog"
"github.com/anyproto/any-sync-coordinator/deletionlog"
"github.com/anyproto/any-sync-coordinator/deletionlog/mock_deletionlog"
"github.com/anyproto/any-sync-coordinator/inbox"
"github.com/anyproto/any-sync-coordinator/inbox/mock_inbox"
"github.com/anyproto/any-sync-coordinator/spacestatus"
"github.com/anyproto/any-sync-coordinator/spacestatus/mock_spacestatus"
"github.com/anyproto/any-sync-coordinator/subscribe"
"github.com/anyproto/any-sync-coordinator/subscribe/mock_subscribe"
)

var ctx = context.Background()
Expand Down Expand Up @@ -348,6 +352,8 @@ func newFixture(t *testing.T) *fixture {
coordLog: mock_coordinatorlog.NewMockCoordinatorLog(ctrl),
aclEventLog: mock_acleventlog.NewMockAclEventLog(ctrl),
deletionLog: mock_deletionlog.NewMockDeletionLog(ctrl),
inbox: mock_inbox.NewMockInboxService(ctrl),
subscribe: mock_subscribe.NewMockSubscribeService(ctrl),
acl: mock_acl.NewMockAclService(ctrl),
accountLimit: mock_accountlimit.NewMockAccountLimit(ctrl),
pool: mock_pool.NewMockService(ctrl),
Expand All @@ -359,6 +365,8 @@ func newFixture(t *testing.T) *fixture {
anymock.ExpectComp(fx.spaceStatus.EXPECT(), spacestatus.CName)
anymock.ExpectComp(fx.coordLog.EXPECT(), coordinatorlog.CName)
anymock.ExpectComp(fx.deletionLog.EXPECT(), deletionlog.CName)
anymock.ExpectComp(fx.inbox.EXPECT(), inbox.CName)
anymock.ExpectComp(fx.subscribe.EXPECT(), subscribe.CName)
anymock.ExpectComp(fx.acl.EXPECT(), acl.CName)
anymock.ExpectComp(fx.accountLimit.EXPECT(), accountlimit.CName)
anymock.ExpectComp(fx.aclEventLog.EXPECT(), acleventlog.CName)
Expand All @@ -373,6 +381,8 @@ func newFixture(t *testing.T) *fixture {
Register(fx.aclEventLog).
Register(metric.New()).
Register(fx.deletionLog).
Register(fx.inbox).
Register(fx.subscribe).
Register(fx.acl).
Register(fx.accountLimit).
Register(fx.pool).
Expand All @@ -391,6 +401,8 @@ type fixture struct {
coordLog *mock_coordinatorlog.MockCoordinatorLog
aclEventLog *mock_acleventlog.MockAclEventLog
deletionLog *mock_deletionlog.MockDeletionLog
subscribe *mock_subscribe.MockSubscribeService
inbox *mock_inbox.MockInboxService
acl *mock_acl.MockAclService
accountLimit *mock_accountlimit.MockAccountLimit
pool *mock_pool.MockService
Expand Down
Loading