Assistance with Silver Challenge: Fallback to DataStore

Working on the Silver Challenge and having a tough time determining the best way to go about falling back to datastore. Should the network fail, set a OFFLINE boolean, save all further data in the datastore and then setup a timer to occasionally attempt to update or save data to datastore and attempt to update with each additional coffee added or deleted.

So, obviously, I’m a little lost on how best to accomplish this.

@960design you’re definitely on the right track!

Here’s a suggestion: try making another class that wraps around your RemoteDataStore and DataStore. A good name would be a DataStoreProxy since it is “proxying” API calls. This class would have a similar API to your other datastores, but could handle the fallback logic, e.g. first it tries to use the RemoteDataStore, but if it fails it falls back to the DataStore and sets a timer to keep checking.

Does that help?