/* Copyright 2010 Nathan Phillip Brink, Ethan Zonca, Matthew Orlando This file is a part of DistRen. DistRen is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. DistRen is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with DistRen. If not, see . */ #ifndef MYSQL_H_ #define MYSQL_H_ #include "distrenjob.h" #include struct distrend_mysql_conn; struct distrend_mysql_result; typedef struct distrend_mysql_conn *distrend_mysql_conn_t; typedef struct distrend_mysql_result *distrend_mysql_result_t; /** initiates a MySQL connection @param conn pointer will be set to the struct @param user the mysql username @param host the hostname of the mysql server @param pass the password for the mysql account @param database the database on the mysql server to use @return 0 on success */ int mysqlConnect(distrend_mysql_conn_t *conn, const char *user, const char *host, const char *pass, const char *database); /** cleans and disconnects MySQL connection @param conn connection to clean @return 0 on success */ int mysqlDisconnect(distrend_mysql_conn_t conn); /** Mark a frame as finished in the database and calculate the seconds spent on that frame. */ void finish_frame(distrend_mysql_conn_t conn, int32_t slavekey, int32_t jobkey, int32_t framenum); /** Mark a frame as started in the database and save the time at which it started. */ void start_frame(distrend_mysql_conn_t conn, int32_t slavekey, int32_t jobkey, int32_t framenum); /** Mark a frame as started in the database and save the time at which it started. */ void set_renderpower(distrend_mysql_conn_t conn, int32_t slavekey, int32_t renderpower); /** Changes the priority of an existing (and maybe running) job. @arg head I may end up changing the head if job == head */ int change_job_priority(distrend_mysql_conn_t conn, int32_t jobkey, int32_t newpriority); /** Frame Finder: Finds a frame for a slave to render */ int find_jobframe(distrend_mysql_conn_t conn, int32_t slaveKey, jobnum_t *jobKey, int32_t *frameNum); /** Auth Slave: Checks username/password of slave */ int auth_slave(distrend_mysql_conn_t conn, int32_t slavekey, char *slavepass); /** Frame Watchdog: Reassigns stale frames on server */ void frame_watchdog(distrend_mysql_conn_t conn); #endif /* MYSQL_H_ */