1
0
Fork 0
mirror of https://github.com/anyproto/any-sync.git synced 2025-06-10 18:10:54 +09:00

Changes and request factory

This commit is contained in:
mcrakhman 2024-06-12 20:39:17 +02:00
parent 51f740cb90
commit 5c2923b440
No known key found for this signature in database
GPG key ID: DED12CFEF5B8396B
18 changed files with 293 additions and 1439 deletions

View file

@ -11,8 +11,8 @@ type CounterRequest struct {
*synctestproto.CounterRequest
}
func (c CounterRequest) Proto() proto.Message {
return c.CounterRequest
func (c CounterRequest) Proto() (proto.Message, error) {
return c.CounterRequest, nil
}
func NewCounterRequest(peerId, objectId string, counters []int32) CounterRequest {

View file

@ -23,7 +23,11 @@ func (c *CounterRequestSender) SendStreamRequest(ctx context.Context, rq syncdep
}
return pr.DoDrpc(ctx, func(conn drpc.Conn) error {
cl := synctestproto.NewDRPCCounterSyncClient(conn)
stream, err := cl.CounterStreamRequest(ctx, rq.Proto().(*synctestproto.CounterRequest))
req, err := rq.Proto()
if err != nil {
return err
}
stream, err := cl.CounterStreamRequest(ctx, req.(*synctestproto.CounterRequest))
if err != nil {
return err
}

View file

@ -26,7 +26,7 @@ func (c *CounterSyncHandler) HandleHeadUpdate(ctx context.Context, headUpdate dr
return c.updateHandler.HandleHeadUpdate(ctx, headUpdate)
}
func (c *CounterSyncHandler) TryAddMessage(ctx context.Context, msg drpc.Message, q *mb.MB[drpc.Message]) error {
func (c *CounterSyncHandler) TryAddMessage(ctx context.Context, id string, msg drpc.Message, q *mb.MB[drpc.Message]) error {
return q.TryAdd(msg)
}