Joystream / substrate-versioned-store-module

A version data store Substrate module
GNU General Public License v3.0
1 stars 4 forks source link

Make vector properties updatable as vectors #13

Open bedeho opened 5 years ago

bedeho commented 5 years ago

Currently, the only way to update values is to write a full new value through update_entity_properties, this undercuts the point of having native vectors, as one could easily just encode them if on-chain awareness was not important. So let's introduce property value level operations like clear, insert_at, remove_at for all vectors.

Notice that this requires the introduction of a nonce, or a similar mechanism, per property value to avoid race update conditions.

siman commented 5 years ago

Sounds like a good idea for insert_at and remove_at.

As for clear it could be easily achieved by passing an empty vector or None to the vec- property via update_entity_properties

Also makes sense to support append.