window

package
v0.0.0-...-50fdeb8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 18, 2024 License: BSD-3-Clause Imports: 7 Imported by: 10

Documentation

Index

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL