Search in sources :

Example 1 with AppendOptions

use of com.couchbase.client.java.kv.AppendOptions in project couchbase-jvm-clients by couchbase.

the class ReactiveBinaryCollection method append.

/**
 * Appends binary content to the document with custom options.
 *
 * @param id the document id which is used to uniquely identify it.
 * @param content the binary content to append to the document.
 * @param options custom options to customize the append behavior.
 * @return a {@link MutationResult} once completed.
 * @throws DocumentNotFoundException the given document id is not found in the collection.
 * @throws CasMismatchException if the document has been concurrently modified on the server.
 * @throws TimeoutException if the operation times out before getting a result.
 * @throws CouchbaseException for all other error reasons (acts as a base type and catch-all).
 */
public Mono<MutationResult> append(final String id, final byte[] content, final AppendOptions options) {
    return Mono.defer(() -> {
        notNull(options, "AppendOptions", () -> ReducedKeyValueErrorContext.create(id, async.collectionIdentifier()));
        AppendOptions.Built opts = options.build();
        AppendRequest request = async.appendRequest(id, content, opts);
        return Reactor.wrap(request, AppendAccessor.append(core, request, id, opts.persistTo(), opts.replicateTo()), true);
    });
}
Also used : AppendOptions(com.couchbase.client.java.kv.AppendOptions) AppendRequest(com.couchbase.client.core.msg.kv.AppendRequest)

Aggregations

AppendRequest (com.couchbase.client.core.msg.kv.AppendRequest)1 AppendOptions (com.couchbase.client.java.kv.AppendOptions)1