refactor: link libvieter; remove cron code & daemon

This giant commit removes the old cron daemon & parser, replacing the
latter with a C implementation that will now be maintained in a separate
C library that gets developed independently. This commit lays the
groundwork for implementing features of Vieter in C where possible.
This commit is contained in:
Jef Roosens 2023-01-12 12:26:12 +01:00
parent bfd28d6f70
commit beb90d5756
26 changed files with 278 additions and 916 deletions

View file

@ -1,7 +1,7 @@
module schedule
import cli
import cron.expression { parse_expression }
import cron
import time
// cmd returns the cli submodule for previewing a cron schedule.
@ -19,10 +19,10 @@ pub fn cmd() cli.Command {
},
]
execute: fn (cmd cli.Command) ! {
ce := parse_expression(cmd.args.join(' '))!
ce := cron.parse_expression(cmd.args.join(' '))!
count := cmd.flags.get_int('count')!
for t in ce.next_n(time.now(), count)! {
for t in ce.next_n(time.now(), count) {
println(t)
}
}

View file

@ -2,7 +2,7 @@ module targets
import cli
import conf as vconf
import cron.expression { parse_expression }
import cron
import client { NewTarget }
import console
import models { TargetFilter }
@ -295,7 +295,7 @@ fn patch(conf Config, id string, params map[string]string) ! {
// We check the cron expression first because it's useless to send an
// invalid one to the server.
if 'schedule' in params && params['schedule'] != '' {
parse_expression(params['schedule']) or {
cron.parse_expression(params['schedule']) or {
return error('Invalid cron expression: $err.msg()')
}
}