Sha256: eda22fd4fdc45cf0167b9a3a11a14ff64c4e3c85230258e0dc69087e76de39c6

Contents?: true

Size: 1.07 KB

Versions: 3

Compression:

Stored size: 1.07 KB

Contents

module Scrooge
  module Storage
   
    autoload :Buffer, 'scrooge/storage/buffer'
    autoload :Memory, 'scrooge/storage/memory'
    
    class Base < Scrooge::Base
      class NotImplemented < StandardError
      end 
      
      # A Single Mutex for all Storage subclasses as their's only one storage instance.
      #
      GUARD = Mutex.new
      
      NAMESPACE = 'scrooge_storage'.freeze 
          
      class << self
        
        # Yields a storage instance from a given signature.
        #
        def instantiate( storage_signature )
          "scrooge/storage/#{storage_signature.to_s}".to_const!
        end
        
      end    

      # Retrieve a given tracker from storage.
      #                 
      def read( tracker )
        raise NotImplemented
      end      
            
      # Persist a given tracker to storage.
      #      
      def write( tracker, buffered = true )
        raise NotImplemented
      end
      
      # Namespace lookup keys. 
      #
      def expand_key( key )
        "#{NAMESPACE}/#{key}"
      end      
      
    end
  end
end  

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
methodmissing-scrooge-1.0.0 lib/scrooge/storage/base.rb
methodmissing-scrooge-1.0.1 lib/scrooge/storage/base.rb
methodmissing-scrooge-1.0.2 lib/scrooge/storage/base.rb