backfillComplete method

  1. @override
Future<void> backfillComplete(
  1. String model,
  2. int throughSequence, {
  3. String? tenant,
})
override

A backfill copied every live row of model as of throughSequence; anything the destination holds that the backfill did not touch and no later change wrote is gone from the source.

Implementation

@override
Future<void> backfillComplete(
  String model,
  int throughSequence, {
  String? tenant,
}) async {
  await _ensureModel(model);
  final List<DVFilter> scope = <DVFilter>[
    DVFilter.compare('_dv_seq', DVCompare.lessOrEqual, throughSequence),
    if (tenant != null) DVFilter.equals('_dv_tenant', tenant),
  ];
  await _records.delete(
    model,
    where: DVFilter.all(<DVFilter>[
      ...scope,
      const DVFilter.isNull('_dv_backfilled'),
    ]),
  );
  await _records.delete(
    model,
    where: DVFilter.all(<DVFilter>[
      ...scope,
      DVFilter.compare('_dv_backfilled', DVCompare.less, throughSequence),
    ]),
  );
}