Class: OnesnooperServer::SqlStore
- Defined in:
- lib/onesnooper_server/sql_store.rb
Overview
Class wrapping common features of all SQL-based stores. Using ‘sequel’ to abstract differences.
Direct Known Subclasses
OnesnooperServer::Stores::MysqlStore, OnesnooperServer::Stores::SqliteStore
Constant Summary collapse
- SQL_TABLE_NAME =
constant table name
:one_monitoring
Instance Method Summary collapse
Methods inherited from Store
Constructor Details
This class inherits a constructor from OnesnooperServer::Store
Instance Method Details
#save!(timestamp, data) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/onesnooper_server/sql_store.rb', line 10 def save!(, data) ::OnesnooperServer::Log.debug "[#{self.class.name}] Saving #{.to_s} => #{data.inspect}" fail "DB connection has to be initialized from subclasses, " \ "::OnesnooperServer::SqlStore cannot be used directly!" unless @db_conn if insert_data = data_in_vm_groups(, data) @db_conn[SQL_TABLE_NAME].multi_insert(insert_data) else ::OnesnooperServer::Log.debug "[#{self.class.name}] Skipping SQL INSERT for an empty dataset" end end |