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:
parent
51f740cb90
commit
5c2923b440
18 changed files with 293 additions and 1439 deletions
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue