Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix stat_wrapper for use with sequel_store (memory_store still broken)

  • Loading branch information...
commit 461d0180042d1818ceb7cc7c3b4a55fb7bdf5c5a 1 parent c5ae6b3
@enebo authored
View
22 lib/wreckem/backends/sequel_store.rb
@@ -58,17 +58,6 @@ def initialize()
end
##
- #
- def insert_component(component)
- db_type = TYPE_MAP[component.type]
- row_data = {eid: component.eid, name: component.class.name, type: db_type}
- value_column = COLUMN_MAP[db_type]
- row_data[value_column] = component.value if value_column
- new_id = @components.insert row_data
- component.id = new_id
- end
-
- ##
# Deletes the entity and any associated aliases.
#
def delete_entity(entity)
@@ -94,6 +83,17 @@ def generate_id
end
##
+ #
+ def insert_component(component)
+ db_type = TYPE_MAP[component.type]
+ row_data = {eid: component.eid, name: component.class.name, type: db_type}
+ value_column = COLUMN_MAP[db_type]
+ row_data[value_column] = component.value if value_column
+ new_id = @components.insert row_data
+ component.id = new_id
+ end
+
+ ##
# Load component from class
#
def load_components_from_class(component_class, &block)
View
54 lib/wreckem/backends/stat_wrapper.rb
@@ -5,15 +5,9 @@ def initialize(backend)
@counts, @times = {}, {}
end
- def create_entity(entity, aliases)
- time_and_count(:create_entity) do
- @backend.create_entity(entity, aliases)
- end
- end
-
- def delete_entity(id)
+ def delete_entity(entity)
time_and_count(:delete_entity) do
- @backend.delete_entity(id)
+ @backend.delete_entity(entity)
end
end
@@ -23,9 +17,9 @@ def delete_component(component)
end
end
- def entities
- time_and_count(:entities) do
- @backend.entities
+ def destroy
+ time_and_count(:destroy) do
+ @backend.destroy
end
end
@@ -35,15 +29,21 @@ def generate_id
end
end
- def load_components_from_class(component_class)
+ def insert_component(component)
+ time_and_count(:insert_component) do
+ @backend.insert_component(component)
+ end
+ end
+
+ def load_components_from_class(component_class, &block)
time_and_count(:load_components_from_class) do
- @backend.load_components_from_class(component_class)
+ @backend.load_components_from_class(component_class, &block)
end
end
- def load_components_of_entity(entity_id)
+ def load_components_of_entity(entity_id, &block)
time_and_count(:load_components_of_entity) do
- @backend.load_components_of_entity(entity_id)
+ @backend.load_components_of_entity(entity_id, &block)
end
end
@@ -53,18 +53,6 @@ def load_entity(entity_id)
end
end
- def load_entity_from_alias(a)
- time_and_count(:load_entity_from_alias) do
- @backend.load_entity_from_alias(a)
- end
- end
-
- def load_entities_of_component(component_id)
- time_and_count(:load_entities_of_component) do
- @backend.load_entities_of_component(component_id)
- end
- end
-
def load_entities_for_component_class(component_class)
time_and_count(:load_entities_for_component_class) do
@backend.load_entities_for_component_class(component_class)
@@ -79,15 +67,9 @@ def save
@backend.save
end
- def store_entity(entity, aliases)
- time_and_count(:store_entity) do
- @backend.store_entity(entity, aliases)
- end
- end
-
- def store_component(entity, component)
- time_and_count(:store_component) do
- @backend.store_component(entity, component)
+ def update_component(component)
+ time_and_count(:update_component) do
+ @backend.update_component(component)
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.