Skip to content
This repository has been archived by the owner on Dec 7, 2019. It is now read-only.

Persister & Fetcher accessable in Store-Interface #291

Open
StefMa opened this issue Nov 20, 2017 · 4 comments · May be fixed by #301
Open

Persister & Fetcher accessable in Store-Interface #291

StefMa opened this issue Nov 20, 2017 · 4 comments · May be fixed by #301

Comments

@StefMa
Copy link
Contributor

StefMa commented Nov 20, 2017

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?

@digitalbuddha
Copy link
Contributor

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

@StefMa
Copy link
Contributor Author

StefMa commented Dec 8, 2017

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 StefMa linked a pull request Dec 8, 2017 that will close this issue
@StefMa
Copy link
Contributor Author

StefMa commented Dec 8, 2017

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? 😅

@digitalbuddha
Copy link
Contributor

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)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants