Quickstart
Committeddb has four actions:
- Add a topic
- Append to a topic
- Add a database
- Add a SQL syncable
Add Topic
To Add a topic POST to http://server:port/cluster/topics with an HTTP body that looks like:
[topic]
name = "test1"
Append to Topic
To Append to a topic POST to http://server:port/cluster/posts with an HTTP body that looks like:
{
"Topic" : "test1",
"Proposal" : {
Key: "baz", One: "qux"
}
}
Add Database
To add a database POST to http://server:port/cluster/databases with an HTTP body that looks like:
[database]
name = "testdb"
type = "sql"
[sql]
dialect = "mysql"
connectionString = "myConnectionString"
The Database is a TOML configuration file. Currently the only type supported is sql and the only dialect supported is mysql.
Add Syncable
To Add a syncable POST to http://server:port/cluster/syncables with an HTTP body that looks like:
[syncable]
name = "foo"
# Determines what the rest of the config will look like
dbType = "sql"
[sql]
topic = "test1"
db = "testdb"
table = "foo"
primaryKey = "pk"
[[sql.indexes]]
name = "firstIndex"
index = "one"
[[sql.mappings]]
jsonPath = "$.Key"
column = "pk"
type = "TEXT"
[[sql.mappings]]
jsonPath = "$.One"
column = "one"
type = "TEXT"
The Syncable is a TOML configuration file.
Workflow
The workflow would look like: Add a topic, Append some proposals, Add a database, Add a syncable, look at your SQL database and see the proposals get applied to the DB, Add some more proposals and then read the database and do something useful.