func SaveMatrixShard(client fs.Client, shard *pb.MatrixShard, path string) error { buf, seErr := toByte(shard) if seErr != nil { return seErr } writer, oErr := client.OpenWriteCloser(path) if oErr != nil { return oErr } _, wErr := writer.Write(buf) return wErr }
func LoadMatrixShard(client fs.Client, path string) (*pb.MatrixShard, error) { shard := &pb.MatrixShard{} reader, cErr := client.OpenReadCloser(path) if cErr != nil { return nil, cErr } buf, rdErr := ioutil.ReadAll(reader) if rdErr != nil { return nil, rdErr } rdErr = fromByte(buf, shard) if rdErr != nil { return nil, rdErr } return shard, nil }