Re-implement Serialize
and Deserialize
for Catalog
as is done for its nested types
#25574
Labels
Serialize
and Deserialize
for Catalog
as is done for its nested types
#25574
Problem
The
Catalog
type does not implement theDeserialize
trait, which means that if we try to nest it in another struct that needs to implementDeserialize
, then we run into headaches.Proposed solution
There exist several
_Snapshot
types in theserialize.rs
module that provide the minimum needed info for de/serialization of their related type in the catalog, e.g.,DatabaseSchema
/DatabaseSnapshot
,TableDefinition
/TableSnapshot
, etc.I propose that we re-use this pattern at the top level, and define a
CatalogSnapshot
in the sameserialize.rs
module, along with aimpl Deserialize
/impl Serialize
for theCatalog
type that uses it.Alternatives
Deserialize
forCatalog
as is. This should be as simple asAdditional context
The reason for the use of these
_Snapshot
types is to avoid serializing/deserializing the bi-directional maps of ID <-> name at the various levels of the catalog. Since the info in those maps is already intrinsic to the map of ID -> object (which includes the name), there is no need to also serialize/deserialize them. The top level is still serializing/deserializing the bi-directional map forDbId
<-> name, so following through with this would avoid that.The text was updated successfully, but these errors were encountered: