Sha256: 1278ba71cb3e4f3be7d2dddf5d0cbf4e8677f6d24320a710fd95164b8b9fffc5

Contents?: true

Size: 1.62 KB

Versions: 5

Compression:

Stored size: 1.62 KB

Contents

require 'digest/sha1'
require 'msgpack'
require 'class_config'
require 'logger'
require 'fileutils'
require 'forwardable'
require 'restruct'
require 'base64'
require 'transparent_proxy'

module Eternity

  INSERT = 'insert'.freeze
  UPDATE = 'update'.freeze
  DELETE = 'delete'.freeze

  TIME_FORMAT = '%Y-%m-%dT%H:%M:%S%z'

  extend ClassConfig

  attr_config :connection, Restruct::Connection.simple
  attr_config :keyspace, Restruct::Id[:eternity]
  attr_config :blob_cache_expiration, 24 * 60 * 60 # 1 day in seconds
  attr_config :blob_cache_max_size, 10 * 1024 * 1024 # 10 MB
  attr_config :blob_path, File.join(Dir.home, '.eternity')
  attr_config :logger, Logger.new(STDOUT)

  def self.locker_for(repository_name)
    Restruct::Locker.new  connection: connection,
                          id: keyspace[:locker][:repository][repository_name]
  end
 
  def self.redis_keys
    connection.call 'KEYS', keyspace['*']
  end

  def self.clear_redis
    redis_keys.each do |key|
      connection.call 'DEL', key
    end
  end

  def self.clear_file_system
    FileUtils.rm_rf blob_path if Dir.exist? blob_path
  end

end

require_relative 'eternity/version'
require_relative 'eternity/blob'
require_relative 'eternity/repository'
require_relative 'eternity/object_tracker'
require_relative 'eternity/collection_tracker'
require_relative 'eternity/tracker'
require_relative 'eternity/collection_index'
require_relative 'eternity/index'
require_relative 'eternity/commit'
require_relative 'eternity/branch'
require_relative 'eternity/patch'
require_relative 'eternity/track_flatter'
require_relative 'eternity/conflict_resolver'
require_relative 'eternity/delta'

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
eternity-4.0.0 lib/eternity.rb
eternity-3.0.1 lib/eternity.rb
eternity-3.0.0 lib/eternity.rb
eternity-2.0.1 lib/eternity.rb
eternity-2.0.0 lib/eternity.rb