/// <summary> /// Creates a segment that stores data in memory mapped files /// </summary> internal override DefaultPileBase._segment MakeSegment(int segmentNumber) { var memory = new MMFMemory(DataDirectory, segmentNumber, SegmentSize); var result = new DefaultPileBase._segment(this, memory, true); return(result); }
protected override void DoStart() { if (!Directory.Exists(DataDirectoryRoot)) { throw new PileException(StringConsts.PILE_MMF_NO_DATA_DIRECTORY_ROOT_ERROR.Args(DataDirectoryRoot)); } Directory.CreateDirectory(DataDirectory); base.DoStart(); //load existing data var segFiles = MMFMemory.GetSegmentFileNames(DataDirectory); var pidx = -1; for (var i = 0; i < segFiles.Length; i++) { var segFile = segFiles[i]; for (var j = pidx + 1; j < segFile.Value; j++) { __addSegmentAtStart(null); } pidx = segFile.Value; var memory = new MMFMemory(DataDirectory, segFile.Value); var segment = new DefaultPileBase._segment(this, memory, false); __addSegmentAtStart(segment); } //1 thread since this is a io bound operation var segments = __getSegmentsAtStart(); Task.Factory.StartNew(() => crawlSegmentsAtStart(segments), TaskCreationOptions.LongRunning); }
protected override void DoStart() { if (!Directory.Exists(DataDirectoryRoot)) { throw new PileException(StringConsts.PILE_MMF_NO_DATA_DIRECTORY_ROOT_ERROR.Args(DataDirectoryRoot)); } Directory.CreateDirectory(DataDirectory); readCurrentTypeRegistry(); base.DoStart(); //load existing data var segFiles = MMFMemory.GetSegmentFileNames(DataDirectory); var pidx = -1; for (var i = 0; i < segFiles.Length; i++) { var segFile = segFiles[i]; for (var j = pidx + 1; j < segFile.Value; j++) { __addSegmentAtStart(null); } pidx = segFile.Value; var memory = new MMFMemory(DataDirectory, segFile.Value); var segment = new DefaultPileBase._segment(this, memory, false); __addSegmentAtStart(segment); } //1 thread since this is a io bound operation var segments = __getSegmentsAtStart(); Task.Factory.StartNew(() => crawlSegmentsAtStart(segments), TaskCreationOptions.LongRunning); m_ManagerEvent = new NFX.Time.Event(App.EventTimer, interval: new TimeSpan(0, 0, 20), enabled: true, body: _ => AcceptManagerVisit(this, DateTime.UtcNow), bodyAsyncModel: Time.EventBodyAsyncModel.AsyncTask) { }; }