stratisd
stratisd copied to clipboard
Serialization of UUIDs
See: https://github.com/rust-lang-nursery/uuid/issues/90.
I don't think this change causes a problem, but we should review what we do wrt. it and update our docs accordingly.
To match the spec's definition of serialized uuids we will need to do something here, since serde puts dashes in uuids by default.
We should consider whether following the spec will make our lives harder to no advantage before we go further.
Also, I'm not sure that serde puts dashes in uuids by default anymore, I think it uses the raw numbers.
There are dashes in our JSON metadata's uuids, which bothers me because I'd really like to be consistently no-hyphens everywhere (cmdline, D-Bus API, internally).
The dashes are because of how uuid::Uuid
implements Serializable
, and we're using these in our code with just type
aliases. We could override default serialization in serde (using "serialize_with") for simple uuid struct members but I ran into trouble overriding e.g. Option<Vec<(Uuid, Sectors, Sectors)>>
members.
Or, we could change serde struct definitions to String from Uuid, and then convert manually in/out. It's a +80 line patch. Not worth it.
So I'm giving up on total consistency for the moment. We should strive to represent UUIDs externally always as non-hyphenated, and if we someday accept a uuid parameter only accept non-hyphenated, but our dark secret can be uuids are hyphenated in our json metadata :man_shrugging: