Documentation ¶
Index ¶
- type Window
- type WindowImpl
- func (w *WindowImpl) EarliestStart() time.Time
- func (w *WindowImpl) Start(repo string) time.Time
- func (w *WindowImpl) StartTimesByRepo() map[string]time.Time
- func (w *WindowImpl) TestCommit(repo string, c *repograph.Commit) bool
- func (w *WindowImpl) TestCommitHash(repo, revision string) (bool, error)
- func (w *WindowImpl) TestTime(repo string, t time.Time) bool
- func (w *WindowImpl) Update(ctx context.Context) error
- func (w *WindowImpl) UpdateWithTime(now time.Time) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Window ¶
type Window interface { // Update updates the start time of the Window. Update(ctx context.Context) error // UpdateWithTime updates the start time of the Window, using the given current time. UpdateWithTime(now time.Time) error // Start returns the time.Time at the beginning of the Window. Start(repo string) time.Time // TestTime determines whether the given Time is in the Window. TestTime(repo string, t time.Time) bool // TestCommit determines whether the given commit is in the Window. TestCommit(repo string, c *repograph.Commit) bool // TestCommitHash determines whether the given commit is in the Window. TestCommitHash(repo, revision string) (bool, error) // EarliestStart returns the earliest start time of any repo's Window. EarliestStart() time.Time // StartTimesByRepo returns a map of repo URL to start time of that repo's // window. StartTimesByRepo() map[string]time.Time }
Window uses both a Git repo and a duration of time to determine whether a given commit or timestamp is within a specified scheduling range, eg. 10 commits or the last 24 hours.
type WindowImpl ¶
type WindowImpl struct {
// contains filtered or unexported fields
}
WindowImpl is a struct used for managing time windows based on a duration and a minimum number of commits in zero or more repositories.
func New ¶
func New(ctx context.Context, duration time.Duration, numCommits int, repos repograph.Map) (*WindowImpl, error)
New returns a Window instance.
func (*WindowImpl) EarliestStart ¶
func (w *WindowImpl) EarliestStart() time.Time
EarliestStart implements Window.
func (*WindowImpl) Start ¶
func (w *WindowImpl) Start(repo string) time.Time
Start implements Window.
func (*WindowImpl) StartTimesByRepo ¶
func (w *WindowImpl) StartTimesByRepo() map[string]time.Time
StartTimesByRepo implements Window.
func (*WindowImpl) TestCommit ¶
func (w *WindowImpl) TestCommit(repo string, c *repograph.Commit) bool
TestCommit implements Window.
func (*WindowImpl) TestCommitHash ¶
func (w *WindowImpl) TestCommitHash(repo, revision string) (bool, error)
TestCommitHash implements Window.
func (*WindowImpl) TestTime ¶
func (w *WindowImpl) TestTime(repo string, t time.Time) bool
TestTime implements Window.
func (*WindowImpl) Update ¶
func (w *WindowImpl) Update(ctx context.Context) error
Update implements Window.
func (*WindowImpl) UpdateWithTime ¶
func (w *WindowImpl) UpdateWithTime(now time.Time) error
UpdateWithTime implements Window.
Click to show internal directories.
Click to hide internal directories.