Class: Aspera::Sync::Database

Inherits:
Object
  • Object
show all
Defined in:
lib/aspera/sync/database.rb

Instance Method Summary collapse

Constructor Details

#initialize(db_path) ⇒ Database

Returns a new instance of Database.



56
57
58
# File 'lib/aspera/sync/database.rb', line 56

def initialize(db_path)
  @db = SqLite3Wrapper.new(db_path)
end

Instance Method Details

#countersObject



74
75
76
# File 'lib/aspera/sync/database.rb', line 74

def counters
  @db.single_table('sync_snap_counters_table')
end

#file_infoObject



78
79
80
# File 'lib/aspera/sync/database.rb', line 78

def file_info
  @db.full_table('sync_snapdb_table')
end

#metaObject



70
71
72
# File 'lib/aspera/sync/database.rb', line 70

def meta
  @db.single_table('sync_snapmeta_table')
end

#overviewObject



60
61
62
63
64
65
66
67
68
# File 'lib/aspera/sync/database.rb', line 60

def overview
  tables = @db.execute("SELECT name FROM sqlite_master WHERE type='table';")
  tables.flat_map do |table_row|
    table_name = table_row['name']
    @db.execute("PRAGMA table_info(#{table_name});").map do |col|
      {'table' => table_name}.merge(col)
    end
  end
end