Sha256: 0b2cc0b1a72ca1b0d3fb6fcfef395ddd8955d801ed702729b2ce05e82bffda07

Contents?: true

Size: 1.12 KB

Versions: 16

Compression:

Stored size: 1.12 KB

Contents

require 'fileutils'
require 'base64'
require 'zlib'



module Keen
  module Async
    module Storage
      class FlatFileHandler

        # Paths
        # -----
        
        # Where new events go as they come in:
        ACTIVE = "active.txt"

        # The temporary file that will store records during processing:
        PROCESSING = "processing.txt"

        # Records are put here if processing fails:
        FAILED = "failed.txt"

        def initialize(filepath)
          @filepath = filepath
        
          is_directory?
          is_writable?
          is_readable?
        end

        def dump_contents
          # move
        end

        def is_writable?
          if not FileTest.writable? @filepath
            raise "Can't write to file: " + @filepath
          end
        end
        
        def is_readable?
          if not FileTest.readable? @filepath
            raise "Can't read from file: " + @filepath
          end
        end

        def is_directory?
          if not FileTest.directory? @filepath
            raise "Can't read from file: " + @filepath
          end
        end

      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
keen-0.2.0 lib/keen/async/storage/flat_file_handler.rb
keen-0.1.12 lib/keen/async/storage/flat_file_handler.rb
keen-0.1.11 lib/keen/async/storage/flat_file_handler.rb
keen-0.1.10 lib/keen/async/storage/flat_file_handler.rb
keen-0.1.9 lib/keen/async/storage/flat_file_handler.rb
keen-0.1.8 lib/keen/async/storage/flat_file_handler.rb
keen-0.1.7 lib/keen/async/storage/flat_file_handler.rb
keen-0.1.6 lib/keen/async/storage/flat_file_handler.rb
keen-0.1.5 lib/keen/async/storage/flat_file_handler.rb
keen-0.1.4 lib/keen/async/storage/flat_file_handler.rb
keen-0.1.3 lib/keen/async/storage/flat_file_handler.rb
keen-0.1.0 lib/keen/async/storage/flat_file_handler.rb
keen-0.0.53 lib/keen/async/storage/flat_file_handler.rb
keen-0.0.52 lib/keen/async/storage/flat_file_handler.rb
keen-0.0.5 lib/keen/async/storage/flat_file_handler.rb
keen-0.0.4 lib/keen/async/storage/flat_file_handler.rb