Open jeffa5 opened 1 year ago
One possibility would be to use fork_at to obtain a copy of the document as at the given heads and then hydrate
from that.
@orionz is working on a reformulation of the ReadDoc
trait which rather than having _at
methods on it allows you to just obtain a ReadDoc
as at a given set of heads. Once that lands we should be able to update autosurgeon
to use that approach so you would be able to do something like:
let mydata: MyData = hydrate(doc.at(&heads))?
Ok, that sounds good. In the meantime I think I should be able to add a wrapper struct myself to use the _at
calls when needed.
I think fork_at
would be too expensive to be practical for this application but worth noting.
I'm currently wanting to use this for restoring values in a document both at the latest state as well as sometimes from historical versions, using
_at
queries with the list of heads.I can't see how to use autosurgeon's hydrate for this but I may be missing something. If it is missing I'd be happy to have a go at implementing it.