Serialization
This pseudopackage of sorts handles serialization. The "Canonical" serialized data structure is found in the pb
subdirectory.
Protobuf generation
Proteus needs to be installed, as does its dependencies.
cd pb
rm generated*
proteus -f ../../IDLs -p gorgonia.org/tensor/internal/serialization/pb
cd ../../IDLs
find gorgonia.org/ -mindepth 2 -type f -exec mv -i '{}' . ';'
rm -rf gorgonia.org
FlatBuffer generation
- generate protobuf first
- delete the
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
line from the generated protobuf file
flatc --proto PATH/TO/generated.proto
- place the
generated.fbs
file in the IDLs directory
- restore the import line in the
generated.proto
file
- From this directory:
flatc --go-namespace fb -g PATH/TO/generated.fbs
Notes
find gorgonia.org/ -mindepth 2 -type f -exec mv -i '{}' . ';'
is used to flatten and put all the stuff in the root IDLs directory.
The Serialization Story
To serialize, we copy/convert/coerce the data to the internal/serialization data structures, then call the Marshall
methods from there