Esempio n. 1
0
 public byte[] this[byte[] key]
 {
     get
     {
         return(Db.Get(key));
     }
     set
     {
         UpdateWriteMetrics();
         if (CurrentBatch != null)
         {
             if (value == null)
             {
                 CurrentBatch.Delete(key);
             }
             else
             {
                 CurrentBatch.Put(key, value);
             }
         }
         else
         {
             if (value == null)
             {
                 Db.Remove(key, null, WriteOptions);
             }
             else
             {
                 Db.Put(key, value, null, WriteOptions);
             }
         }
     }
 }
        public void AddDocumentToBatch(Document document)
        {
            if (CurrentBatch == null)
            {
                CurrentBatch = new DocumentBatch(document.Number, document.Prefix);
            }

            CurrentBatch.Add(document);
        }
Esempio n. 3
0
        private async Task SendCurrentBatch()
        {
            if (CurrentBatch.IsEmpty)
            {
                return;
            }
            var numberToSend = CurrentBatch.Count;

            await SendBatchAsync(CurrentBatch.ToArray());

            Indexed += numberToSend;
            CurrentBatch.Clear();
        }
Esempio n. 4
0
 public StimuliSet GetSet()
 {
     return(CurrentBatch.GetSet());
 }