aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-partition-table.h
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2002-03-25 20:11:44 +0800
committerMichael Zucci <zucchi@src.gnome.org>2002-03-25 20:11:44 +0800
commitc6fc4e27a953c5213cff8400ec8e40f6f051e914 (patch)
tree7237e42f705cd584d36f3a2a4795a1bb16741dd3 /camel/camel-partition-table.h
parentede63cde5882af8696c22ed546506ad877b73011 (diff)
downloadgsoc2013-evolution-c6fc4e27a953c5213cff8400ec8e40f6f051e914.tar
gsoc2013-evolution-c6fc4e27a953c5213cff8400ec8e40f6f051e914.tar.gz
gsoc2013-evolution-c6fc4e27a953c5213cff8400ec8e40f6f051e914.tar.bz2
gsoc2013-evolution-c6fc4e27a953c5213cff8400ec8e40f6f051e914.tar.lz
gsoc2013-evolution-c6fc4e27a953c5213cff8400ec8e40f6f051e914.tar.xz
gsoc2013-evolution-c6fc4e27a953c5213cff8400ec8e40f6f051e914.tar.zst
gsoc2013-evolution-c6fc4e27a953c5213cff8400ec8e40f6f051e914.zip
When we add a new name, up all of the cache limits, because we're probably
2002-03-25 Not Zed <NotZed@Ximian.com> * camel-text-index.c (text_index_add_name): When we add a new name, up all of the cache limits, because we're probably going to be adding more. (text_index_sync): Drop the cache limits back down again, we dont need them when looking words up. ** MERGE camel_index branch. * camel-text-index.[ch]: Added files i forgot to add (eep nearly lost all this work!) * camel-block-file.c (sync_nolock): Fix an infinite loop in syncing. svn path=/trunk/; revision=16242
Diffstat (limited to 'camel/camel-partition-table.h')
-rw-r--r--camel/camel-partition-table.h150
1 files changed, 150 insertions, 0 deletions
diff --git a/camel/camel-partition-table.h b/camel/camel-partition-table.h
new file mode 100644
index 0000000000..ab6ac8c204
--- /dev/null
+++ b/camel/camel-partition-table.h
@@ -0,0 +1,150 @@
+/*
+ * Copyright (C) 2001 Ximian Inc.
+ *
+ * Authors: Michael Zucchi <notzed@ximian.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef _CAMEL_PARTITION_TABLE_H
+#define _CAMEL_PARTITION_TABLE_H
+
+#include <camel/camel-object.h>
+#include <glib.h>
+#include <e-util/e-msgport.h>
+
+#include "camel-block-file.h"
+
+/* ********************************************************************** */
+
+/* CamelPartitionTable - index of key to keyid */
+
+typedef guint32 camel_hash_t; /* a hashed key */
+
+typedef struct _CamelPartitionKey CamelPartitionKey;
+typedef struct _CamelPartitionKeyBlock CamelPartitionKeyBlock;
+typedef struct _CamelPartitionMap CamelPartitionMap;
+typedef struct _CamelPartitionMapBlock CamelPartitionMapBlock;
+
+typedef struct _CamelPartitionTable CamelPartitionTable;
+typedef struct _CamelPartitionTable CamelPartitionTableClass;
+
+struct _CamelPartitionKey {
+ camel_hash_t hashid;
+ camel_key_t keyid;
+};
+
+struct _CamelPartitionKeyBlock {
+ guint32 used;
+ struct _CamelPartitionKey keys[(CAMEL_BLOCK_SIZE-4)/sizeof(struct _CamelPartitionKey)];
+};
+
+struct _CamelPartitionMap {
+ camel_hash_t hashid;
+ camel_block_t blockid;
+};
+
+struct _CamelPartitionMapBlock {
+ camel_block_t next;
+ guint32 used;
+ struct _CamelPartitionMap partition[(CAMEL_BLOCK_SIZE-8)/sizeof(struct _CamelPartitionMap)];
+};
+
+struct _CamelPartitionTable {
+ CamelObject parent;
+
+ struct _CamelPartitionTablePrivate *priv;
+
+ CamelBlockFile *blocks;
+ camel_block_t rootid;
+
+ int (*is_key)(CamelPartitionTable *cpi, const char *key, camel_key_t keyid, void *data);
+ void *is_key_data;
+
+ /* we keep a list of partition blocks active at all times */
+ EDList partition;
+};
+
+struct _CamelPartitionTableClass {
+ CamelObjectClass parent;
+};
+
+CamelType camel_partition_table_get_type(void);
+
+CamelPartitionTable *camel_partition_table_new(struct _CamelBlockFile *bs, camel_block_t root);
+int camel_partition_table_add(CamelPartitionTable *cpi, const char *key, camel_key_t keyid);
+camel_key_t camel_partition_table_lookup(CamelPartitionTable *cpi, const char *key);
+void camel_partition_table_remove(CamelPartitionTable *cpi, const char *key);
+
+/* ********************************************************************** */
+
+/* CamelKeyTable - index of keyid to key and flag and data mapping */
+
+typedef struct _CamelKeyBlock CamelKeyBlock;
+typedef struct _CamelKeyRootBlock CamelKeyRootBlock;
+
+typedef struct _CamelKeyTable CamelKeyTable;
+typedef struct _CamelKeyTable CamelKeyTableClass;
+
+struct _CamelKeyRootBlock {
+ camel_block_t first;
+ camel_block_t last;
+ camel_key_t free; /* free list */
+};
+
+struct _CamelKeyKey {
+ camel_block_t data;
+ unsigned int offset:10;
+ unsigned int flags:22;
+};
+
+struct _CamelKeyBlock {
+ camel_block_t next;
+ guint32 used;
+ union {
+ struct _CamelKeyKey keys[(CAMEL_BLOCK_SIZE-8)/sizeof(struct _CamelKeyKey)];
+ char keydata[CAMEL_BLOCK_SIZE-8];
+ } u;
+};
+
+#define CAMEL_KEY_TABLE_MAX_KEY (128) /* max size of any key */
+
+struct _CamelKeyTable {
+ CamelObject parent;
+
+ struct _CamelKeyTablePrivate *priv;
+
+ CamelBlockFile *blocks;
+
+ camel_block_t rootid;
+
+ CamelKeyRootBlock *root;
+ CamelBlock *root_block;
+};
+
+struct _CamelKeyTableClass {
+ CamelObjectClass parent;
+};
+
+CamelType camel_key_table_get_type(void);
+
+CamelKeyTable * camel_key_table_new(CamelBlockFile *bs, camel_block_t root);
+camel_key_t camel_key_table_add(CamelKeyTable *ki, const char *key, camel_block_t data, unsigned int flags);
+void camel_key_table_set_data(CamelKeyTable *ki, camel_key_t keyid, camel_block_t data);
+void camel_key_table_set_flags(CamelKeyTable *ki, camel_key_t keyid, unsigned int flags, unsigned int set);
+camel_block_t camel_key_table_lookup(CamelKeyTable *ki, camel_key_t keyid, char **key, unsigned int *flags);
+camel_key_t camel_key_table_next(CamelKeyTable *ki, camel_key_t next, char **keyp, unsigned int *flagsp, camel_block_t *datap);
+
+#endif /* ! _CAMEL_PARTITION_TABLE_H */