view scid/db.h @ 18:600204c31bf0

misc: refactor
author David Demelier <markand@malikania.fr>
date Tue, 12 Jul 2022 20:20:51 +0200
parents db.h@3ef8128e244f
children
line wrap: on
line source

/*
 * db.h -- scid database access
 *
 * Copyright (c) 2021 David Demelier <markand@malikania.fr>
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#ifndef SCI_DB_H
#define SCI_DB_H

#include <sys/types.h>
#include <stddef.h>

struct project;
struct worker;
struct job;
struct jobresult;

struct db_ctx {
	void *handle;
};

int
db_open(const char *);

int
db_job_add(struct job *);

ssize_t
db_job_todo(struct db_ctx *, struct job *, size_t, int);

int
db_jobresult_add(struct jobresult *);

int
db_project_add(struct project *);

int
db_project_update(const struct project *);

ssize_t
db_project_list(struct db_ctx *, struct project *, size_t);

int
db_project_find(struct db_ctx *, struct project *);

int
db_project_find_id(struct db_ctx *, struct project *);

int
db_worker_add(struct worker *);

ssize_t
db_worker_list(struct db_ctx *, struct worker *, size_t);

int
db_worker_find(struct db_ctx *, struct worker *);

int
db_worker_find_id(struct db_ctx *, struct worker *);

void
db_finish(void);

void
db_ctx_finish(struct db_ctx *);

#endif /* !SCI_DB_H */