summaryrefslogtreecommitdiff
path: root/lib/leap_ca_daemon.rb
diff options
context:
space:
mode:
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