mirror of
https://github.com/anyproto/any-sync.git
synced 2025-06-08 05:57:03 +09:00
rename protobuf.ProtoBuf -> protobuf.Message
This commit is contained in:
parent
5d2217aae8
commit
914642fb5b
3 changed files with 5 additions and 4 deletions
|
@ -2,6 +2,7 @@ package response
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
|
||||
"github.com/anyproto/any-sync/commonspace/spacesyncproto"
|
||||
|
|
|
@ -20,7 +20,7 @@ type ClientFactory interface {
|
|||
}
|
||||
|
||||
func MarshallSyncMessage(message proto.Message, spaceId, objectId string) (objMsg *ObjectSyncMessage, err error) {
|
||||
payload, err := message.(protobuf.ProtoBuf).MarshalVT()
|
||||
payload, err := message.(protobuf.Message).MarshalVT()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
type ProtoBuf interface {
|
||||
type Message interface {
|
||||
SizeVT() (n int)
|
||||
MarshalVT() (dAtA []byte, err error)
|
||||
UnmarshalVT(dAtA []byte) error
|
||||
|
@ -15,7 +15,7 @@ type ProtoBuf interface {
|
|||
}
|
||||
|
||||
func MarshalAppend(buf []byte, pb proto.Message) ([]byte, error) {
|
||||
if m, ok := pb.(ProtoBuf); ok {
|
||||
if m, ok := pb.(Message); ok {
|
||||
siz := m.SizeVT()
|
||||
offset := len(buf)
|
||||
buf = slices.Grow(buf, offset+siz)[:offset+siz]
|
||||
|
@ -24,7 +24,7 @@ func MarshalAppend(buf []byte, pb proto.Message) ([]byte, error) {
|
|||
return nil, fmt.Errorf("proto: MarshalAppend not supported by %T", pb)
|
||||
}
|
||||
|
||||
func MarshalToSizedBuffer(m ProtoBuf, b []byte, offset int) ([]byte, error) {
|
||||
func MarshalToSizedBuffer(m Message, b []byte, offset int) ([]byte, error) {
|
||||
_, err := m.MarshalToSizedBufferVT(b[offset:])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue