SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.
Go blob-storagecloud-drivedistributed-file-systemdistributed-storageerasure-codingfusehadoop-hdfshdfskuberneteslancelancedbobject-storageposixs3s3-storageseaweedfstiered-file-systemvector-search
package pb
import (
"fmt"
"testing"
"github.com/seaweedfs/seaweedfs/weed/pb/volume_server_pb"
jsonpb "google.golang.org/protobuf/encoding/protojson"
)
func TestJsonpMarshalUnmarshal(t *testing.T) {
tv := &volume_server_pb.RemoteFile{
BackendType: "aws",
BackendId: "",
FileSize: 12,
}
m := jsonpb.MarshalOptions{
EmitUnpopulated: true,
Indent: " ",
}
if text, err := m.Marshal(tv); err != nil {
fmt.Printf("marshal error: %v\n", err)
} else {
fmt.Printf("marshalled: %s\n", string(text))
}
rawJson := `{
"backendType":"aws",
"backendId":"temp",
"fileSize":12
}`
tv1 := &volume_server_pb.RemoteFile{}
if err := jsonpb.Unmarshal([]byte(rawJson), tv1); err != nil {
fmt.Printf("unmarshal error: %v\n", err)
}
fmt.Printf("unmarshalled: %+v\n", tv1)
}