Does appendable-data maintain an ordering?

Based on the RFC for AppendableData here https://github.com/maidsafe/rfcs/blob/master/text/0038-appendable-data/0038-appendable-data.md it looks like PubAppendableData (and PrivAppendableData) keep their data in Rust’s BTreeSet, i.e. pub data : BTreeSet<AppendedData>. It looks like BTreeSet<T> expects T to implement Ord. Is Ord implemented for AppendedData anywhere? I haven’t been able to find it in the safe_core repo anywhere.

My ultimate reason for asking this is that I was wondering if Appended Data keeps a chronological ordering of the data that has been appended to it. My impression is that it does, based on the presence of functions like this https://github.com/maidsafe/safe_core/blob/29beecc552742d78e91f515e9af82d8d6af437e7/src/ffi/low_level_api/appendable_data.rs#L556. Is my understanding of that correct, and does it have something to do with the Ord implementation?

1 Like

Check the Data implementation in the Routing Repo

https://github.com/maidsafe/routing/blob/master/src/data/pub_appendable_data.rs

Ord is derived for AppendedData and it’s not chronological:
https://github.com/maidsafe/routing/blob/master/src/data/append_types.rs#L48
The idea is that it should be possible for the network to handle more append requests in parallel if the nodes don’t have to agree on an order for them.
That data type might change again in the future, however.

1 Like