421d30619384e72a27e2a5d13ff6525aff4d17feTimo Sirainen#ifndef FTS_BUILD_H
421d30619384e72a27e2a5d13ff6525aff4d17feTimo Sirainen#define FTS_BUILD_H
421d30619384e72a27e2a5d13ff6525aff4d17feTimo Sirainen
16db137525d75c3b2a61cbcbca54a0d348603e61Timo Sirainenstruct fts_backend;
421d30619384e72a27e2a5d13ff6525aff4d17feTimo Sirainenstruct fts_indexer_context;
421d30619384e72a27e2a5d13ff6525aff4d17feTimo Sirainen
421d30619384e72a27e2a5d13ff6525aff4d17feTimo Sirainen/* Initialize indexing the given mailbox via indexer service. Returns 1 if
421d30619384e72a27e2a5d13ff6525aff4d17feTimo Sirainen indexing started, 0 if there was no need to index or -1 if error. */
421d30619384e72a27e2a5d13ff6525aff4d17feTimo Sirainenint fts_indexer_init(struct fts_backend *backend, struct mailbox *box,
421d30619384e72a27e2a5d13ff6525aff4d17feTimo Sirainen struct fts_indexer_context **ctx_r);
421d30619384e72a27e2a5d13ff6525aff4d17feTimo Sirainen/* Returns 0 if ok, -1 if error. */
421d30619384e72a27e2a5d13ff6525aff4d17feTimo Sirainenint fts_indexer_deinit(struct fts_indexer_context **ctx);
421d30619384e72a27e2a5d13ff6525aff4d17feTimo Sirainen
421d30619384e72a27e2a5d13ff6525aff4d17feTimo Sirainen/* Build more. Returns 1 if finished, 0 if this function needs to be called
421d30619384e72a27e2a5d13ff6525aff4d17feTimo Sirainen again, -1 if error. */
421d30619384e72a27e2a5d13ff6525aff4d17feTimo Sirainenint fts_indexer_more(struct fts_indexer_context *ctx);
421d30619384e72a27e2a5d13ff6525aff4d17feTimo Sirainen
421d30619384e72a27e2a5d13ff6525aff4d17feTimo Sirainen/* Returns fd, which you can either read from or close. */
421d30619384e72a27e2a5d13ff6525aff4d17feTimo Sirainenint fts_indexer_cmd(struct mail_user *user, const char *cmd,
421d30619384e72a27e2a5d13ff6525aff4d17feTimo Sirainen const char **path_r);
421d30619384e72a27e2a5d13ff6525aff4d17feTimo Sirainen
421d30619384e72a27e2a5d13ff6525aff4d17feTimo Sirainen#endif