virtual public void CopyTo(VirtualCollection <T> target)
 {
     Flush();
     GZipHelper.CopyStream(StoreStream, target.StoreStream);
     IndexBlock[] indexList = new IndexBlock[Index.Count];
     Index.CopyTo(indexList);
     target.Index    = new List <IndexBlock>(indexList);
     target.Transfer = Transfer;
 }
        public T Find(Predicate <IndexBlock> selector)
        {
            IndexBlock indexBlock = Index.Find(selector);

            if (indexBlock == null)
            {
                return(default(T));
            }
            return(Find(indexBlock));
        }
        public T Find(IndexBlock indexBlock)
        {
            StoreStream.Position = indexBlock.StartPos;
            int count = (int)(indexBlock.EndPos - indexBlock.StartPos);

            byte[] buffer = new byte[count];
            StoreStream.Read(buffer, 0, count);
            using (var stream = new MemoryStream(buffer))
            {
                return(Transfer.Deserialize <T>(stream));
            }
        }
        private void RegistIndex(object key, long startPosition, long endPosition)
        {
            IndexBlock block = Index.Find(it => it.Key == key);

            if (block == null)
            {
                block = new IndexBlock()
                {
                    Key = key, StartPos = startPosition, EndPos = endPosition
                };
                DoRegistIndex(block);
                Index.Add(block);
            }
        }
예제 #5
0
 protected override void DoRegistIndex(IndexBlock indexBlock)
 {
     indexTransfer.Serialize(indexBlock, indexStream);
 }
 abstract protected void DoRegistIndex(IndexBlock indexBlock);
예제 #7
0
 override protected void DoRegistIndex(IndexBlock indexBlock)
 {
 }