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

com.couchbase.client.java.repository.Repository Maven / Gradle / Ivy

/*
 * Copyright (c) 2016 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.repository;

import com.couchbase.client.core.annotations.InterfaceAudience;
import com.couchbase.client.core.annotations.InterfaceStability;
import com.couchbase.client.java.PersistTo;
import com.couchbase.client.java.ReplicaMode;
import com.couchbase.client.java.ReplicateTo;
import com.couchbase.client.java.document.EntityDocument;
import java.util.List;
import java.util.concurrent.TimeUnit;

/**
 * The repository abstraction for entities on top of a bucket.
 *
 * @author Michael Nitschinger
 * @since 2.2.0
 */
@InterfaceAudience.Public
@InterfaceStability.Experimental
public interface Repository {

    AsyncRepository async();

     EntityDocument get(String id, Class entityClass);
     EntityDocument get(String id, Class entityClass, long timeout, TimeUnit timeUnit);

     List> getFromReplica(String id, ReplicaMode type, Class entityClass);
     List> getFromReplica(String id, ReplicaMode type, Class entityClass, long timeout, TimeUnit timeUnit);

     EntityDocument getAndLock(String id, int lockTime, Class entityClass);
     EntityDocument getAndLock(String id, int lockTime, Class entityClass, long timeout, TimeUnit timeUnit);

     EntityDocument getAndTouch(String id, int expiry, Class entityClass);
     EntityDocument getAndTouch(String id, int expiry, Class entityClass, long timeout, TimeUnit timeUnit);

    boolean exists(String id);
    boolean exists(String id, long timeout, TimeUnit timeUnit);
     boolean exists(EntityDocument document);
     boolean exists(EntityDocument document, long timeout, TimeUnit timeUnit);

     EntityDocument upsert(EntityDocument document);
     EntityDocument upsert(EntityDocument document, long timeout, TimeUnit timeUnit);
     EntityDocument upsert(EntityDocument document, PersistTo persistTo);
     EntityDocument upsert(EntityDocument document, PersistTo persistTo, long timeout, TimeUnit timeUnit);
     EntityDocument upsert(EntityDocument document, ReplicateTo replicateTo);
     EntityDocument upsert(EntityDocument document, ReplicateTo replicateTo, long timeout, TimeUnit timeUnit);
     EntityDocument upsert(EntityDocument document, PersistTo persistTo, ReplicateTo replicateTo);
     EntityDocument upsert(EntityDocument document, PersistTo persistTo, ReplicateTo replicateTo, long timeout, TimeUnit timeUnit);

     EntityDocument insert(EntityDocument document);
     EntityDocument insert(EntityDocument document, long timeout, TimeUnit timeUnit);
     EntityDocument insert(EntityDocument document, PersistTo persistTo);
     EntityDocument insert(EntityDocument document, PersistTo persistTo, long timeout, TimeUnit timeUnit);
     EntityDocument insert(EntityDocument document, ReplicateTo replicateTo);
     EntityDocument insert(EntityDocument document, ReplicateTo replicateTo, long timeout, TimeUnit timeUnit);
     EntityDocument insert(EntityDocument document, PersistTo persistTo, ReplicateTo replicateTo);
     EntityDocument insert(EntityDocument document, PersistTo persistTo, ReplicateTo replicateTo, long timeout, TimeUnit timeUnit);

     EntityDocument replace(EntityDocument document);
     EntityDocument replace(EntityDocument document, long timeout, TimeUnit timeUnit);
     EntityDocument replace(EntityDocument document, PersistTo persistTo);
     EntityDocument replace(EntityDocument document, PersistTo persistTo, long timeout, TimeUnit timeUnit);
     EntityDocument replace(EntityDocument document, ReplicateTo replicateTo);
     EntityDocument replace(EntityDocument document, ReplicateTo replicateTo, long timeout, TimeUnit timeUnit);
     EntityDocument replace(EntityDocument document, PersistTo persistTo, ReplicateTo replicateTo);
     EntityDocument replace(EntityDocument document, PersistTo persistTo, ReplicateTo replicateTo, long timeout, TimeUnit timeUnit);

     EntityDocument remove(EntityDocument document);
     EntityDocument remove(EntityDocument document, long timeout, TimeUnit timeUnit);
     EntityDocument remove(EntityDocument document, PersistTo persistTo);
     EntityDocument remove(EntityDocument document, PersistTo persistTo, long timeout, TimeUnit timeUnit);
     EntityDocument remove(EntityDocument document, ReplicateTo replicateTo);
     EntityDocument remove(EntityDocument document, ReplicateTo replicateTo, long timeout, TimeUnit timeUnit);
     EntityDocument remove(EntityDocument document, PersistTo persistTo, ReplicateTo replicateTo);
     EntityDocument remove(EntityDocument document, PersistTo persistTo, ReplicateTo replicateTo, long timeout, TimeUnit timeUnit);
     EntityDocument remove(String id, Class entityClass);
     EntityDocument remove(String id, Class entityClass, long timeout, TimeUnit timeUnit);
     EntityDocument remove(String id, PersistTo persistTo, Class entityClass);
     EntityDocument remove(String id, PersistTo persistTo, Class entityClass, long timeout, TimeUnit timeUnit);
     EntityDocument remove(String id, ReplicateTo replicateTo, Class entityClass);
     EntityDocument remove(String id, ReplicateTo replicateTo, Class entityClass, long timeout, TimeUnit timeUnit);
     EntityDocument remove(String id, PersistTo persistTo, ReplicateTo replicateTo, Class entityClass);
     EntityDocument remove(String id, PersistTo persistTo, ReplicateTo replicateTo, Class entityClass, long timeout, TimeUnit timeUnit);

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy