Esempio n. 1
0
        private static PersistentIndex CreateFromBytes(IBlobManager blobManager, ReadOnlyMemory <byte> bytes)
        {
            var index = new PersistentIndex(new LazinatorMemory(bytes));

            index.BlobManager = blobManager;
            return(index);
        }
Esempio n. 2
0
 /// <summary>
 /// Prepares for new version of index file to be created, based on previous version of the index
 /// </summary>
 /// <param name="previousPersistentIndex"></param>
 public PersistentIndex(PersistentIndex previousPersistentIndex, int?additionalFork = null)
 {
     PreviousPersistentIndex = previousPersistentIndex;
     BaseBlobPath            = previousPersistentIndex.BaseBlobPath;
     BlobManager             = previousPersistentIndex.BlobManager;
     ContainedInSingleBlob   = previousPersistentIndex.ContainedInSingleBlob;
     IsPersisted             = false;
     IndexVersion            = previousPersistentIndex.IndexVersion + 1;
     InitializeMemoryChunkStatusFromPrevious();
     if (additionalFork is int forkToAdd)
     {
         ForkInformation = previousPersistentIndex.ForkInformation?.ToList() ?? new List <(int lastMemoryChunkBeforeFork, int forkNumber)>();
         ForkInformation.Add((PreviousPersistentIndex.GetLastMemoryBlockID(), forkToAdd));
     }
 }