mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2026-08-06 02:21:42 +00:00
Refactor of caching & data storage part 5 #118
This commit is contained in:
@@ -19,10 +19,6 @@ class SIGRefDataProvider:
|
||||
self.status = "Not Started" if self.enabled else "Disabled"
|
||||
self.reference_count = 0
|
||||
|
||||
# Create an empty dict to store data if one doesn't already exist
|
||||
if not sig_name in DATA_STORE.sigrefs:
|
||||
DATA_STORE.sigrefs[sig_name] = {}
|
||||
|
||||
|
||||
def start(self):
|
||||
"""Start the provider. This should return immediately after spawning threads to access the remote resources"""
|
||||
@@ -35,10 +31,10 @@ class SIGRefDataProvider:
|
||||
|
||||
raise NotImplementedError("Subclasses must implement this method")
|
||||
|
||||
def _replace_data(self, new_data):
|
||||
"""Replace all data for the named sig with the new data. new_data should be a map of reference ID to SIGRef
|
||||
objects."""
|
||||
def _add_data(self, new_data):
|
||||
"""Add all the provided reference data objects to the data store."""
|
||||
|
||||
DATA_STORE.sigrefs[self.sig_name] = new_data
|
||||
for d in new_data:
|
||||
DATA_STORE.sigrefs[self.sig_name + ":" + d.id] = d
|
||||
self.reference_count = len(new_data)
|
||||
logging.info(f"Loaded %d references for %s into the data store.", self.reference_count, self.sig_name)
|
||||
|
||||
Reference in New Issue
Block a user