Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion services/meta/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down