diff --git a/commonspace/object/acl/syncacl/response/response.go b/commonspace/object/acl/syncacl/response/response.go index 5d44e6de..0f8a32c2 100644 --- a/commonspace/object/acl/syncacl/response/response.go +++ b/commonspace/object/acl/syncacl/response/response.go @@ -2,6 +2,7 @@ package response import ( "fmt" + "google.golang.org/protobuf/proto" "github.com/anyproto/any-sync/commonspace/spacesyncproto" diff --git a/commonspace/spacesyncproto/spacesync.go b/commonspace/spacesyncproto/spacesync.go index feae3a7b..64f27a0d 100644 --- a/commonspace/spacesyncproto/spacesync.go +++ b/commonspace/spacesyncproto/spacesync.go @@ -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 } diff --git a/protobuf/protobuf.go b/protobuf/protobuf.go index a2f400d3..62106d4c 100644 --- a/protobuf/protobuf.go +++ b/protobuf/protobuf.go @@ -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