コード例 #1
0
 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;
 }
コード例 #2
0
        public T Find(Predicate <IndexBlock> selector)
        {
            IndexBlock indexBlock = Index.Find(selector);

            if (indexBlock == null)
            {
                return(default(T));
            }
            return(Find(indexBlock));
        }
コード例 #3
0
        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));
            }
        }
コード例 #4
0
        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);
 }
コード例 #6
0
 abstract protected void DoRegistIndex(IndexBlock indexBlock);
コード例 #7
0
 override protected void DoRegistIndex(IndexBlock indexBlock)
 {
 }