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-1.0.1 lib/spiderfw/utils/shared_store.rb
spiderfw-1.0.0 lib/spiderfw/utils/shared_store.rb
spiderfw-0.6.39 lib/spiderfw/utils/shared_store.rb
spiderfw-0.6.38 lib/spiderfw/utils/shared_store.rb
spiderfw-0.6.37 lib/spiderfw/utils/shared_store.rb
spiderfw-0.6.35 lib/spiderfw/utils/shared_store.rb
spiderfw-0.6.34 lib/spiderfw/utils/shared_store.rb
spiderfw-0.6.33 lib/spiderfw/utils/shared_store.rb
spiderfw-0.6.32 lib/spiderfw/utils/shared_store.rb
spiderfw-0.6.31 lib/spiderfw/utils/shared_store.rb
spiderfw-0.6.30 lib/spiderfw/utils/shared_store.rb
spiderfw-0.6.29 lib/spiderfw/utils/shared_store.rb
spiderfw-0.6.28 lib/spiderfw/utils/shared_store.rb
spiderfw-0.6.27 lib/spiderfw/utils/shared_store.rb
spiderfw-0.6.26 lib/spiderfw/utils/shared_store.rb
spiderfw-0.6.26.pre1 lib/spiderfw/utils/shared_store.rb
spiderfw-0.6.25 lib/spiderfw/utils/shared_store.rb
spiderfw-0.6.24 lib/spiderfw/utils/shared_store.rb
spiderfw-0.6.23 lib/spiderfw/utils/shared_store.rb
spiderfw-0.6.22 lib/spiderfw/utils/shared_store.rb