Class: XRBP::NodeStore::SQLDB

Inherits:
Object
  • Object
show all
Defined in:
lib/xrbp/nodestore/sqldb.rb

Overview

Wraps sqlite3 database created/maintianed by rippled. Allows client to query for data stored in sql database.

Defined Under Namespace

Classes: Ledgers

Instance Method Summary collapse

Constructor Details

#initialize(dir) ⇒ SQLDB

SQL DB intializer

Parameters:

  • dir (String)

    directory containing binary nodestore. For consistency with other nodestore paths this should be set to the directory containing the actual ‘nudb’ or ‘rocksdb’ datafiles, as the sqlite3 databases will be inferred from the parent directory.



15
16
17
# File 'lib/xrbp/nodestore/sqldb.rb', line 15

def initialize(dir)
  @dir = dir
end

Instance Method Details

#ledger_dbObject



19
20
21
# File 'lib/xrbp/nodestore/sqldb.rb', line 19

def ledger_db
  @ledger_db ||= SQLite3::Database.new File.join(@dir, "..", "ledger.db")
end

#ledgersObject



27
28
29
# File 'lib/xrbp/nodestore/sqldb.rb', line 27

def ledgers
  @ledgers ||= Ledgers.new(self)
end

#tx_dbObject



23
24
25
# File 'lib/xrbp/nodestore/sqldb.rb', line 23

def tx_db
  @ledger_db ||= SQLite3::Database.new File.join(@dir, "..", "transaction.db")
end