@Override public Observable<RawJsonDocument> call(AsyncN1qlQueryRow row) { String id = new String(row.byteValue()).trim(); return bucket.async().get(id.substring(1, id.length()-1), RawJsonDocument.class); } })
/** * Performs the {@link #delete(String, String)} (String, String)} operation via Key/Value ("remove"). * * @param docId the document ID. * @return The result of the operation. */ private Status deleteKv(final String docId) { waitForMutationResponse(bucket.async().remove( docId, persistTo, replicateTo )); return Status.OK; }
waitForMutationResponse(bucket.async().insert( RawJsonDocument.create(docId, documentExpiry, encode(values)), persistTo,
/** * Performs the {@link #update(String, String, Map)} operation via Key/Value ("replace"). * * @param docId the document ID * @param values the values to update the document with. * @return The result of the operation. */ private Status updateKv(final String docId, final Map<String, ByteIterator> values) { waitForMutationResponse(bucket.async().replace( RawJsonDocument.create(docId, documentExpiry, encode(values)), persistTo, replicateTo )); return Status.OK; }
/** * Performs the {@link #upsert(String, String, Map)} operation via Key/Value ("upsert"). * * If this option should be used, the "-p couchbase.upsert=true" property must be set. * * @param docId the document ID * @param values the values to update the document with. * @return The result of the operation. */ private Status upsertKv(final String docId, final Map<String, ByteIterator> values) { waitForMutationResponse(bucket.async().upsert( RawJsonDocument.create(docId, documentExpiry, encode(values)), persistTo, replicateTo )); return Status.OK; }
final Vector<HashMap<String, ByteIterator>> result) { final List<HashMap<String, ByteIterator>> data = new ArrayList<HashMap<String, ByteIterator>>(recordcount); bucket.async() .query(N1qlQuery.parameterized( scanAllQuery,
AsyncBucket async = bucket.async(); bind.apply(AsyncBucket.class, name, async);
((TupleDocument) record).content().value1().retain(); Observable<D> observable = _bucket.async().upsert(record); if (callback == null) { return new WriteResponseFuture<>(
public CouchbaseRepository(Bucket bucket, CouchbaseEnvironment environment) { this.timeout = environment.kvTimeout(); this.asyncRepository = bucket.async().repository().toBlocking().single(); }
public RxJavaCouchbaseTemplate(final ClusterInfo clusterInfo, final Bucket client, final CouchbaseConverter converter, final TranslationService translationService) { this.syncClient = client; this.clusterInfo = clusterInfo; this.client = client.async(); this.converter = converter == null ? getDefaultConverter() : converter; this.translationService = translationService == null ? getDefaultTranslationService() : translationService; this.mappingContext = this.converter.getMappingContext(); }
public RxJavaCouchbaseTemplate(final ClusterInfo clusterInfo, final Bucket client, final CouchbaseConverter converter, final TranslationService translationService) { this.syncClient = client; this.clusterInfo = clusterInfo; this.client = client.async(); this.converter = converter == null ? getDefaultConverter() : converter; this.translationService = translationService == null ? getDefaultTranslationService() : translationService; this.mappingContext = this.converter.getMappingContext(); }
@Override public void onNext(CouchbaseEvent event) { RawJsonDocument doc = RawJsonDocument.create( generateKey(event), Events.toJson(event, false) ); Observable<RawJsonDocument> stored; if (storeType == StoreType.INSERT) { stored = bucket.async().insert(doc); } else if (storeType == StoreType.UPSERT) { stored = bucket.async().upsert(doc); } else { throw new UnsupportedOperationException("Store type " + storeType + " is not supported"); } stored .onErrorResumeNext(new Func1<Throwable, Observable<? extends RawJsonDocument>>() { @Override public Observable<? extends RawJsonDocument> call(Throwable ex) { LOGGER.warn("Received error while storing document in bucket consumer.", ex); return Observable.empty(); } }) .subscribe(); }
return bucket.async().query(createPrimary) .flatMap(new Func1<AsyncN1qlQueryResult, Observable<JsonObject>>() { @Override
return bucket.async().query(createPrimary) .flatMap(new Func1<AsyncN1qlQueryResult, Observable<JsonObject>>() { @Override
return bucket.async().query(createIndex) .flatMap(new Func1<AsyncN1qlQueryResult, Observable<JsonObject>>() { @Override
return bucket.async().query(createIndex) .flatMap(new Func1<AsyncN1qlQueryResult, Observable<JsonObject>>() { @Override
return executeAsync(client.async().query(query)) .flatMap(new Func1<AsyncViewResult, Observable<AsyncViewRow>>() { @Override
return executeAsync(client.async().query(query)) .flatMap(new Func1<AsyncViewResult, Observable<AsyncViewRow>>() { @Override
.async() .query(query) .timeout(anTimeout, TimeUnit.MILLISECONDS)