Debian Codegraph @

internal/serialization/README.md

raw
1 # Serialization #
2
3 This pseudopackage of sorts handles serialization. The "Canonical" serialized data structure is found in the `pb` subdirectory.
4
5 # Protobuf generation
6
7 Proteus needs to be installed, as does its dependencies.
8
9
10 1. `cd pb`
11 2. `rm generated*`
12 3. `proteus -f ../../IDLs -p gorgonia.org/tensor/internal/serialization/pb`
13 4. `cd ../../IDLs`
14 5. `find gorgonia.org/ -mindepth 2 -type f -exec mv -i '{}' . ';'`
15 6. `rm -rf gorgonia.org`
16
17
18 # FlatBuffer generation
19 1. generate protobuf first
20 2. delete the `import "github.com/gogo/protobuf/gogoproto/gogo.proto";` line from the generated protobuf file
21 3. `flatc --proto PATH/TO/generated.proto`
22 4. place the `generated.fbs` file in the IDLs directory
23 4. restore the import line in the `generated.proto` file
24 5. From this directory: `flatc --go-namespace fb -g PATH/TO/generated.fbs`
25
26
27 # Notes #
28
29 `find gorgonia.org/ -mindepth 2 -type f -exec mv -i '{}' . ';'` is used to flatten and put all the stuff in the root IDLs directory.
30
31 # The Serialization Story #
32
33 To serialize, we copy/convert/coerce the data to the internal/serialization data structures, then call the `Marshall` methods from there