summaryrefslogtreecommitdiffstats
path: root/src/indexer/worker-connection.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/indexer/worker-connection.h')
-rw-r--r--src/indexer/worker-connection.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/indexer/worker-connection.h b/src/indexer/worker-connection.h
new file mode 100644
index 0000000..e664c7e
--- /dev/null
+++ b/src/indexer/worker-connection.h
@@ -0,0 +1,36 @@
+#ifndef WORKER_CONNECTION_H
+#define WORKER_CONNECTION_H
+
+#include "indexer.h"
+
+struct indexer_request;
+struct connection_list;
+
+typedef void worker_available_callback_t(void);
+
+struct connection *
+worker_connection_create(const char *socket_path,
+ indexer_status_callback_t *callback,
+ worker_available_callback_t *avail_callback,
+ struct connection_list *list);
+void worker_connection_destroy(struct connection *conn);
+
+struct connection_list *worker_connection_list_create(void);
+
+/* Returns TRUE if worker is connected to (not necessarily handshaked yet) */
+bool worker_connection_is_connected(struct connection *conn);
+
+/* Returns the last process_limit returned by a worker connection handshake.
+ If no handshakes have been received yet, returns 0. */
+unsigned int worker_connections_get_process_limit(void);
+
+/* Send a new indexing request for username+mailbox. The status callback is
+ called as necessary. Requests can be queued, but only for the same
+ username. */
+void worker_connection_request(struct connection *conn,
+ struct indexer_request *request);
+/* Returns username of the currently pending requests,
+ or NULL if there are none. */
+const char *worker_connection_get_username(struct connection *conn);
+
+#endif