`BlockChain` should have a single `impl<T> Replica for BlockChain<T>`
haydnv opened this issue · comments
currently there are separate impls for CollectionBase
and each type of Cluster
Prerequisites:
- impl
FromStream
andIntoStream
forFile
andDir
Steps:
- update chain history so that the "previous hash" of the first block is the hash of the initial state of the subject of the chain
- update
BlockChain::create
andBlockChain::load
to accept an initial state rather than the schema of an initial state - store the initial state of the chain subject separately in the chain history
- update
BlockChain::into_view
so that it returns theDir
containing the initial state of the subject (not the subject itself) and updateBlockChain::from_stream
to validate that the initial hash is the hash of the initial state of the subject, then apply the mutations in the chain to the initial state of the subject in order to build the current state of the subject impl<T: Persist + Public> Replica for Chain<T>