🐳 Ocean DB driver interface(Python).
Project description
[![banner](https://raw.githubusercontent.com/oceanprotocol/art/master/github/repo-banner%402x.png)](https://oceanprotocol.com)
# oceandb-driver-interface
> 🐳 Ocean DB driver interface(Python).
> [oceanprotocol.com](https://oceanprotocol.com)
[![Travis (.com)](https://img.shields.io/travis/com/oceanprotocol/oceandb-driver-interface.svg)](https://travis-ci.com/oceanprotocol/oceandb-driver-interface)
[![PyPI](https://img.shields.io/pypi/v/oceandb-driver-interface.svg)](https://pypi.org/project/oceandb-driver-interface/)
[![GitHub contributors](https://img.shields.io/github/contributors/oceanprotocol/oceandb-driver-interface.svg)](https://github.com/oceanprotocol/oceandb-driver-interface/graphs/contributors)
---
## Table of Contents
- [Features](#features)
- [Quick-start](#quick-start)
- [Environment variables](#environment-variables)
- [Plugins availables](#plugins-availables)
- [How to develop a plugin](#how-to-develop-a-plugin)
- [Code style](#code-style)
- [Testing](#testing)
- [New Version](#new-version)
- [License](#license)
---
## Features
High-level, plugin-bound Ocean DB functions. You should implement a plugin class extending this module to connect with Ocean DB.
## Quick-start
Abstract interface for all persistence layer plugins.
Expects the following to be defined by the subclass:
* type - A string denoting the type of plugin (e.g. BigchainDB).
* write - Write an object in OceanDB
* read - Read the registry for a provided id
* update - Update an object in OceanDB
* delete - Delete the registry for a provided id
* list - List the elements saved in OceanDB
Once you have your plugin, the way to use it is the following:
You have to provide a configuration with the following information:
```yaml
[oceandb]
enabled=true # In order to enable or not the plugin
module=bigchaindb # You can use one the plugins already created. Currently we have mongodb and bigchaindb.
module.path= # You can specify the location of your custom plugin.
db.hostname=localhost # Address of your persistence.
db.port=9985 # Port of yout persistence database.
# In order to use SSL, configure below options.
db.ssl=true # If *true*, connections will be made using HTTPS, else using HTTP
db.verify_certs=false # If *true*, CA certificate will be verified
db.ca_cert_path= # If verifyCerts is *true*, then path to the CA cert should be provided here
db.client_key= # If db server needs client verification, then provide path to your client key
db.client_cert_path= # If db server needs client verification, then provide path to your client cert
# If you choose bigchaindb you have to provide this:
secret= # A secret that serves as a seed.
db.namespace=namespace # Namespace that you are going to use in bigchaindb
db.app_id= # App id of your bigchaindb application.
db.app_key= # App key of your bigchaindb application.
# If you choose mongodb you have to provide this:
db.username=travis # If you are using authentication, mongodb username.
db.password=test # If you are using authentication, mongodb password.
db.name=test # Mongodb database name
db.collection=col # Mongodb collection name
# If you choose elastic-search you have to provide this:
db.username=elastic # If you are using authentication, elasticsearch username.
db.password=changeme # If you are using authentication, elasticsearch password.
db.index=oceandb # Elasticsearch index name
```
## Environment variables
When you want to instantiate an Oceandb plugin you can provide the next environment variables:
- **$CONFIG_PATH** -> If you provide the config path Oceandb is going to run using this config values.
- **$MODULE** -> If you provide the module, you are going to select one of the modules.
## Plugins availables
At the moment we have developed two plugins:
* Bigchaindb (https://github.com/oceanprotocol/oceandb-bigchaindb-driver)
* Mongodb (https://github.com/oceanprotocol/oceandb-mongodb-driver)
## How to develop a plugin
To create a plugin you have to create a class called Plugin extending AbstractPlugin.
You could find an example in https://github.com/oceanprotocol/oceandb-bigchaindb-driver
## Code style
The information about code style in python is documented in this two links [python-developer-guide](https://github.com/oceanprotocol/dev-ocean/blob/master/doc/development/python-developer-guide.md)
and [python-style-guide](https://github.com/oceanprotocol/dev-ocean/blob/master/doc/development/python-style-guide.md).
## Testing
Automatic tests are setup via Travis, executing `tox`.
Our test use pytest framework.
## New Version
The `bumpversion.sh` script helps to bump the project version. You can execute the script using as first argument {major|minor|patch} to bump accordingly the version.
## License
```
Copyright 2018 Ocean Protocol Foundation Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
# oceandb-driver-interface
> 🐳 Ocean DB driver interface(Python).
> [oceanprotocol.com](https://oceanprotocol.com)
[![Travis (.com)](https://img.shields.io/travis/com/oceanprotocol/oceandb-driver-interface.svg)](https://travis-ci.com/oceanprotocol/oceandb-driver-interface)
[![PyPI](https://img.shields.io/pypi/v/oceandb-driver-interface.svg)](https://pypi.org/project/oceandb-driver-interface/)
[![GitHub contributors](https://img.shields.io/github/contributors/oceanprotocol/oceandb-driver-interface.svg)](https://github.com/oceanprotocol/oceandb-driver-interface/graphs/contributors)
---
## Table of Contents
- [Features](#features)
- [Quick-start](#quick-start)
- [Environment variables](#environment-variables)
- [Plugins availables](#plugins-availables)
- [How to develop a plugin](#how-to-develop-a-plugin)
- [Code style](#code-style)
- [Testing](#testing)
- [New Version](#new-version)
- [License](#license)
---
## Features
High-level, plugin-bound Ocean DB functions. You should implement a plugin class extending this module to connect with Ocean DB.
## Quick-start
Abstract interface for all persistence layer plugins.
Expects the following to be defined by the subclass:
* type - A string denoting the type of plugin (e.g. BigchainDB).
* write - Write an object in OceanDB
* read - Read the registry for a provided id
* update - Update an object in OceanDB
* delete - Delete the registry for a provided id
* list - List the elements saved in OceanDB
Once you have your plugin, the way to use it is the following:
You have to provide a configuration with the following information:
```yaml
[oceandb]
enabled=true # In order to enable or not the plugin
module=bigchaindb # You can use one the plugins already created. Currently we have mongodb and bigchaindb.
module.path= # You can specify the location of your custom plugin.
db.hostname=localhost # Address of your persistence.
db.port=9985 # Port of yout persistence database.
# In order to use SSL, configure below options.
db.ssl=true # If *true*, connections will be made using HTTPS, else using HTTP
db.verify_certs=false # If *true*, CA certificate will be verified
db.ca_cert_path= # If verifyCerts is *true*, then path to the CA cert should be provided here
db.client_key= # If db server needs client verification, then provide path to your client key
db.client_cert_path= # If db server needs client verification, then provide path to your client cert
# If you choose bigchaindb you have to provide this:
secret= # A secret that serves as a seed.
db.namespace=namespace # Namespace that you are going to use in bigchaindb
db.app_id= # App id of your bigchaindb application.
db.app_key= # App key of your bigchaindb application.
# If you choose mongodb you have to provide this:
db.username=travis # If you are using authentication, mongodb username.
db.password=test # If you are using authentication, mongodb password.
db.name=test # Mongodb database name
db.collection=col # Mongodb collection name
# If you choose elastic-search you have to provide this:
db.username=elastic # If you are using authentication, elasticsearch username.
db.password=changeme # If you are using authentication, elasticsearch password.
db.index=oceandb # Elasticsearch index name
```
## Environment variables
When you want to instantiate an Oceandb plugin you can provide the next environment variables:
- **$CONFIG_PATH** -> If you provide the config path Oceandb is going to run using this config values.
- **$MODULE** -> If you provide the module, you are going to select one of the modules.
## Plugins availables
At the moment we have developed two plugins:
* Bigchaindb (https://github.com/oceanprotocol/oceandb-bigchaindb-driver)
* Mongodb (https://github.com/oceanprotocol/oceandb-mongodb-driver)
## How to develop a plugin
To create a plugin you have to create a class called Plugin extending AbstractPlugin.
You could find an example in https://github.com/oceanprotocol/oceandb-bigchaindb-driver
## Code style
The information about code style in python is documented in this two links [python-developer-guide](https://github.com/oceanprotocol/dev-ocean/blob/master/doc/development/python-developer-guide.md)
and [python-style-guide](https://github.com/oceanprotocol/dev-ocean/blob/master/doc/development/python-style-guide.md).
## Testing
Automatic tests are setup via Travis, executing `tox`.
Our test use pytest framework.
## New Version
The `bumpversion.sh` script helps to bump the project version. You can execute the script using as first argument {major|minor|patch} to bump accordingly the version.
## License
```
Copyright 2018 Ocean Protocol Foundation Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file oceandb-driver-interface-0.2.0.tar.gz
.
File metadata
- Download URL: oceandb-driver-interface-0.2.0.tar.gz
- Upload date:
- Size: 10.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 56c858ae352d8ad645bb2c4b1e381be74931dd17f432ef556246de1de5980a97 |
|
MD5 | 69f2b8009ae4ebae0bd83f64b0223fda |
|
BLAKE2b-256 | 0d1e145063b12e561f6df7803d7b82f29be3ac309e08c30ce07ae8ff1a66b72d |
File details
Details for the file oceandb_driver_interface-0.2.0-py2.py3-none-any.whl
.
File metadata
- Download URL: oceandb_driver_interface-0.2.0-py2.py3-none-any.whl
- Upload date:
- Size: 11.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 11ccdd807a1211522ce084947bc66ee00f579815368c2b69a2a4d70a5feb6c64 |
|
MD5 | fef6c5dc28c51a8d771bacb4abad887f |
|
BLAKE2b-256 | ade656ac05203f96460c0ed52049ed661104e6db266191f44d5422ebae887d41 |