Пример #1
0
 public Persist(string bucket, string key, string vectorClock, RiakContent content, uint write, uint dw,
                bool returnBody)
     : this(bucket, key, content, write, dw, returnBody)
 {
     // Not sure why, but this causes the Riak server to fail to respond at ALL
     //VectorClock = vectorClock.ToBytes();
 }
Пример #2
0
 public Persist(string bucket, string key, RiakContent content, uint write, uint dw, bool returnBody)
 {
     Bucket     = bucket.ToBytes();
     Key        = key.ToBytes();
     Content    = content;
     Write      = write.ToggleEndianicity();
     Dw         = dw.ToggleEndianicity();
     ReturnBody = returnBody;
 }
Пример #3
0
        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);
        }
Пример #4
0
 public Persist CreatePersistExisting( string bucket, string key, string vectorClock, RiakContent content,
                                       uint write, uint dw, bool returnBody )
 {
     return new Persist( bucket, key, vectorClock, content, write, dw, returnBody );
 }
Пример #5
0
 public Persist CreatePersistNew( string bucket, string key, RiakContent content, uint write, uint dw,
                                  bool returnBody )
 {
     return new Persist( bucket, key, content, write, dw, returnBody );
 }