private static void Using(Action <ILinks <TLink> > action) { using (var dataMemory = new HeapResizableDirectMemory()) using (var indexMemory = new HeapResizableDirectMemory()) using (var memory = new UInt64SplitMemoryLinks(dataMemory, indexMemory)) { action(memory); } }
private static void UsingWithExternalReferences(Action <ILinks <TLink> > action) { var contants = new LinksConstants <TLink>(enableExternalReferencesSupport: true); using (var dataMemory = new HeapResizableDirectMemory()) using (var indexMemory = new HeapResizableDirectMemory()) using (var memory = new UInt64SplitMemoryLinks(dataMemory, indexMemory, UInt64SplitMemoryLinks.DefaultLinksSizeStep, contants)) { action(memory); } }
public TempLinksTestScope(SequencesOptions <ulong> sequencesOptions, bool deleteFiles = true, bool useSequences = false, bool useLog = false) { _deleteFiles = deleteFiles; TempFilename = Path.GetTempFileName(); TempTransactionLogFilename = Path.GetTempFileName(); //var coreMemoryAdapter = new UInt64UnitedMemoryLinks(TempFilename); var coreMemoryAdapter = new UInt64SplitMemoryLinks(new FileMappedResizableDirectMemory(TempFilename), new FileMappedResizableDirectMemory(Path.ChangeExtension(TempFilename, "indexes")), UInt64SplitMemoryLinks.DefaultLinksSizeStep, new LinksConstants <ulong>(), Memory.IndexTreeType.Default, useLinkedList: true); MemoryAdapter = useLog ? (ILinks <ulong>) new UInt64LinksTransactionsLayer(coreMemoryAdapter, TempTransactionLogFilename) : coreMemoryAdapter; Links = new SynchronizedLinks <ulong>(new UInt64Links(MemoryAdapter)); if (useSequences) { Sequences = new Sequences.Sequences(Links, sequencesOptions); } }