focus-flow/packages/scheduler_persistence/lib/persistence/schedule_snapshot_repository.dart

29 lines
1 KiB
Dart

part of '../persistence.dart';
/// Repository contract for diagnostic schedule snapshots.
abstract interface class ScheduleSnapshotRepository {
/// Return the snapshot with [snapshotId] in [ownerId], or null when absent.
Future<RepoResult<core.SchedulingStateSnapshot?>> findById({
required core.OwnerId ownerId,
required String snapshotId,
});
/// Return snapshots captured for [ownerId] that overlap [window].
Future<RepoResult<core.Page<core.SchedulingStateSnapshot>>> findInWindow({
required core.OwnerId ownerId,
required core.SchedulingWindow window,
core.PageRequest page = const core.PageRequest(),
});
/// Insert [snapshot] for [ownerId] and return the assigned revision.
Future<RepoResult<core.Revision>> insert({
required core.OwnerId ownerId,
required core.SchedulingStateSnapshot snapshot,
});
/// Delete snapshots whose retention expiry is before [nowUtc].
Future<RepoResult<int>> deleteExpired({
required core.OwnerId ownerId,
required DateTime nowUtc,
});
}