Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decide on storage format for database + versioning #99

Open
yaymukund opened this issue Jun 22, 2021 · 1 comment
Open

Decide on storage format for database + versioning #99

yaymukund opened this issue Jun 22, 2021 · 1 comment

Comments

@yaymukund
Copy link
Contributor

There are broadly two approaches we've considered:

  1. impl sqlx::Encode/Decode for all the important types. This doesn't work transitively - if my parent struct is composed of fields that are all Encode/Decode then I need to either insert the struct as a table (i.e. each field gets its own column) or I need to impl Encode/Decode for the parent struct. But this gives us complete control over how we represent the data.

  2. Rely on bincode::serialize/deserialize for complex structs. This lets us reuse a macro impl_sqlx_for_bincode_ty!(Foo) that simply calls bincode::serialize/deserialize to Encode/Decode for any struct that implements Serialize/Deserialize.

It looks like bincode provides some fairly strong storage guarantees so long-term I am leaning towards approach 2, perhaps wrapped to include some version bytes at the front.

@yaymukund
Copy link
Contributor Author

I've moved this into the "Maybe milestone 4" epic since this isn't part of M3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant