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

[WIP] Expose persister fetcher #301

Open
wants to merge 2 commits into
base: feature/rx2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,19 +1,34 @@
package com.nytimes.android.external.store3.base;

import com.nytimes.android.external.store3.base.impl.Store;

import javax.annotation.Nonnull;

import io.reactivex.Maybe;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;

/**
2 * this interface allows us to mark a {@link Store} as "internal", exposing methods for retrieving data
* This interface allows us to mark a {@link Store} as "internal", exposing methods for retrieving data
* directly from memory or from disk.
*/
public interface InternalStore<Parsed, Key> extends Store<Parsed, Key> {

@Nonnull
Maybe<Parsed> memory(@Nonnull final Key key);

@Nonnull
Maybe<Parsed> disk(@Nonnull final Key key);

/**
* @return The given persister for that store.
* Or {@link com.nytimes.android.external.store3.util.NoopPersister} if not added.
* @see com.nytimes.android.external.store3.base.impl.RealStoreBuilder#persister
*/
@Nonnull
Persister<?, Key> persister();

/**
* @return The given fetcher for that store. Or {@code null} if not added.
* @see com.nytimes.android.external.store3.base.impl.RealStoreBuilder#fetcher
*/
@Nullable
Fetcher<?, Key> fetcher();
}
Original file line number Diff line number Diff line change
Expand Up @@ -304,17 +304,15 @@ private void notifyRefresh(@Nonnull Key key) {
refreshSubject.onNext(key);
}

/**
* @return DiskDAO that stores and stores <Raw> data
*/
Persister<Raw, Key> persister() {
@Nonnull
@Override
public Persister<Raw, Key> persister() {
return persister;
}

/**
*
*/
Fetcher<Raw, Key> fetcher() {
@Nullable
@Override
public Fetcher<Raw, Key> fetcher() {
return fetcher;
}
}
Expand Down