Class: OnesnooperServer::Store

Inherits:
Object
  • Object
show all
Defined in:
lib/onesnooper_server/store.rb

Overview

Base class for all backend data stores. Implements key method stubs required for all specific backend data store implementations.

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ Store

Initializes data store instance with given parameters.

Parameters:

  • params (Hash) (defaults to: {})

    hash-like structure with parameters



9
10
11
# File 'lib/onesnooper_server/store.rb', line 9

def initialize(params = {})
  @params = params
end

Instance Method Details

#save!(timestamp, data) ⇒ Object

Saves given data set into the underlying data store. Behavior is determined by the underlying data store implementation.

Parameters:

  • timestamp (DateTime)

    current time

  • data (Hash)

    data to be saved in the data store



19
20
21
# File 'lib/onesnooper_server/store.rb', line 19

def save!(timestamp, data)
  fail "This method needs to be implemented in subclasses"
end