protected internal override void Process(RECORD[] batch, BatchSender sender) { System.Func <long, IdSequence> idSequence = _prepareIdSequence.apply(Store); int recordsUpdatedInThisBatch = 0; foreach (RECORD record in batch) { if (record != null && record.inUse() && !IdValidator.isReservedId(record.Id)) { Store.prepareForCommit(record, idSequence(record.Id)); Store.updateRecord(record); recordsUpdatedInThisBatch++; } } _recordsUpdated.add(recordsUpdatedInThisBatch); }
protected internal override void Process(RelationshipGroupRecord[] batch, BatchSender sender) { int groupStartIndex = 0; for (int i = 0; i < batch.Length; i++) { RelationshipGroupRecord group = batch[i]; // The iterator over the groups will not produce real next pointers, they are instead // a count meaning how many groups come after it. This encoder will set the real group ids. long count = group.Next; bool lastInChain = count == 0; group.Id = _nextId == -1 ? _nextId = _store.nextId() : _nextId; if (!lastInChain) { group.Next = _nextId = _store.nextId(); } else { group.Next = _nextId = -1; // OK so this group is the last in this chain, which means all the groups in this chain // are now fully populated. We can now prepare these groups so that their potential // secondary units ends up very close by. for (int j = groupStartIndex; j <= i; j++) { _store.prepareForCommit(batch[j]); } groupStartIndex = i + 1; } } Debug.Assert(groupStartIndex == batch.Length); sender.Send(batch); }
public override void PrepareForCommit(R record) { Actual.prepareForCommit(record); }