app/models/manager_refresh/inventory_collection.rb
# Finds manager_uuid in the DB. Using a configured strategy we cache obtained data in the db_data_index, so the
# same find will not hit database twice. Also if we use lazy_links and this is called when
# data_collection_finalized?, we load all data from the DB, referenced by lazy_links, in one query.
#
# @param manager_uuid [String] a manager_uuid of the InventoryObject we search in the local DB
Finds manager_uuid in the DB. Using a configured strategy we cache obtained data in the db_data_index, so the
same find will not hit database twice. Also if we use lazy_links and this is called when
data_collection_finalized?, we load all data from the DB, referenced by lazy_links, in one query.
Finds manager_uuid in the DB . Using a configured strategy we cache obtained data in the db_data_index so the same find will not hit database twice . Also if we use lazy_links and this is called when data_collection_finalized? we load all data from the DB referenced by lazy_links in one query .
def find_in_db(manager_uuid)
      if data_collection_finalized? && db_data_index
        return db_data_index[manager_uuid]
      else
        return db_data_index[manager_uuid] if db_data_index && db_data_index[manager_uuid]
        references << manager_uuid unless references.include?(manager_uuid) 
      end
      loaded_references.merge(data_index.keys)
      populate_db_data_index!
      db_data_index[manager_uuid]
    end
def find_in_db ( manager_uuid ) if data_collection_finalized? && db_data_index return db_data_index [ manager_uuid ] else return db_data_index [ manager_uuid ] if db_data_index && db_data_index [ manager_uuid ] references << manager_uuid unless references . include? ( manager_uuid ) end loaded_references . merge ( data_index . keys ) populate_db_data_index! db_data_index [ manager_uuid ] end
Finds manager_uuid in the DB.
Finds manager_uuid in the DB .
# Use the cached db_data_index only data_collection_finalized?, meaning no new reference can occur # We haven't found the reference, lets add it to the list of references and load it # O(1) since references is Set # Put our existing data keys into loaded references # Load the rest of the references from the DB
manager_uuid
a manager_uuid of the InventoryObject we search in the local DB
a manager_uuid of the InventoryObject we search in the local DB