/*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package androidx.room;
import androidx.annotation.RestrictTo;
import androidx.arch.core.executor.ArchTaskExecutor;
import java.util.Set;
import java.util.concurrent.Callable;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import io.reactivex.BackpressureStrategy;
import io.reactivex.Flowable;
import io.reactivex.FlowableEmitter;
import io.reactivex.FlowableOnSubscribe;
import io.reactivex.Maybe;
import io.reactivex.MaybeSource;
import io.reactivex.Scheduler;
import io.reactivex.annotations.NonNull;
import io.reactivex.disposables.Disposable;
import io.reactivex.disposables.Disposables;
import io.reactivex.functions.Action;
import io.reactivex.functions.Function;
/**
* Helper class to add RxJava2 support to Room.
*/
@SuppressWarnings("WeakerAccess")
public class RxRoom {
/**
* Data dispatched by the publisher created by {@link #createFlowable(RoomDatabase, String...)}.
*/
public static final Object NOTHING = new Object();
/**
* Creates a {@link Flowable} that emits at least once and also re-emits whenever one of the
* observed tables is updated.
*
* You can easily chain a database operation to downstream of this {@link Flowable} to ensure
* that it re-runs when database is modified.
*
* Since database invalidation is batched, multiple changes in the database may results in just
* 1 emission.
*
* @param database The database instance
* @param tableNames The list of table names that should be observed
* @return A {@link Flowable} which emits {@link #NOTHING} when one of the observed tables
* is modified (also once when the invalidation tracker connection is established).
*/
public static Flowable