ashcrow / bluesnake

Python library for the Lightblue Platform
MIT License
2 stars 0 forks source link

Decide on API abstraction method #1

Open ashcrow opened 10 years ago

ashcrow commented 10 years ago

Should this follow the DB API (http://legacy.python.org/dev/peps/pep-0249/), an API defined by the Light Blue platform (to be consistent across languages) or a Pythonic yet specific implementation on it's own (like pymongo).

ashcrow commented 10 years ago

Looking for thoughts before coding starts.

CC: @bserdar @jewzaam @svanoort (feel free to add anyone else who may have an opinion)

bserdar commented 10 years ago

Is this going to be a thin api that gets and returns json docs for request and response, or is this going to be an abstraction layer with python representations for queries, projections, etc., and documents as json?

On Wed, Jun 18, 2014 at 7:21 AM, Steve Milner notifications@github.com wrote:

Looking for thoughts before coding starts.

CC: @bserdar https://github.com/bserdar @jewzaam https://github.com/jewzaam @svanoort https://github.com/svanoort (feel free to add anyone else who may have an opinion)

— Reply to this email directly or view it on GitHub https://github.com/ashcrow/bluesnake/issues/1#issuecomment-46434167.

ashcrow commented 10 years ago

@bserdar That's up for discussion. My original thought was a thin api and then build a layer on top to be either DB API compatible or it's own Python access method.

bserdar commented 10 years ago

So, for CRUD part, a thin api that uses the rest endpoint:

https://github.com/lightblue-platform/lightblue/blob/master/lightblue-rest/crud/src/main/java/com/redhat/lightblue/rest/crud/CrudResource.java

If you build a layer on top of that to present input/output structures as python objects, it'd be something matching this API:

https://github.com/lightblue-platform/lightblue/blob/master/lightblue-core/crud/src/main/java/com/redhat/lightblue/mediator/Mediator.java

With this, any changes to the Lightblue API will break things.

After taking a quick look at the DB API, I can't think of a way to map the Lightblue APIs to something compatible to DB API.

My vote in this situation would be to build a thin API that deals with REST specifics that doesn't do anything with the JSON input/output contents, and reconsider options once things settle a bit.

On Wed, Jun 18, 2014 at 7:58 AM, Steve Milner notifications@github.com wrote:

@bserdar https://github.com/bserdar That's up for discussion. My original thought was a thin api and then build a layer on top to be either DB API compatible or it's own Python access method.

— Reply to this email directly or view it on GitHub https://github.com/ashcrow/bluesnake/issues/1#issuecomment-46438677.

ashcrow commented 10 years ago

:+1: Thanks @bserdar