forked from vieter-v/vieter
docs: added comment string to each function
This commit is contained in:
parent
fb65efdfbe
commit
f9f440500e
12 changed files with 49 additions and 1 deletions
|
|
@ -16,6 +16,7 @@ pub:
|
|||
timestamp time.Time
|
||||
}
|
||||
|
||||
// Overloaded operator for comparing ScheduledBuild objects
|
||||
fn (r1 ScheduledBuild) < (r2 ScheduledBuild) bool {
|
||||
return r1.timestamp < r2.timestamp
|
||||
}
|
||||
|
|
@ -147,6 +148,8 @@ fn (mut d Daemon) schedule_build(repo_id string, repo git.GitRepo) ? {
|
|||
})
|
||||
}
|
||||
|
||||
// renew_repos requests the newest list of Git repos from the server & replaces
|
||||
// the old one.
|
||||
fn (mut d Daemon) renew_repos() ? {
|
||||
d.linfo('Renewing repos...')
|
||||
mut new_repos := git.get_repos(d.address, d.api_key) ?
|
||||
|
|
@ -189,6 +192,7 @@ fn (mut d Daemon) renew_queue() ? {
|
|||
}
|
||||
}
|
||||
|
||||
// rebuild_base_image recreates the builder image.
|
||||
fn (mut d Daemon) rebuild_base_image() ? {
|
||||
d.linfo('Rebuilding builder image....')
|
||||
|
||||
|
|
@ -196,6 +200,8 @@ fn (mut d Daemon) rebuild_base_image() ? {
|
|||
d.image_build_timestamp = time.now().add_seconds(60 * d.image_rebuild_frequency)
|
||||
}
|
||||
|
||||
// clean_old_base_images tries to remove any old but still present builder
|
||||
// images.
|
||||
fn (mut d Daemon) clean_old_base_images() {
|
||||
mut i := 0
|
||||
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@ pub fn (ce &CronExpression) next(ref time.Time) ?time.Time {
|
|||
if minute_index == ce.minutes.len && hour_index < ce.hours.len {
|
||||
hour_index += 1
|
||||
}
|
||||
|
||||
if hour_index == ce.hours.len && day_index < ce.days.len {
|
||||
day_index += 1
|
||||
}
|
||||
|
|
@ -197,6 +198,8 @@ fn parse_range(s string, min int, max int, mut bitv []bool) ? {
|
|||
}
|
||||
}
|
||||
|
||||
// bitv_to_ints converts a bit vector into an array containing the
|
||||
// corresponding values.
|
||||
fn bitv_to_ints(bitv []bool, min int) []int {
|
||||
mut out := []int{}
|
||||
|
||||
|
|
@ -209,6 +212,8 @@ fn bitv_to_ints(bitv []bool, min int) []int {
|
|||
return out
|
||||
}
|
||||
|
||||
// parse_part parses a given part of a cron expression & returns the
|
||||
// corresponding array of ints.
|
||||
fn parse_part(s string, min int, max int) ?[]int {
|
||||
mut bitv := []bool{len: max - min + 1, init: false}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue