Skip to content

Commit

Permalink
Introspection (part 2) (#108)
Browse files Browse the repository at this point in the history
Following on from #107, this PR updates the serialization layer to store
types separately from the serialized graph of objects.

The protobuf `Type` message carries the same information as a
`reflect.Type`, with a bit of extra metadata. Types are stored in an
array where the index is the type's unique ID. This allows us to encode
a graph of types (potentially with cycles) by referencing types by ID.

I had to remove the global type cache in favor of a local cache on each
`Serializer` instance. This allows us to produce a succint array that
encodes just the types that are relevant to a particular serialized
state, rather than having to work with a subgraph of all types (and a
sparse set of type IDs).
  • Loading branch information
chriso authored Nov 17, 2023
2 parents 8a3b3a0 + 5dd2e8c commit 355bffc
Show file tree
Hide file tree
Showing 15 changed files with 2,521 additions and 578 deletions.
73 changes: 44 additions & 29 deletions gen/proto/go/coroutine/v1/coroutine.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

155 changes: 52 additions & 103 deletions gen/proto/go/coroutine/v1/coroutine_vtproto.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 355bffc

Please sign in to comment.