|
|
|
|
@ -41,6 +41,7 @@ struct DB_SYNC_INSTANCE;
|
|
|
|
|
// Error codes for DB_MSG_ERROR
|
|
|
|
|
#define DB_ERR_NOT_FOUND 0x01 // instance not found
|
|
|
|
|
#define DB_ERR_DISABLED 0x02 // instance exists but disabled
|
|
|
|
|
#define DB_ERR_NOT_READY 0x03 // участники или групповая сессия ещё не готовы
|
|
|
|
|
|
|
|
|
|
// Defaults
|
|
|
|
|
#define DB_SYNC_DEFAULT_TTL 86400 |
|
|
|
|
@ -65,8 +66,8 @@ int db_sync_enable(struct UTUN_INSTANCE* inst);
|
|
|
|
|
// Отменить таймеры/обмен, снять обработчики; общую SQLite не закрывает.
|
|
|
|
|
void db_sync_destroy(struct UTUN_INSTANCE* inst); |
|
|
|
|
|
|
|
|
|
// Зарегистрировать/найти таблицу для group_id. auto_sync запускает начальный обмен; NULL при ошибке.
|
|
|
|
|
struct DB_SYNC_INSTANCE* db_sync_instance_add(struct UTUN_INSTANCE* inst, const char* table_name, uint64_t group_id, int auto_sync); |
|
|
|
|
// Зарегистрировать таблицу существующей группы без сетевого обмена; первоначально gated. NULL при ошибке.
|
|
|
|
|
struct DB_SYNC_INSTANCE* db_sync_instance_add(struct UTUN_INSTANCE* inst, const char* table_name, uint64_t group_id); |
|
|
|
|
// Освободить экземпляр синхронизации; сама таблица остаётся в БД.
|
|
|
|
|
void db_sync_instance_remove(struct DB_SYNC_INSTANCE* si); |
|
|
|
|
// Заимствованный указатель по group_id; действителен до remove/destroy, NULL если нет.
|
|
|
|
|
@ -115,8 +116,8 @@ void db_sync_peer_set_state(struct DB_SYNC_INSTANCE* si, uint64_t node_id, uint8
|
|
|
|
|
// Per-(chat,peer) «play sound on message» flag: sound_off + sleeping peer → throttled.
|
|
|
|
|
void db_sync_set_peer_sound(struct UTUN_INSTANCE* inst, uint64_t group_id, uint64_t peer_node_id, int sound_on); |
|
|
|
|
|
|
|
|
|
// Gate auto-sync: while gated the instance does not auto-initiate sync (waits for
|
|
|
|
|
// member_sync/pubkeys). Un-gating launches sync to peers in sync_state==0.
|
|
|
|
|
// До успешного member_sync блокирует входящий и исходящий обмен. После снятия
|
|
|
|
|
// блокировки запускает историю только через READY-пиров этой группы.
|
|
|
|
|
void db_sync_instance_set_gated(struct DB_SYNC_INSTANCE* si, int gated); |
|
|
|
|
|
|
|
|
|
// Force re-initiate sync to a specific peer (for testing)
|
|
|
|
|
|