Skip to content

Commit

Permalink
Using persistent views by default (quick hack)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yurii Rashkovskii committed May 18, 2008
1 parent e7a678a commit e9ac00a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
9 changes: 8 additions & 1 deletion lib/strokedb/views/store_ext.rb
@@ -1,6 +1,7 @@
module StrokeDB
class Store



# Tells a store to update a view on document save.
#
def register_view(v, metas = nil) #:nodoc:
Expand Down Expand Up @@ -51,5 +52,11 @@ def initialize_views_list
# meta_name => [...].to_set
}
end


def view_storage(uuid)
@view_storages ||= {}
@view_storages[uuid] ||= FileViewStorage.new(:path => File.join(@options['path'],"views/#{uuid}"))
end
end
end
5 changes: 2 additions & 3 deletions lib/strokedb/views/view.rb
@@ -1,6 +1,5 @@
module StrokeDB
VIEW_CACHE = {}
VIEW_STORAGES = {}

View = Meta.new do

Expand Down Expand Up @@ -236,9 +235,9 @@ def map_with_encoding(key, value)
private :map_with_encoding

def storage
# @storage ||= store.view_storages[self.uuid]
VIEW_STORAGES[uuid] ||= MemoryViewStorage.new
@storage ||= store.view_storage(self.uuid)
end

private :storage

# These are defaults (to be overriden in View.new{|v| ... })
Expand Down
2 changes: 1 addition & 1 deletion lib/strokedb/volumes/skiplist_volume.rb
Expand Up @@ -274,7 +274,7 @@ def init_log_file(path)
end

def info(m)
STDOUT.puts "SkiplistVolume#info: #{m}"
DEBUG { STDOUT.puts "SkiplistVolume#info: #{m}" }
end

def error(m)
Expand Down

0 comments on commit e9ac00a

Please sign in to comment.