public T Get <T>(string key) { var bucket = Configuration.GetBucketForType <T>(); var document = Get <T>(bucket.BucketName, key, bucket.QuorumReadNodes); VectorClockLookup.SetVectorFor(key, document.VectorClock); return(document.Value); }
public bool Persist <T>(string bucket, string key, string vectorClock, Document <T> document, uint writeQuorum, uint minimumWrites) { var riakContent = new RiakContent(document.Value.ToProtocolBuffer(), document.ContentType, document.Charset, document.ContentEncoding, document.VectorClock, document.LastModified, document.LastModifiedInSeconds); var command = vectorClock == null ? CommandFactory.CreatePersistNew(bucket, key, riakContent, writeQuorum, minimumWrites, true) : CommandFactory.CreatePersistExisting(bucket, key, vectorClock, riakContent, writeQuorum, minimumWrites, true); Persisted result; var success = (result = command.Execute()) != null; if (success) { VectorClockLookup.SetVectorFor(key, ByteExtensions.FromBytes(result.VectorClock)); } return(success); }