Skip to content
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

Multilevel Support #60

Closed
wants to merge 3 commits into from
Closed

Multilevel Support #60

wants to merge 3 commits into from

Conversation

mcollina
Copy link
Collaborator

It's time to add multilevel support into LevelGraph, so we can query a remote database from the web and/or other sources.

As far as I get it, we should just add:

db.methods = {
  graph: {
    type: 'object', 
    methods: {
      get: {type: 'async'},
      getStream: {type: 'readable'}
      //... all LevelGraph methods
    }
  }
}

And everything should 'just work': it's standard multilevel + level-manifest.

@tgvashworth
Copy link
Contributor

👍 (sorry, not much more to contribute!)

@mcollina
Copy link
Collaborator Author

We are blocked by juliangruber/multilevel#41 as multilevel has not yet nested object support, but it is in a separate branch.

@mcollina
Copy link
Collaborator Author

I've added support for partial multilevel support for put, get and search. Stream are not working.

Everything is based on juliangruber/multilevel#41.

@juliangruber
Copy link
Contributor

i'll release as soon as we fix this

@juliangruber
Copy link
Contributor

how exactly is the stream not working? debugging via multilevel.server(db).on('data', console.log.bind(null, 'S ->')) etc helps a lot

@mcollina
Copy link
Collaborator Author

Here is the error:

  1) a multileveled triple store should put a triple with a stream:
     Uncaught Error: stream is not writable: b4d8d8fa9495684c
      at Error (<anonymous>)
      at Stream.<anonymous> (/Users/matteo/Repositories/levelgraph/node_modules/multilevel/node_modules/mux-demux/inject.js:93:19)
      at Stream.stream.write (/Users/matteo/Repositories/levelgraph/node_modules/multilevel/node_modules/mux-demux/node_modules/through/index.js:26:11)
      at write (/Users/matteo/Repositories/levelgraph/node_modules/readable-stream/lib/_stream_readable.js:586:24)
      at Array.forEach (native)
      at flow (/Users/matteo/Repositories/levelgraph/node_modules/readable-stream/lib/_stream_readable.js:597:19)
      at /Users/matteo/Repositories/levelgraph/node_modules/readable-stream/lib/_stream_readable.js:563:7
      at process._tickCallback (node.js:415:13)

It seems multilevel does not recognize that the stream is writable.
Also, put() in the nested object works even if I do not put the definition in the manifest.

Here is the output you asked for:

S -> ["b2521de8ca94c32b","close"]

S -> ["c2e379d1a4e44882","close"]

Not really useful :(.

@juliangruber
Copy link
Contributor

put is there because it's part of the default levelup methods, as are get, createKeyStream etc. If you don't want these, pass false as the 2nd argument to level-manifest (https://github.com/dominictarr/level-manifest/blob/master/index.js#L33).

I'll try to look into the stream issue soon.

@mcollina
Copy link
Collaborator Author

put is not in the manifest for the nested object, but only for the
'main' db, yet it's exposed to remote calls: I'll open up a separate issue
on multilevel for this.
Nested objects are not sublevels and may not share levelup API.

This was referenced Feb 2, 2014
Closed
sballesteros referenced this pull request in scienceai/mesh-tree Oct 24, 2015
@transcranial
Copy link

@mcollina we're trying to use levelgraph with multilevel in the way you reference here, by forwarding leveldb with multilevel and then initializing levelgraph on that. Attempts have been unsuccessful unfortunately. Would you have any tips to point us in the right direction, given interval changes in packages, api, etc.? Thanks!

@transcranial
Copy link

I think the above pull request should do the trick!

@mcollina
Copy link
Collaborator Author

Thanks!! :)

@mcollina mcollina closed this Oct 26, 2015
@mcollina mcollina deleted the multilevel branch October 26, 2015 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants