-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unify pkgs and styx #12
Comments
As of this commit, Styx has replaced its HTTP API with a use-as-a-library Playing around with possible type Index interface {
Add(pathname []string, resource Resource)
Remove(pathname []string, resource Resource)
Signatures() []Signature
}
type Signature interface {
Head() []*ld.Quad
Domain() []string
}
// Resource is interface type for resources (packages, messages, and files)
type Resource interface {
ETag() (cid.Cid, string)
URI() string
} It feels like unifying query-style access to indices (the "output interface") is just as important as unifying the add/remove functions (the "input interface"), so that's what For example, an index that lets you look up an ID from a schema.org name (but not the other way around) would have a signature with a head of
and a domain of []string{"_:name"} ... but an index that lets you look up a name from an ID would have the same head, but a domain of []string{"_:id"} This still is only an interface for selecting which indices match a query, and not actually querying them (we could potentially re-use the Cursor interface from Styx), but it's a start. |
--- More thoughts --- This would mean a JavaScript library to expose like const { Cursor } = require("styx-client")
const pattern = {
"@context": "ipfs://Qm...",
"name": "...",
"properties": { ... }
}
const cursor = new Cursor(pattern, "http://localhost:8086")
cursor.graph // returns the current value as an N3Store or JSON-LD object or something
cursor.next() // advances to next solution
cursor.seek(cursor.domain[3]) // ...
cursor.close() |
--- More thoughts ---
Both of these get exposed as libp2p protocols |
Joel's Current Grand Vision is to unify styx and pkgs so that pkgs has a plugin architecture that can integrate any index (i.e. database index) that satisfies some interface.
In my mind right now this interface is just
... which styx can be refactored to implement.
For now each index would be responsible for providing its own usage endpoint (i.e. styx would still attach an API handler to some other port) but that is also something that should be unified under pkgs in the future.
The text was updated successfully, but these errors were encountered: