summaryrefslogtreecommitdiff
path: root/puppet/modules
diff options
context:
space:
mode:
authorkwadronaut <kwadronaut@leap.se>2017-07-27 09:12:15 +0200
committerMicah Anderson <micah@riseup.net>2017-09-08 08:38:01 -0400
commitaaf1cbe103d17820feffa09c8dcb6e1fef12e236 (patch)
treee2e70e44583b980bc28b7fddc939cf5f065c8e4c /puppet/modules
parent6757651f24375124149465fd14cd7d674895c27b (diff)
Bug: remove shared couchdb design docs
Soledad is now taking care of the design of said database. Closes #8428
Diffstat (limited to 'puppet/modules')
-rw-r--r--puppet/modules/site_couchdb/files/designs/shared/docs.json8
-rw-r--r--puppet/modules/site_couchdb/files/designs/shared/syncs.json11
-rw-r--r--puppet/modules/site_couchdb/files/designs/shared/transactions.json13
-rw-r--r--puppet/modules/site_couchdb/manifests/designs.pp17
4 files changed, 8 insertions, 41 deletions
diff --git a/puppet/modules/site_couchdb/files/designs/shared/docs.json b/puppet/modules/site_couchdb/files/designs/shared/docs.json
deleted file mode 100644
index 004180cd..00000000
--- a/puppet/modules/site_couchdb/files/designs/shared/docs.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "_id": "_design/docs",
- "views": {
- "get": {
- "map": "function(doc) {\n if (doc.u1db_rev) {\n var is_tombstone = true;\n var has_conflicts = false;\n if (doc._attachments) {\n if (doc._attachments.u1db_content)\n is_tombstone = false;\n if (doc._attachments.u1db_conflicts)\n has_conflicts = true;\n }\n emit(doc._id,\n {\n \"couch_rev\": doc._rev,\n \"u1db_rev\": doc.u1db_rev,\n \"is_tombstone\": is_tombstone,\n \"has_conflicts\": has_conflicts,\n }\n );\n }\n}\n"
- }
- }
-} \ No newline at end of file
diff --git a/puppet/modules/site_couchdb/files/designs/shared/syncs.json b/puppet/modules/site_couchdb/files/designs/shared/syncs.json
deleted file mode 100644
index bab5622f..00000000
--- a/puppet/modules/site_couchdb/files/designs/shared/syncs.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "_id": "_design/syncs",
- "updates": {
- "put": "function(doc, req){\n if (!doc) {\n doc = {}\n doc['_id'] = 'u1db_sync_log';\n doc['syncs'] = [];\n }\n body = JSON.parse(req.body);\n // remove outdated info\n doc['syncs'] = doc['syncs'].filter(\n function (entry) {\n return entry[0] != body['other_replica_uid'];\n }\n );\n // store u1db rev\n doc['syncs'].push([\n body['other_replica_uid'],\n body['other_generation'],\n body['other_transaction_id']\n ]);\n return [doc, 'ok'];\n}\n\n"
- },
- "views": {
- "log": {
- "map": "function(doc) {\n if (doc._id == 'u1db_sync_log') {\n if (doc.syncs)\n doc.syncs.forEach(function (entry) {\n emit(entry[0],\n {\n 'known_generation': entry[1],\n 'known_transaction_id': entry[2]\n });\n });\n }\n}\n"
- }
- }
-} \ No newline at end of file
diff --git a/puppet/modules/site_couchdb/files/designs/shared/transactions.json b/puppet/modules/site_couchdb/files/designs/shared/transactions.json
deleted file mode 100644
index 106ad46c..00000000
--- a/puppet/modules/site_couchdb/files/designs/shared/transactions.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "_id": "_design/transactions",
- "lists": {
- "generation": "function(head, req) {\n var row;\n var rows=[];\n // fetch all rows\n while(row = getRow()) {\n rows.push(row);\n }\n if (rows.length > 0)\n send(JSON.stringify({\n \"generation\": rows.length,\n \"doc_id\": rows[rows.length-1]['id'],\n \"transaction_id\": rows[rows.length-1]['value']\n }));\n else\n send(JSON.stringify({\n \"generation\": 0,\n \"doc_id\": \"\",\n \"transaction_id\": \"\",\n }));\n}\n",
- "trans_id_for_gen": "function(head, req) {\n var row;\n var rows=[];\n var i = 1;\n var gen = 1;\n if (req.query.gen)\n gen = parseInt(req.query['gen']);\n // fetch all rows\n while(row = getRow())\n rows.push(row);\n if (gen <= rows.length)\n send(JSON.stringify({\n \"generation\": gen,\n \"doc_id\": rows[gen-1]['id'],\n \"transaction_id\": rows[gen-1]['value'],\n }));\n else\n send('{}');\n}\n",
- "whats_changed": "function(head, req) {\n var row;\n var gen = 1;\n var old_gen = 0;\n if (req.query.old_gen)\n old_gen = parseInt(req.query['old_gen']);\n send('{\"transactions\":[\\n');\n // fetch all rows\n while(row = getRow()) {\n if (gen > old_gen) {\n if (gen > old_gen+1)\n send(',\\n');\n send(JSON.stringify({\n \"generation\": gen,\n \"doc_id\": row[\"id\"],\n \"transaction_id\": row[\"value\"]\n }));\n }\n gen++;\n }\n send('\\n]}');\n}\n"
- },
- "views": {
- "log": {
- "map": "function(doc) {\n if (doc.u1db_transactions)\n doc.u1db_transactions.forEach(function(t) {\n emit(t[0], // use timestamp as key so the results are ordered\n t[1]); // value is the transaction_id\n });\n}\n"
- }
- }
-} \ No newline at end of file
diff --git a/puppet/modules/site_couchdb/manifests/designs.pp b/puppet/modules/site_couchdb/manifests/designs.pp
index e5fd94c6..33687999 100644
--- a/puppet/modules/site_couchdb/manifests/designs.pp
+++ b/puppet/modules/site_couchdb/manifests/designs.pp
@@ -11,6 +11,14 @@ class site_couchdb::designs {
mode => '0755'
}
+ #cleanup leftovers from before soledad created its db
+ file {
+ '/srv/leap/couchdb/designs/shared/':
+ ensure => absent,
+ recurse => true,
+ force => true,
+ }
+
site_couchdb::upload_design {
'customers': design => 'customers/Customer.json';
'identities': design => 'identities/Identity.json';
@@ -19,15 +27,6 @@ class site_couchdb::designs {
'users': design => 'users/User.json';
'tmp_users': design => 'users/User.json';
'invite_codes': design => 'invite_codes/InviteCode.json';
- 'shared_docs':
- db => 'shared',
- design => 'shared/docs.json';
- 'shared_syncs':
- db => 'shared',
- design => 'shared/syncs.json';
- 'shared_transactions':
- db => 'shared',
- design => 'shared/transactions.json';
}
$sessions_db = rotated_db_name('sessions', 'monthly')