internal UidSpaceMapper(long strideLength, long newBaseUid, long oldBaseUid, long numUrls, string fileName) { this.oldBaseUid = oldBaseUid; this.newBaseUid = newBaseUid; this.numUrls = numUrls; this.strideLength = strideLength; using (var stream = new BufferedStream(new FileStream(fileName, FileMode.Open, FileAccess.Read))) { this.bytes = new CachedStream(stream, (ulong)stream.Length); this.deco = new VarNybbleIntStreamDecompressor(this.bytes); } // Construct the index by parsing this.bytes long numIdxItems = (numUrls / strideLength) + 1; this.idxPosition = new ulong[numIdxItems]; this.idxGapSum = new ulong[numIdxItems]; ulong gapSum = 0; int p = 0; for (long i = 0; i <= numUrls; i++) { if (i % strideLength == 0) { this.idxPosition[p] = deco.GetPosition(); this.idxGapSum[p] = gapSum; p++; } if (i < numUrls) gapSum += deco.GetUInt64(); } Contract.Assert(p == numIdxItems); Contract.Assert(deco.AtEnd()); }
private readonly ulong[] idxGapSum; // sum of the gaps up to this point internal UidSpaceMapper(long strideLength, long newBaseUid, long oldBaseUid, long numUrls, string fileName) { this.oldBaseUid = oldBaseUid; this.newBaseUid = newBaseUid; this.numUrls = numUrls; this.strideLength = strideLength; using (var stream = new BufferedStream(new FileStream(fileName, FileMode.Open, FileAccess.Read))) { this.bytes = new CachedStream(stream, (ulong)stream.Length); this.deco = new VarNybbleIntStreamDecompressor(this.bytes); } // Construct the index by parsing this.bytes long numIdxItems = (numUrls / strideLength) + 1; this.idxPosition = new ulong[numIdxItems]; this.idxGapSum = new ulong[numIdxItems]; ulong gapSum = 0; int p = 0; for (long i = 0; i <= numUrls; i++) { if (i % strideLength == 0) { this.idxPosition[p] = deco.GetPosition(); this.idxGapSum[p] = gapSum; p++; } if (i < numUrls) { gapSum += deco.GetUInt64(); } } Contract.Assert(p == numIdxItems); Contract.Assert(deco.AtEnd()); }
private long nextPuid; // stateful internal TemporalLinkCellRd(LinkCell linkCell) { this.linkCell = linkCell; this.decompressor = this.linkCell.NewDecompressor(); this.nextPuid = 0; }
private long nextPuid; // stateful #endregion Fields #region Constructors internal LinkCellRd(LinkCell linkCell) { this.linkCell = linkCell; this.decompressor = this.linkCell.NewDecompressor(); this.nextPuid = 0; }