-
Notifications
You must be signed in to change notification settings - Fork 18
Description
I'd like to allow users craft paths, such as user.blog.like() and capture it in JSON, to later on re-create path Proxy and execute on say another machine.
Any tips on how this can be done? @jblemee @rubensworks @RubenVerborgh
(this is not an issue, rather I'd like to know your thougths on it and did not know how to better contact for a discussion)
Motivation
My motivation behind it is to capture dispatched paths in a distributed event log, and playback that log, recreating RDF Store on peers. This way we'd have transactional guarantees, as peers that dispatch event end up with an eventually consistent state of the log and RDF Store consequently.
The architecture overall resembles that of Solid, only if a Solid Pod would contain not an RDF Store but event log.
Here is a sketch of this architecture (it refers to Clojure's re-frame in some places).

Current implementation details
Atm I'm trying to do so via a custom .dispatch() handler, that goes through pathData and outputs JSON, which I later on send to other users. This bit works fine, however I'm struggling to re-create the original path to execute on other users' side, I think I'll make it work in the end and thought maybe you can give some tips on how to best do it to ease the battle.:)
Atm I'm trying to re-create it via
const computeRDFStoreInner2 = async (events, rootPath) => {
await events.map(async (arrayPath) => {
const path = arrayPath.reduce(async (pathCurrentPromise, { property, args }) => {
const pathCurrent = await pathCurrentPromise
const newPathCurrent = await pathCurrent.get(property)
const newPathCurrent2 = !args ? newPathCurrent : await newPathCurrent(args)
return newPathCurrent2
}, new Promise((resolve, reject) => resolve(rootPath)))
await path
})
return null
}Where events are captured as
[ [{property: "fov"}, {property: "set", args: [90]}] ]
That's been serialized on dispatch from db.fov.set(90).dispatch()
Aand it doesn't work, throwing
handler.handle(...) is not a function