public IEnumerable <T> Batch <T>(Func <IRiakBatchClient, IEnumerable <T> > batchFunction) { var batchEndPoint = new RiakBatch(_endPoint); var batchedClient = new RiakClient(batchEndPoint); return(batchFunction(batchedClient)); }
public T Batch <T>(Func <IRiakBatchClient, T> batchFunction) { var batchEndPoint = new RiakBatch(_endPoint); var batchedClient = new RiakClient(batchEndPoint); return(batchFunction(batchedClient)); }
public void Batch(Action <IRiakBatchClient> batchAction) { var batchEndPoint = new RiakBatch(_endPoint); var batchedClient = new RiakClient(batchEndPoint); batchAction(batchedClient); }
public T Batch <T>(Func <IRiakBatchClient, T> batchFun) { return(WaitFor(_client.Batch(ac => { var c = new RiakClient((RiakAsyncClient)ac); var s = new TaskCompletionSource <T>(); s.SetResult(batchFun(c)); return s.Task; }))); }
public Task Batch(Action <IRiakBatchClient> batchAction) { return(Batch <object>(ac => { return Task <object> .Factory.StartNew(() => { var c = new RiakClient((RiakAsyncClient)ac); batchAction(c); return new object(); }); })); }
public async Task <Either <RiakException, RiakObject> > Get(string bucket, string key, RiakGetOptions options = null) { options = options ?? RiakClient.DefaultGetOptions(); if (!IsValidBucketOrKey(bucket)) { return(new Either <RiakException, RiakObject>(new RiakException((uint)ResultCode.InvalidRequest, InvalidBucketErrorMessage, false))); } if (!IsValidBucketOrKey(key)) { return(new Either <RiakException, RiakObject>(new RiakException((uint)ResultCode.InvalidRequest, InvalidKeyErrorMessage, false))); } var request = new RpbGetReq { bucket = bucket.ToRiakString(), key = key.ToRiakString() }; options = options ?? new RiakGetOptions(); options.Populate(request); try { var result = await _connection.PbcWriteRead <RpbGetReq, RpbGetResp>(_endPoint, request).ConfigureAwait(false); if (result.vclock == null) { return(new Either <RiakException, RiakObject>(new RiakException((uint)ResultCode.NotFound, "Unable to find value in Riak", false))); } var riakObject = new RiakObject(bucket, key, result.content, result.vclock); return(new Either <RiakException, RiakObject>(riakObject)); } catch (RiakException riakException) { return(new Either <RiakException, RiakObject>(riakException)); } }
public void Get(IEnumerable <RiakObjectId> bucketKeyPairs, Action <IEnumerable <RiakResult <RiakObject> > > callback, RiakGetOptions options = null) { options = options ?? RiakClient.DefaultGetOptions(); ExecAsync(() => callback(_client.Get(bucketKeyPairs, options))); }
public void Get(RiakObjectId objectId, Action <RiakResult <RiakObject> > callback, RiakGetOptions options = null) { options = options ?? RiakClient.DefaultGetOptions(); ExecAsync(() => callback(_client.Get(objectId.Bucket, objectId.Key, options))); }
public void Get(string bucket, string key, Action <RiakResult <RiakObject> > callback, RiakGetOptions options = null) { options = options ?? RiakClient.DefaultGetOptions(); ExecAsync(() => callback(_client.Get(bucket, key, options))); }
public Task <IEnumerable <RiakResult <RiakObject> > > Get(IEnumerable <RiakObjectId> bucketKeyPairs, RiakGetOptions options = null) { options = options ?? RiakClient.DefaultGetOptions(); return(Task.Factory.StartNew(() => _client.Get(bucketKeyPairs, options))); }
public Task <RiakResult <RiakObject> > Get(RiakObjectId objectId, RiakGetOptions options = null) { options = options ?? RiakClient.DefaultGetOptions(); return(Task.Factory.StartNew(() => _client.Get(objectId.Bucket, objectId.Key, options))); }
public Task <RiakResult <RiakObject> > Get(string bucket, string key, RiakGetOptions options = null) { options = options ?? RiakClient.DefaultGetOptions(); return(Task.Factory.StartNew(() => _client.Get(bucket, key, options))); }