Sha256: 0cd6e8b89ee751b5e768e4d784d0a73a3594206d651dbb42d673ca8bc542a931

Contents?: true

Size: 1.03 KB

Versions: 2

Compression:

Stored size: 1.03 KB

Contents

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



module Keen
  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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
keen-0.0.2 lib/keen/storage/flat_file_handler.rb
keen-0.0.1 lib/keen/storage/flat_file_handler.rb