1 /* 2 * Copyright (C) 2021 Jakub Kruszona-Zawadzki, Core Technology Sp. z o.o. 3 * 4 * This file is part of MooseFS. 5 * 6 * MooseFS is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation, version 2 (only). 9 * 10 * MooseFS is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with MooseFS; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA 18 * or visit http://www.gnu.org/licenses/gpl-2.0.html 19 */ 20 21 #ifndef _CSDB_H_ 22 #define _CSDB_H_ 23 24 #include <inttypes.h> 25 #include "bio.h" 26 27 void* csdb_new_connection(uint32_t ip,uint16_t port,uint16_t csid,void *eptr); 28 uint16_t csdb_get_csid(void *v_csptr); 29 void csdb_temporary_maintenance_mode(void *v_csptr); 30 void csdb_lost_connection(void *v_csptr); 31 void csdb_server_load(void *v_csptr,uint32_t load); 32 uint8_t csdb_server_is_overloaded(void *v_csptr,uint32_t now); 33 uint8_t csdb_server_is_being_maintained(void *v_csptr); 34 uint32_t csdb_servlist_size(void); 35 void csdb_servlist_data(uint8_t *ptr); 36 uint8_t csdb_remove_server(uint32_t ip,uint16_t port); 37 uint8_t csdb_back_to_work(uint32_t ip,uint16_t port); 38 uint8_t csdb_maintenance(uint32_t ip,uint16_t port,uint8_t onoff); 39 uint8_t csdb_have_all_servers(void); 40 uint8_t csdb_have_more_than_half_servers(void); 41 uint8_t csdb_replicate_undergoals(void); 42 uint16_t csdb_servers_count(void); 43 void csdb_cleanup(void); 44 uint16_t csdb_sort_servers(void); 45 uint16_t csdb_getnumber(void *v_csptr); 46 uint8_t csdb_store(bio *fd); 47 int csdb_load(bio *fd,uint8_t mver,int ignoreflag); 48 int csdb_init(void); 49 uint8_t csdb_mr_op(uint8_t csop,uint32_t ip,uint16_t port,uint32_t arg); 50 #define csdb_mr_csadd(x,y) csdb_mr_op(0,x,y,0) 51 #define csdb_mr_csdel(x,y) csdb_mr_op(1,x,y,0) 52 // uint32_t csdb_getdisconnecttime(void); 53 54 #endif 55