RemoveEntry() public method

This removes an entry from the TableServerData, the current dht does not support deletes, but if the second stage of a put (the remote PutHandler) fails, the entry needs to be deleted from this node.
public RemoveEntry ( MemBlock key, MemBlock value ) : void
key MemBlock The index the data is stored at.
value MemBlock The data to remove.
return void
Exemplo n.º 1
0
        public void Test0()
        {
            RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider();
            TableServerData          tsd = new TableServerData("0");

            byte[] key = new byte[20];
            rng.GetBytes(key);
            DateTime now = DateTime.UtcNow;
            Entry    ent = new Entry(key, key, now, now.AddSeconds(100));

            tsd.AddEntry(ent);
            LinkedList <Entry> entries = tsd.GetEntries(key);

            Assert.AreEqual(1, entries.Count, "Count after add");
            Assert.AreEqual(ent, entries.First.Value, "Entries are equal");
            tsd.UpdateEntry(ent.Key, ent.Value, now.AddSeconds(200));
            entries = tsd.GetEntries(key);
            Assert.AreEqual(1, entries.Count, "Count after update");
            Assert.AreEqual(ent, entries.First.Value, "Entries are equal");
            tsd.RemoveEntry(ent.Key, ent.Value);
            entries = tsd.GetEntries(key);
            Assert.AreEqual(tsd.Count, 0, "Count after remove");
            Assert.AreEqual(null, entries, "Entry after remove");
        }
Exemplo n.º 2
0
 public void Test0() {
   RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider();
   TableServerData tsd = new TableServerData("0");
   byte[] key = new byte[20];
   rng.GetBytes(key);
   DateTime now = DateTime.UtcNow;
   Entry ent = new Entry(key, key, now, now.AddSeconds(100));
   tsd.AddEntry(ent);
   LinkedList<Entry> entries = tsd.GetEntries(key);
   Assert.AreEqual(1, entries.Count, "Count after add");
   Assert.AreEqual(ent, entries.First.Value, "Entries are equal");
   tsd.UpdateEntry(ent.Key, ent.Value, now.AddSeconds(200));
   entries = tsd.GetEntries(key);
   Assert.AreEqual(1, entries.Count, "Count after update");
   Assert.AreEqual(ent, entries.First.Value, "Entries are equal");
   tsd.RemoveEntry(ent.Key, ent.Value);
   entries = tsd.GetEntries(key);
   Assert.AreEqual(tsd.Count, 0, "Count after remove");
   Assert.AreEqual(null, entries, "Entry after remove");
 }