Group: GNU Social P2P/Design/Agent2LocalCore
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
< [[Group:GNU Social P2P/Design]] | < [[Group:GNU Social P2P/Design]] | ||
− | == | + | == Agent to Local Core Protocol == |
=== Keys === | === Keys === | ||
− | The | + | The Agent has a public key which controls the identity of the user. All values are opaque to the Core and are decrypted on the Agent side. The Agent should have a local cache for performance. |
=== Core Side === | === Core Side === | ||
Line 17: | Line 17: | ||
* multiget(max, path [, seek_path]) - return sub-tree | * multiget(max, path [, seek_path]) - return sub-tree | ||
− | + | === Agent Side === | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | === | ||
* on_receive(route, local_prefix) - notification that a ''send'' was received | * on_receive(route, local_prefix) - notification that a ''send'' was received | ||
on_receive is a result of a push from a friend. | on_receive is a result of a push from a friend. | ||
− | |||
− | |||
− | |||
− | |||
=== REST HTTP binding === | === REST HTTP binding === | ||
− | A simple binding of the Core to | + | A simple binding of the Local Core to Agent protocol over HTTP REST. All {} enclosed structures are JSON encoded. |
Data manipulation: | Data manipulation: | ||
Line 71: | Line 49: | ||
returns [ {path: $path, value: $value}* ] | returns [ {path: $path, value: $value}* ] | ||
− | + | Callbacks to Agent: | |
− | + | Agent performs: | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
GET '/event' | GET '/event' | ||
Line 98: | Line 60: | ||
-> { type: 'receive', path: $path, success: true, $route } | -> { type: 'receive', path: $path, success: true, $route } | ||
-> { type: 'receive', path: $path, success: false, $route, message: "..." } | -> { type: 'receive', path: $path, success: false, $route, message: "..." } | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
NOTES: <references/> | NOTES: <references/> |
Latest revision as of 23:05, 20 November 2010
Agent to Local Core Protocol
Keys
The Agent has a public key which controls the identity of the user. All values are opaque to the Core and are decrypted on the Agent side. The Agent should have a local cache for performance.
Core Side
Data manipulation:
- put(path, value, push) - performs store[path] = value, and notifies any friends if push = true
- get(path) - returns store[path]
- delete(path) - performs delete store[path]
- scan(max, path[, seek_path]) - returns paths in sub-tree
- multiget(max, path [, seek_path]) - return sub-tree
Agent Side
- on_receive(route, local_prefix) - notification that a send was received
on_receive is a result of a push from a friend.
REST HTTP binding
A simple binding of the Local Core to Agent protocol over HTTP REST. All {} enclosed structures are JSON encoded.
Data manipulation:
put(path, value, push) -> PUT '/store/$path?push=$push', { value: $value }
get(path) -> GET '/store/$path'
returns { value: $value }
delete(path) -> DELETE '/store/$path'
returns number deleted (0 or 1)
scan(max, path, seek_path) -> GET '/store/$path/\$scan?seek=$seek_path&max=$max'
\$ designates a literal dollar sign. If $seek_path is specified, jump after that point (useful for paging). Results are in lexicographical order.
returns [ $path* ]
multiget(max, path [, seek_path]) -> GET '/store/$path/\$multi?seek=$seek_path&max=$max'
returns [ {path: $path, value: $value}* ]
Callbacks to Agent:
Agent performs:
GET '/event'
This is a blocking call. Possible results:
on_receive(route, path) -> { type: 'receive', path: $path, success: true, $route } -> { type: 'receive', path: $path, success: false, $route, message: "..." }
NOTES: