You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Background: there are strict_serialize_to_file and to_strict_serialized methods in the strict_type, at the 0.11-beta.6 now, we have an fs module to store index, state, and stash data into a local dat format file. (strict_serialize_to_file is used here)
But if people want to store the bytes data in their KV database but not the file, such that I want to set the key as the contract id, and the value as the schema bytes data. Then I can use the to_strict_serialized method to serialize the schema into bytes, then store it in my local leveldb or other KV database.
And when I want to construct the stock runtime, then I can first load the bytes data from the KV database, then use the from_strict_serialized method to deserialize the bytes into the index, stash, and state struct. (Finally, I can build a stock runtime with them).
So I want to ask if there are any possibilities for us to add to_strict_serialized, and from_strict_serialized into a new storage module(like fs), then we can add new store_bytes, and load_bytes traits into stash, state, and index provider. Such as: impl StoreBytes for MemState { fn store_bytes(&self, bytes_data: Vec<u8>) -> Result<(), SerializeError> { self.to_strict_serialized::<U32>(bytes_data); } }
Background: there are
strict_serialize_to_file
andto_strict_serialized
methods in the strict_type, at the 0.11-beta.6 now, we have an fs module to storeindex
,state
, andstash
data into a local dat format file. (strict_serialize_to_file
is used here)But if people want to store the bytes data in their KV database but not the file, such that I want to set the key as the contract id, and the value as the schema bytes data. Then I can use the
to_strict_serialized
method to serialize the schema into bytes, then store it in my local leveldb or other KV database.And when I want to construct the
stock
runtime, then I can first load the bytes data from the KV database, then use thefrom_strict_serialized
method to deserialize the bytes into theindex
,stash
, andstate
struct. (Finally, I can build a stock runtime with them).So I want to ask if there are any possibilities for us to add
to_strict_serialized
, andfrom_strict_serialized
into a new storage module(like fs), then we can add newstore_bytes
, andload_bytes
traits intostash
,state
, andindex
provider. Such as:impl StoreBytes for MemState { fn store_bytes(&self, bytes_data: Vec<u8>) -> Result<(), SerializeError> { self.to_strict_serialized::<U32>(bytes_data); } }
impl LoadBytes for MemState { fn load_bytes(bytes_data: Vec<u8>) -> Result<Self, DeserializeError> { Self::from_strict_serialized::<U32>(bytes_data) } }
The text was updated successfully, but these errors were encountered: