view src/plugins/fts-squat/squat-trie.h @ 6410:e4eb71ae8e96 HEAD

Changed .h ifdef/defines to use <NAME>_H format.
author Timo Sirainen <tss@iki.fi>
date Sun, 16 Sep 2007 11:31:27 +0300
parents 5e604d6f391e
children 46d9ee79f292
line wrap: on
line source

#ifndef SQUAT_TRIE_H
#define SQUAT_TRIE_H

enum file_lock_method;

#include "seq-range-array.h"

struct squat_trie *
squat_trie_open(const char *path, uint32_t uidvalidity,
		enum file_lock_method lock_method, bool mmap_disable);
void squat_trie_close(struct squat_trie *trie);

int squat_trie_get_last_uid(struct squat_trie *trie, uint32_t *last_uid_r);

int squat_trie_lock(struct squat_trie *trie, int lock_type);
void squat_trie_unlock(struct squat_trie *trie);

struct squat_trie_build_context *
squat_trie_build_init(struct squat_trie *trie, uint32_t *last_uid_r);
int squat_trie_build_more(struct squat_trie_build_context *ctx, uint32_t uid,
			  const unsigned char *data, size_t size);
int squat_trie_build_deinit(struct squat_trie_build_context *ctx);

int squat_trie_compress(struct squat_trie *trie,
			const ARRAY_TYPE(seq_range) *existing_uids);

int squat_trie_mark_having_expunges(struct squat_trie *trie,
				    const ARRAY_TYPE(seq_range) *existing_uids,
				    unsigned int current_message_count);

int squat_trie_lookup(struct squat_trie *trie, ARRAY_TYPE(seq_range) *result,
		      const char *str);
int squat_trie_filter(struct squat_trie *trie, ARRAY_TYPE(seq_range) *result,
		      const char *str);

size_t squat_trie_mem_used(struct squat_trie *trie, unsigned int *count_r);

struct squat_uidlist *_squat_trie_get_uidlist(struct squat_trie *trie);

void _squat_trie_pack_num(buffer_t *buffer, uint32_t num);
uint32_t _squat_trie_unpack_num(const uint8_t **p, const uint8_t *end);

void squat_trie_set_corrupted(struct squat_trie *trie, const char *reason);

#endif