]> git.cworth.org Git - sup/blobdiff - lib/sup/index.rb
Merge branch 'locking-refactor'
[sup] / lib / sup / index.rb
index 54ec84325224bce3a0ff75dbd695daf42c3e2b98..ff03f195f6bca74aefdb23eedecc01c2172ee39c 100644 (file)
@@ -6,7 +6,7 @@ begin
   require 'chronic'
   $have_chronic = true
 rescue LoadError => e
-  Redwood::log "optional 'chronic' library not found (run 'gem install chronic' to install)"
+  debug "optional 'chronic' library not found; date-time query restrictions disabled"
   $have_chronic = false
 end
 
@@ -28,13 +28,12 @@ class BaseIndex
   def initialize dir=BASE_DIR
     @dir = dir
     @lock = Lockfile.new lockfile, :retries => 0, :max_age => nil
-    self.class.i_am_the_instance self
   end
 
   def lockfile; File.join @dir, "lock" end
 
   def lock
-    Redwood::log "locking #{lockfile}..."
+    debug "locking #{lockfile}..."
     begin
       @lock.lock
     rescue Lockfile::MaxTriesLockError
@@ -58,7 +57,7 @@ class BaseIndex
 
   def unlock
     if @lock && @lock.locked?
-      Redwood::log "unlocking #{lockfile}..."
+      debug "unlocking #{lockfile}..."
       @lock.unlock
     end
   end
@@ -69,7 +68,7 @@ class BaseIndex
   end
 
   def save
-    Redwood::log "saving index and sources..."
+    debug "saving index and sources..."
     FileUtils.mkdir_p @dir unless File.exists? @dir
     SourceManager.save_sources
     save_index
@@ -79,12 +78,9 @@ class BaseIndex
     unimplemented
   end
 
-  ## Syncs the message to the index, replacing any previous version.  adding
-  ## either way. Index state will be determined by the message's #labels
-  ## accessor.
-  def sync_message m, opts={}
-    unimplemented
-  end
+  def add_message m; unimplemented end
+  def update_message m; unimplemented end
+  def update_message_state m; unimplemented end
 
   def save_index fn
     unimplemented
@@ -185,6 +181,6 @@ case index_name
   else fail "unknown index type #{index_name.inspect}"
 end
 Index = Redwood.const_get "#{index_name.capitalize}Index"
-Redwood::log "using index #{Index.name}"
+debug "using index #{Index.name}"
 
 end