Ejemplo n.º 1
0
 public _Iterator_138(FanoutBucket _enclosing, MutableObjectId id, ObjectReader reader
                      )
 {
     this._enclosing = _enclosing;
     this.id         = id;
     this.reader     = reader;
 }
        internal virtual FanoutBucket Split()
        {
            FanoutBucket n = new FanoutBucket(prefixLen);

            for (int i = 0; i < cnt; i++)
            {
                n.Append(notes[i]);
            }
            n.nonNotes = nonNotes;
            return(n);
        }
Ejemplo n.º 3
0
 /// <exception cref="System.IO.IOException"></exception>
 private void AddIfNotNull(FanoutBucket b, int cell, NoteBucket child)
 {
     if (child == null)
     {
         return;
     }
     if (child is InMemoryNoteBucket)
     {
         b.SetBucket(cell, ((InMemoryNoteBucket)child).WriteTree(inserter));
     }
     else
     {
         b.SetBucket(cell, child.GetTreeId());
     }
 }
Ejemplo n.º 4
0
        private FanoutBucket ParseFanoutTree()
        {
            FanoutBucket fanout = new FanoutBucket(prefixLen);

            for (; !Eof; Next(1))
            {
                int cell = ParseFanoutCell();
                if (0 <= cell)
                {
                    fanout.SetBucket(cell, EntryObjectId);
                }
                else
                {
                    StoreNonNote();
                }
            }
            return(fanout);
        }
Ejemplo n.º 5
0
        /// <exception cref="System.IO.IOException"></exception>
        private InMemoryNoteBucket MergeFanoutBucket(int treeDepth, FanoutBucket @base, FanoutBucket
                                                     ours, FanoutBucket theirs)
        {
            FanoutBucket result = new FanoutBucket(treeDepth * 2);

            // walking through entries of base, ours, theirs
            for (int i = 0; i < 256; i++)
            {
                NoteBucket b = @base.GetBucket(i);
                NoteBucket o = ours.GetBucket(i);
                NoteBucket t = theirs.GetBucket(i);
                if (Equals(o, t))
                {
                    AddIfNotNull(result, i, o);
                }
                else
                {
                    if (Equals(b, o))
                    {
                        AddIfNotNull(result, i, t);
                    }
                    else
                    {
                        if (Equals(b, t))
                        {
                            AddIfNotNull(result, i, o);
                        }
                        else
                        {
                            objectIdPrefix.SetByte(treeDepth, i);
                            InMemoryNoteBucket mergedBucket = Merge(treeDepth + 1, FanoutBucket.LoadIfLazy(b,
                                                                                                           objectIdPrefix, reader), FanoutBucket.LoadIfLazy(o, objectIdPrefix, reader), FanoutBucket
                                                                    .LoadIfLazy(t, objectIdPrefix, reader));
                            result.SetBucket(i, mergedBucket);
                        }
                    }
                }
            }
            return(result.ContractIfTooSmall(objectIdPrefix, reader));
        }
Ejemplo n.º 6
0
 internal LazyNoteBucket(FanoutBucket _enclosing, ObjectId treeId)
 {
     this._enclosing = _enclosing;
     this.treeId     = treeId;
 }