chore: rename db module to avoid conflict with vlib

dev
Jef Roosens 2023-02-08 11:09:18 +01:00
parent b3a119f221
commit 91a976c634
Signed by untrusted user: Jef Roosens
GPG Key ID: B75D4F293C7052DB
19 changed files with 15 additions and 17 deletions

View File

@ -3,7 +3,7 @@ SRC_DIR := src
SRCS != find '$(SRC_DIR)' -iname '*.v' SRCS != find '$(SRC_DIR)' -iname '*.v'
V_PATH ?= v V_PATH ?= v
V := $(V_PATH) -showcc -gc boehm -W -d use_openssl -skip-unused V := $(V_PATH) -showcc -gc boehm -d use_openssl -skip-unused
all: vieter all: vieter

View File

@ -143,7 +143,7 @@ pub fn (mut q BuildJobQueue) peek(arch string) ?BuildJob {
} }
q.pop_invalid(arch) q.pop_invalid(arch)
job := q.queues[arch].peek()? job := q.queues[arch].peek() or { return none }
if job.timestamp < time.now() { if job.timestamp < time.now() {
return job return job
@ -162,10 +162,10 @@ pub fn (mut q BuildJobQueue) pop(arch string) ?BuildJob {
} }
q.pop_invalid(arch) q.pop_invalid(arch)
mut job := q.queues[arch].peek()? mut job := q.queues[arch].peek() or { return none }
if job.timestamp < time.now() { if job.timestamp < time.now() {
job = q.queues[arch].pop()? job = q.queues[arch].pop() or { return none }
if !job.single { if !job.single {
q.reschedule(job, arch) q.reschedule(job, arch)

View File

@ -1,6 +1,6 @@
module db module dbms
import sqlite import db.sqlite
import time import time
pub struct VieterDb { pub struct VieterDb {
@ -49,8 +49,8 @@ pub fn init(db_path string) !VieterDb {
} }
// Apply each migration in order // Apply each migration in order
for i in cur_version.version .. db.migrations_up.len { for i in cur_version.version .. dbms.migrations_up.len {
migration := db.migrations_up[i].to_string() migration := dbms.migrations_up[i].to_string()
version_num := i + 1 version_num := i + 1

View File

@ -1,4 +1,4 @@
module db module dbms
import models { BuildLog, BuildLogFilter } import models { BuildLog, BuildLogFilter }
import time import time

View File

@ -1,4 +1,4 @@
module db module dbms
import models { Target, TargetArch } import models { Target, TargetArch }

View File

@ -1,7 +1,7 @@
module db module dbms
import models { Target, TargetFilter } import models { Target, TargetFilter }
import sqlite import db.sqlite
// Iterator providing a filtered view into the list of targets currently stored // Iterator providing a filtered view into the list of targets currently stored
// in the database. It replaces functionality usually performed in the database // in the database. It replaces functionality usually performed in the database

View File

@ -3,7 +3,6 @@ module server
import web import web
import net.urllib import net.urllib
import web.response { new_data_response, new_response } import web.response { new_data_response, new_response }
import db
import time import time
import os import os
import util import util

View File

@ -2,7 +2,6 @@ module server
import web import web
import web.response { new_data_response, new_response } import web.response { new_data_response, new_response }
import db
import models { Target, TargetArch, TargetFilter } import models { Target, TargetArch, TargetFilter }
// v1_get_targets returns the current list of targets. // v1_get_targets returns the current list of targets.

View File

@ -5,7 +5,7 @@ import os
import log import log
import repo import repo
import util import util
import db import dbms
import build { BuildJobQueue } import build { BuildJobQueue }
import cron import cron
import metrics import metrics
@ -25,7 +25,7 @@ pub mut:
repo repo.RepoGroupManager [required; web_global] repo repo.RepoGroupManager [required; web_global]
// Keys are the various architectures for packages // Keys are the various architectures for packages
job_queue BuildJobQueue [required; web_global] job_queue BuildJobQueue [required; web_global]
db db.VieterDb db dbms.VieterDb
} }
// init_job_queue populates a fresh job queue with all the targets currently // init_job_queue populates a fresh job queue with all the targets currently
@ -88,7 +88,7 @@ pub fn server(conf Config) ! {
} }
db_file := os.join_path_single(conf.data_dir, server.db_file_name) db_file := os.join_path_single(conf.data_dir, server.db_file_name)
db := db.init(db_file) or { db := dbms.init(db_file) or {
util.exit_with_message(1, 'Failed to initialize database: ${err.msg()}') util.exit_with_message(1, 'Failed to initialize database: ${err.msg()}')
} }