class Qwik::BackupDB
Constants
- IGNORE_PAGES
Public Class Methods
new(path)
click to toggle source
# File vendor/qwik/lib/qwik/db-backup.rb, line 12 def initialize(path) @backup_path = path+'.backup' end
Public Instance Methods
check(k, v)
click to toggle source
# File vendor/qwik/lib/qwik/db-backup.rb, line 34 def check(k, v) end
close()
click to toggle source
# File vendor/qwik/lib/qwik/db-backup.rb, line 16 def close # do nothing end
each() { |key, v, time| ... }
click to toggle source
# File vendor/qwik/lib/qwik/db-backup.rb, line 58 def each @backup_path.check_directory ar = [] @backup_path.each_entry {|file| f = @backup_path+file next unless f.file? base = file.to_s if /\A([0-9]+)_([_A-Za-z0-9]+)\z/ =~ base time = Time.at($1.to_i) key = $2 ar << [key, time] end } ar.sort_by {|key, time| time }.each {|key, time| # v = get(key, time) v = "" # FIXME: This is dummy. 2009/9/1 yield(key, v, time) } end
each_by_key(key) { |v, time| ... }
click to toggle source
# File vendor/qwik/lib/qwik/db-backup.rb, line 52 def each_by_key(key) each {|k, v, time| yield(v, time) if k == key } end
exist?(k, time)
click to toggle source
# File vendor/qwik/lib/qwik/db-backup.rb, line 26 def exist?(k, time) return path(k, time).exist? end
get(k, time)
click to toggle source
# File vendor/qwik/lib/qwik/db-backup.rb, line 30 def get(k, time) return path(k, time).read end
put(k, v, time)
click to toggle source
# File vendor/qwik/lib/qwik/db-backup.rb, line 45 def put(k, v, time) @backup_path.check_directory return if IGNORE_PAGES.any? {|re| re =~ k } path(k, time).put(v) end
Also aliased as: set
Private Instance Methods
path(k, time)
click to toggle source
# File vendor/qwik/lib/qwik/db-backup.rb, line 20 def path(k, time) # k: String, t: Time t = time.to_i.to_s return @backup_path+"#{t}_#{k}" end