All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.couchbase.client.java.manager.query.ReactiveQueryIndexManager Maven / Gradle / Ivy

There is a newer version: 3.7.2
Show newest version
/*
 * Copyright 2019 Couchbase, Inc.
 *
 * 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 com.couchbase.client.java.manager.query;

import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

import java.time.Duration;
import java.util.Collection;

import static com.couchbase.client.core.Reactor.toFlux;
import static com.couchbase.client.core.Reactor.toMono;
import static java.util.Objects.requireNonNull;

public class ReactiveQueryIndexManager {
  private final AsyncQueryIndexManager async;

  public ReactiveQueryIndexManager(AsyncQueryIndexManager async) {
    this.async = requireNonNull(async);
  }

  public Mono createIndex(String bucketName, String indexName, Collection fields) {
    return toMono(() -> async.createIndex(bucketName, indexName, fields));
  }

  public Mono createIndex(String bucketName, String indexName, Collection fields, CreateQueryIndexOptions options) {
    return toMono(() -> async.createIndex(bucketName, indexName, fields, options));
  }

  public Mono createPrimaryIndex(String bucketName) {
    return toMono(() -> async.createPrimaryIndex(bucketName));
  }

  public Mono createPrimaryIndex(String bucketName, CreatePrimaryQueryIndexOptions options) {
    return toMono(() -> async.createPrimaryIndex(bucketName, options));
  }

  public Flux getAllIndexes(String bucketName) {
    return toFlux(() -> async.getAllIndexes(bucketName));
  }

  public Flux getAllIndexes(String bucketName, GetAllQueryIndexesOptions options) {
    return toFlux(() -> async.getAllIndexes(bucketName, options));
  }

  public Mono dropPrimaryIndex(String bucketName) {
    return toMono(() -> async.dropPrimaryIndex(bucketName));
  }

  public Mono dropPrimaryIndex(String bucketName, DropPrimaryQueryIndexOptions options) {
    return toMono(() -> async.dropPrimaryIndex(bucketName, options));
  }

  public Mono dropIndex(String bucketName, String indexName) {
    return toMono(() -> async.dropIndex(bucketName, indexName));
  }

  public Mono dropIndex(String bucketName, String indexName, DropQueryIndexOptions options) {
    return toMono(() -> async.dropIndex(bucketName, indexName, options));
  }

  public Mono buildDeferredIndexes(String bucketName) {
    return toMono(() -> async.buildDeferredIndexes(bucketName));
  }

  public Mono buildDeferredIndexes(String bucketName, BuildQueryIndexOptions options) {
    return toMono(() -> async.buildDeferredIndexes(bucketName, options));
  }

  public Mono watchIndexes(String bucketName, Collection indexNames, Duration timeout) {
    return toMono(() -> async.watchIndexes(bucketName, indexNames, timeout));
  }

  public Mono watchIndexes(String bucketName, Collection indexNames, Duration timeout, WatchQueryIndexesOptions options) {
    return toMono(() -> async.watchIndexes(bucketName, indexNames, timeout, options));
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy