Ejemplo n.º 1
0
        private void applyTombstones()
        {
            Tombstone    cur = null, prev = null;
            List <ulong> batch = new List <ulong>(4096);

            tombstoner.Walk(new WalkFn(walk), new object[] { cur, prev, batch });
            if (batch.Count > 0)
            {
                index.DeleteRange(batch, cur.Min, cur.Max);
            }
        }
Ejemplo n.º 2
0
 public void Walk(WalkFn fn, object obj)
 {
     lock (lockthis)
     {
         using (FileStream fs = File.Open(Path, FileMode.Open))
         {
             using (GZipStream gzip = new GZipStream(fs, CompressionMode.Decompress))
             {
                 byte[] bytes = new byte[headerSize];
                 int    count = gzip.Read(bytes, 0, 4);
                 if (count == 4)
                 {
                     while (true)
                     {
                         try
                         {
                             bytes = new byte[24];
                             count = gzip.Read(bytes, 0, 24);
                             if (count < 24)
                             {
                                 break;
                             }
                             Tombstone tombstone = new Tombstone();
                             tombstone.Sid = BitConverter.ToUInt64(bytes, 0);
                             tombstone.Min = BitConverter.ToInt64(bytes, 8);
                             tombstone.Max = BitConverter.ToInt64(bytes, 16);
                             fn(tombstone, obj);
                         }
                         catch (Exception ex)
                         {
                             Logger.Error("Walk error: " + ex.Message);
                             break;
                         }
                     }
                 }
             }
         }
     }
 }
Ejemplo n.º 3
0
        private void walk(Tombstone ts, object obj)
        {
            object[]     paras = (object[])obj;
            Tombstone    cur   = (Tombstone)paras[0];
            Tombstone    prev  = (Tombstone)paras[1];
            List <ulong> batch = (List <ulong>)paras[2];

            cur = ts;
            if (batch.Count > 0)
            {
                if (prev.Min != cur.Min || prev.Max != cur.Max)
                {
                    index.DeleteRange(batch, prev.Min, prev.Max);
                    batch.Clear();
                }
            }
            batch.Add(ts.Sid);
            if (batch.Count > 4096)
            {
                index.DeleteRange(batch, prev.Min, prev.Max);
                batch.Clear();
            }
            prev = ts;
        }
Ejemplo n.º 4
0
 private void append(Tombstone t, object obj)
 {
     ((List <Tombstone>)obj).Add(t);
 }