Sha256: 8ff1086350655cb4b5240c372efe06e8da44fbe9ebc3143856143ceda23b856a

Contents?: true

Size: 1.35 KB

Versions: 61

Compression:

Stored size: 1.35 KB

Contents

module Spider; module Utils
    
    # Abstract class for a shared store.
    # A Shared Store is a Hash which may be accessed by different threads or processes.
    # The various implementations will offer different persistency/availability.
    #
    # *Note:* thread safety is guaranteed only for setting and getting store values. It doesn't 
    # know about the data contained in the store: if you modify an object hold by the store,
    # you should ensure thread safety yourself.
    class SharedStore
        
        def self.get(type=nil, config=nil)
            type = Spider.conf.get('shared_store.type').to_sym unless type
            type = :memory unless type
            case type
            when :memory
                return MemorySharedStore.new(config)
            when :file
                return FileSharedStore.new(config)
            end
        end
        
        def initialize(config={})
            @config = config
        end
        
        def [](key, &proc)
            raise NotImplementedError
        end
        
        def []=(key)
            raise NotImplementedError
        end
        
        def lock_all(&proc)
            raise NotImplementedError
        end
        
        
        
        
    end
    
end; end

require 'spiderfw/utils/shared_store/memory_shared_store'
require 'spiderfw/utils/shared_store/file_shared_store'

Version data entries

61 entries across 61 versions & 1 rubygems

Version Path
spiderfw-0.6.21 lib/spiderfw/utils/shared_store.rb
spiderfw-0.6.20 lib/spiderfw/utils/shared_store.rb
spiderfw-0.6.19 lib/spiderfw/utils/shared_store.rb
spiderfw-0.6.18 lib/spiderfw/utils/shared_store.rb
spiderfw-0.6.17 lib/spiderfw/utils/shared_store.rb
spiderfw-0.6.16 lib/spiderfw/utils/shared_store.rb
spiderfw-0.6.15 lib/spiderfw/utils/shared_store.rb
spiderfw-0.6.14 lib/spiderfw/utils/shared_store.rb
spiderfw-0.6.13 lib/spiderfw/utils/shared_store.rb
spiderfw-0.6.12 lib/spiderfw/utils/shared_store.rb
spiderfw-0.6.11 lib/spiderfw/utils/shared_store.rb
spiderfw-0.6.10 lib/spiderfw/utils/shared_store.rb
spiderfw-0.6.9 lib/spiderfw/utils/shared_store.rb
spiderfw-0.6.8 lib/spiderfw/utils/shared_store.rb
spiderfw-0.6.7 lib/spiderfw/utils/shared_store.rb
spiderfw-0.6.6 lib/spiderfw/utils/shared_store.rb
spiderfw-0.6.5 lib/spiderfw/utils/shared_store.rb
spiderfw-0.6.4 lib/spiderfw/utils/shared_store.rb
spiderfw-0.6.3 lib/spiderfw/utils/shared_store.rb
spiderfw-0.6.2 lib/spiderfw/utils/shared_store.rb