Store icon indicating copy to clipboard operation
Store copied to clipboard

Persister & Fetcher accessable in Store-Interface

Open StefMa opened this issue 8 years ago • 4 comments

Currently we developing some architecture we we put two stores and a fetcher into another class. Which reads like that:

liveStore: Store,
notLiveStore: Store,
notLivePersister: Persister

Which reads a little bit odd because the notLivePersister is already a part of the notLiveStore.

So, what do you think to add

@Nullable getPersister(): Persister
@Nullable getFetcher(): Fetcher

to the Store-Interface? 🤔 Maybe we can also add the Policy and the Parser, but that is not important as the two others IMO 😅

What do you think?

StefMa avatar Nov 20 '17 15:11 StefMa

There is an interface InternalStore, you can expose those getters as public from RealInternalStore and then cast your store. Pr welcome 🙂

digitalbuddha avatar Nov 23 '17 15:11 digitalbuddha

How can I access the persister than? 🤔 Just casting to InternalStore wouldn't work. Because open returns a Store. But this Store is not a InternalStore... 🤔

StefMa avatar Dec 08 '17 09:12 StefMa

I've started with it at #301 But I need a little bit help... How is your idea? 🤔

As I already commented. The problem is that Store isn't a subclass ob InternalStore. And RealStore don't implement InternalStore... So how should we solve that in this way?

Either we add fetcher() and persister() to the Store interface (which I don't like), or RealStore should be a subclass of RealInternalStore... Or what? 😅

StefMa avatar Dec 08 '17 09:12 StefMa

I think adding the two getters to Store would be simplest. Sorry for delay getting back to you 🙂

If you want to make it cleaner make a new store builder configuration called exposedStore. When that flag is set to true you can create an ExposedStore which is a subclass of store with the addl getters. Would that work? (on a plane and can't look around)

digitalbuddha avatar Jan 11 '18 06:01 digitalbuddha