-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from aktos-io/dev
Dev
- Loading branch information
Showing
91 changed files
with
3,913 additions
and
1,890 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[submodule "aktos-dcs-design"] | ||
path = aktos-dcs-design | ||
path = aktos-dcs | ||
url = https://github.com/aktos-io/aktos-dcs-design | ||
[submodule "protocols/siemens/nodeS7"] | ||
path = protocols/siemens/nodeS7 | ||
path = connectors/siemens/nodeS7 | ||
url = https://github.com/ceremcem/nodeS7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule aktos-dcs
updated
from 000000 to 37ec8c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,16 @@ | ||
require! './src/actor': {Actor} | ||
require! './src/io-actor': {IoActor} | ||
require! './src/socketio-browser': {SocketIOBrowser} | ||
require! './src/filters': {FpsExec} | ||
require! './src/signal': {Signal} | ||
require! './src/find-actor': {find-actor} | ||
require! './src/couch-dcs/couch-dcs-client': {CouchDcsClient} | ||
require! './connectors/socketio/browser': {SocketIOBrowser} | ||
require! './connectors/socketio/server': {SocketIOServer} | ||
require! './connectors/couch-dcs/client': {CouchDcsClient} | ||
require! './src/topic-match': {topic-match} | ||
require! './src/filters': {FpsExec} | ||
require! './src/ractive-actor': {RactiveActor} | ||
|
||
module.exports = { | ||
IoActor, SocketIOBrowser, Signal, Actor | ||
find-actor, CouchDcsClient | ||
Actor | ||
Signal | ||
SocketIOBrowser, SocketIOServer | ||
CouchDcsClient | ||
topic-match | ||
FpsExec | ||
RactiveActor | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# TODO | ||
|
||
- [ ] sms | ||
- [ ] udp | ||
- [ ] webrtc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
# Couch DCS | ||
|
||
This server and client libraries are created to be able to use CouchDB over DCS network. | ||
|
||
In addition to changing transport layer from HTTP to DCS, this library aims to [address some CouchDB limitations](./addressing-couchdb-limitations.md). | ||
|
||
## Usage | ||
|
||
|
||
1. Run `CouchDcsServer` instance on your server: | ||
|
||
|
||
```ls | ||
new CouchDcsServer do | ||
user: | ||
name: 'your-couchdb-username' | ||
password: 'your-password' | ||
url: "IP-OR-ADDRESS-OF-YOUR-COUCHDB-INSTANCE" | ||
database: 'your-db-name' | ||
``` | ||
|
||
2. Create a `CouchDcsClient` instance use it as if it was a regular CouchDB driver: | ||
|
||
```ls | ||
db = new CouchDcsClient 'document-type' | ||
console.log "getting the document with 'your-document-id':" | ||
err, res <~ db.get 'your-document-id' | ||
console.log "response is: ", res | ||
``` | ||
|
||
3. In order to make it work, ensure that your user have `db.document-type.**` permissions. | ||
|
||
# API | ||
|
||
`CouchDcsClient` has the following API: | ||
|
||
* `.get 'document-id', [opts, ] callback` | ||
* `.put doc, callback` | ||
* `.view 'designName/yourView', [opts, ] callback` | ||
* `.all callback` | ||
* `.getAttachment 'document-id', 'attachment-name', callback` | ||
|
||
Callbacks will be called with `error, response` parameters. | ||
|
||
# Additional Functionalities | ||
|
||
## Create documents with `AUTOINCREMENT`ed ID's | ||
|
||
Suppose you will save documents by autoincrementing the ID field. Follow the steps: | ||
|
||
### 1. Setup | ||
|
||
Create a view with name `short` in `autoincrement` design document in your db: | ||
|
||
```ls | ||
views: | ||
short: | ||
map: (doc) -> | ||
prefix = doc._id.split /[0-9]+/ .0 | ||
if prefix | ||
seq = if doc._id.split prefix .1 => parse-int that else 0 | ||
prefix = prefix.split /[^a-zA-Z]+/ .0.to-upper-case! | ||
emit [prefix, seq], null | ||
``` | ||
|
||
|
||
### Creating a document | ||
|
||
1. If you want to assign an autoincremented ID, append '#' character to your document's `_id` field: | ||
|
||
```js | ||
{ | ||
_id: 'foo-####', | ||
type: 'bar', | ||
hello: 'there' | ||
} | ||
``` | ||
|
||
2. Save your document with `CouchDcsClient.put` method, as usual. | ||
|
||
Your document id will be something like `foo-1358` | ||
|
||
### Notes | ||
|
||
1. *On save*: Your prefix is calculated by splitting right before first '#' | ||
character and grabbing left side of the result. | ||
|
||
| Autoincrement ID | Calculated Prefix | Example ID | | ||
| ---- | ----- | ---- | | ||
| `foo###` | `foo` | `foo1234` | | ||
| `foo-###` | `foo-` | `foo-1234` | | ||
| `Foo-###` | `Foo-` | `Foo-1234` | | ||
|
||
2. *On calculating next ID*: Current biggest ID is calculated by splitting right before any alphanumeric characters, grabbing left side, converting to upper case. | ||
|
||
For example, we have `foo-5` in the database. Following autoincremented IDs will be assigned for the IDs: | ||
|
||
| Seq. | Provided `doc._id` | Saved as | | ||
| ---- | ----- | ----- | | ||
| 1 | `foo-#` | `foo-6` | | ||
| 2 | `foo-#` | `foo-7` | | ||
| 3 | `foo#` | `foo8` | ||
| 4 | `FoO---###` | `FoO---9` | | ||
| 5 | `fooo-#` | `fooo-1` | | ||
| 6 | `fOO#####` | `fOO10` | | ||
|
||
### Troubleshooting | ||
|
||
To verify that your view returns the correct ID, use the following filter to get latest ID: | ||
|
||
``` | ||
http://example.com/yourdb/_design/autoincrement/_view/short?descending=true&startkey=["FOO",{}]&endkey=["FOO"] | ||
``` | ||
|
||
# Roadmap | ||
|
||
- [ ] Add document deduplication support | ||
- [ ] Provide a way to resume interrupted downloads/uploads | ||
- [ ] Stream videos directly from database |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.