also migrate jsonpb

This commit is contained in:
chrislu
2022-08-17 12:42:03 -07:00
parent eaeb141b09
commit 2b580a7566
15 changed files with 47 additions and 85 deletions

View File

@@ -13,7 +13,7 @@ import (
"github.com/seaweedfs/seaweedfs/weed/pb/filer_pb"
"github.com/seaweedfs/seaweedfs/weed/util"
"github.com/viant/ptrie"
"google.golang.org/protobuf/jsonpb"
jsonpb "google.golang.org/protobuf/encoding/protojson"
)
const (
@@ -93,7 +93,7 @@ func (fc *FilerConf) loadFromChunks(filer *Filer, content []byte, chunks []*file
func (fc *FilerConf) LoadFromBytes(data []byte) (err error) {
conf := &filer_pb.FilerConf{}
if err := jsonpb.Unmarshal(bytes.NewReader(data), conf); err != nil {
if err := jsonpb.Unmarshal(data, conf); err != nil {
return err
}
@@ -181,11 +181,5 @@ func (fc *FilerConf) ToProto() *filer_pb.FilerConf {
}
func (fc *FilerConf) ToText(writer io.Writer) error {
m := jsonpb.Marshaler{
EmitDefaults: false,
Indent: " ",
}
return m.Marshal(writer, fc.ToProto())
return ProtoToText(writer, fc.ToProto())
}