pull/26718/merge
WeblWabl 2026-03-23 15:29:10 -05:00 committed by GitHub
commit 07cf4e5114
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 1 deletions

View File

@ -1438,13 +1438,21 @@ func (a ShardGroupInfos) Less(i, j int) bool {
return iEnd.Before(jEnd)
}
// Contains returns true iif StartTime ≤ t < EndTime.
// Contains returns true iif StartTime ≤ t < EndTime
// or if shard was Truncated and the StartTime == TruncatedAt.
func (sgi *ShardGroupInfo) Contains(t time.Time) bool {
if sgi.Truncated() && sgi.TruncatedAt.Equal(sgi.StartTime) {
return false
}
return !t.Before(sgi.StartTime) && t.Before(sgi.EndTime)
}
// Overlaps returns whether the shard group contains data for the time range between min and max
// or if shard was Truncated and the StartTime == TruncatedAt.
func (sgi *ShardGroupInfo) Overlaps(min, max time.Time) bool {
if sgi.Truncated() && sgi.TruncatedAt.Equal(sgi.StartTime) {
return false
}
return !sgi.StartTime.After(max) && sgi.EndTime.After(min)
}