summaryrefslogtreecommitdiff
path: root/lib/leap_ca_daemon.rb
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2012-11-12 23:53:51 -0800
committerelijah <elijah@riseup.net>2012-11-12 23:53:51 -0800
commitc37a35df81b2d6becc09f1820240db24c3ec632c (patch)
tree50187e4ab1face237760614ecf844b42efdd51e1 /lib/leap_ca_daemon.rb
parentc90d30621e042cc3e52ffc87e3491ab110a57e9e (diff)
first fully working version of leap_ca
Diffstat (limited to 'lib/leap_ca_daemon.rb')
-rw-r--r--lib/leap_ca_daemon.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/leap_ca_daemon.rb b/lib/leap_ca_daemon.rb
new file mode 100644
index 0000000..79ec36d
--- /dev/null
+++ b/lib/leap_ca_daemon.rb
@@ -0,0 +1,24 @@
+#
+# This file should not be required directly. Use it like so:
+#
+# Daemons.run('leap_ca_daemon.rb')
+#
+
+require 'leap_ca'
+
+module LeapCA
+ puts " * Tracking #{Cert.database.root}"
+ couch = CouchStream.new(Cert.database.root)
+ changes = CouchChanges.new(couch)
+ pool = Pool.new(:size => Config.max_pool_size)
+
+ # fill the pool
+ pool.fill
+
+ # watch for deletions, fill the pool whenever it gets low
+ changes.follow do |hash|
+ if hash[:deleted]
+ pool.fill
+ end
+ end
+end