2022-01-20 18:27:56 +00:00
|
|
|
// This file Copyright 2015-2022 Mnemosyne LLC.
|
|
|
|
// It may be used under GPLv2 (SPDX: GPL-2.0), GPLv3 (SPDX: GPL-3.0),
|
|
|
|
// or any future license endorsed by Mnemosyne LLC.
|
|
|
|
// License text can be found in the licenses/ folder.
|
2016-01-02 14:28:59 +00:00
|
|
|
|
2016-03-29 16:37:21 +00:00
|
|
|
#pragma once
|
2016-01-02 14:28:59 +00:00
|
|
|
|
2021-11-15 04:49:56 +00:00
|
|
|
#include <string_view>
|
|
|
|
|
2016-01-02 14:28:59 +00:00
|
|
|
struct event_base;
|
|
|
|
|
2021-10-06 14:26:07 +00:00
|
|
|
using tr_watchdir_t = struct tr_watchdir*;
|
2016-01-02 14:28:59 +00:00
|
|
|
|
2021-10-06 14:26:07 +00:00
|
|
|
enum tr_watchdir_status
|
2016-01-02 14:28:59 +00:00
|
|
|
{
|
2017-04-19 12:04:45 +00:00
|
|
|
TR_WATCHDIR_ACCEPT,
|
|
|
|
TR_WATCHDIR_IGNORE,
|
|
|
|
TR_WATCHDIR_RETRY
|
2021-10-06 14:26:07 +00:00
|
|
|
};
|
2016-01-02 14:28:59 +00:00
|
|
|
|
2021-10-06 14:26:07 +00:00
|
|
|
using tr_watchdir_cb = tr_watchdir_status (*)(tr_watchdir_t handle, char const* name, void* user_data);
|
2016-01-02 14:28:59 +00:00
|
|
|
|
|
|
|
/* ... */
|
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
tr_watchdir_t tr_watchdir_new(
|
2021-11-15 04:49:56 +00:00
|
|
|
std::string_view path,
|
2021-08-15 09:41:48 +00:00
|
|
|
tr_watchdir_cb callback,
|
|
|
|
void* callback_user_data,
|
|
|
|
struct event_base* event_base,
|
|
|
|
bool force_generic);
|
2016-01-02 14:28:59 +00:00
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
void tr_watchdir_free(tr_watchdir_t handle);
|
2016-01-02 14:28:59 +00:00
|
|
|
|
2017-04-20 16:02:19 +00:00
|
|
|
char const* tr_watchdir_get_path(tr_watchdir_t handle);
|