view db.h @ 8:ec800a5fb7e3

scid: advertise -s option
author David Demelier <markand@malikania.fr>
date Wed, 23 Jun 2021 11:45:07 +0200
parents 566bc028cdcb
children 3ef8128e244f
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 *);

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 */