mirror of
https://github.com/anyproto/any-sync.git
synced 2025-06-08 05:57:03 +09:00
26 lines
651 B
Go
26 lines
651 B
Go
package syncacl
|
|
|
|
import (
|
|
"github.com/anyproto/any-sync/commonspace/sync/objectsync"
|
|
"github.com/anyproto/any-sync/consensus/consensusproto"
|
|
)
|
|
|
|
type InnerRequest struct {
|
|
head string
|
|
root *consensusproto.RawRecordWithId
|
|
}
|
|
|
|
func NewRequest(peerId, objectId, spaceId, head string, root *consensusproto.RawRecordWithId) *objectsync.Request {
|
|
return objectsync.NewRequest(peerId, spaceId, objectId, &InnerRequest{
|
|
head: head,
|
|
root: root,
|
|
})
|
|
}
|
|
|
|
func (r *InnerRequest) Marshall() ([]byte, error) {
|
|
req := &consensusproto.LogFullSyncRequest{
|
|
Head: r.head,
|
|
}
|
|
fullSync := consensusproto.WrapFullRequest(req, r.root)
|
|
return fullSync.Marshal()
|
|
}
|