null+****@clear*****
null+****@clear*****
2012年 4月 4日 (水) 09:53:41 JST
Susumu Yata 2012-04-04 09:53:41 +0900 (Wed, 04 Apr 2012)
New Revision: 01b0ee3a6a969bdf19f1ed17bc1d661729bd4714
Log:
Add comments about grn_array and grn_hash.
Modified files:
lib/hash.c
lib/hash.h
Modified: lib/hash.c (+6 -0)
===================================================================
--- lib/hash.c 2012-04-04 09:48:19 +0900 (724d9f6)
+++ lib/hash.c 2012-04-04 09:53:41 +0900 (da6afb0)
@@ -252,6 +252,7 @@ grn_io_array_bit_flip(grn_ctx *ctx, grn_io *io,
#define GRN_ARRAY_HEADER_SIZE 0x9000
#define GRN_ARRAY_SEGMENT_SIZE 0x400000
+/* Header of grn_io-based grn_array. */
struct grn_array_header {
uint32_t flags;
uint32_t curr_rec;
@@ -263,6 +264,11 @@ struct grn_array_header {
uint32_t reserved[5];
};
+/*
+ * A grn_io-based grn_array consists of the following 2 segments.
+ * GRN_ARRAY_VALUE_SEGMENT: stores values.
+ * GRN_ARRAY_BITMAP_SEGMENT: stores whether entries are valid or not.
+ */
enum {
GRN_ARRAY_VALUE_SEGMENT = 0,
GRN_ARRAY_BITMAP_SEGMENT = 1
Modified: lib/hash.h (+7 -4)
===================================================================
--- lib/hash.h 2012-04-04 09:48:19 +0900 (9c7eae0)
+++ lib/hash.h 2012-04-04 09:53:41 +0900 (36f2a09)
@@ -116,12 +116,12 @@ struct _grn_array {
uint32_t *n_garbages;
uint32_t *n_entries;
- /* For io_array. */
+ /* For grn_io_array. */
grn_io *io;
struct grn_array_header *header;
uint32_t *lock;
- /* For tiny_array. */
+ /* For grn_tiny_array. */
uint32_t n_garbages_buf;
uint32_t n_entries_buf;
grn_id garbages;
@@ -161,7 +161,8 @@ struct _grn_hash {
uint32_t *n_entries;
uint32_t *max_offset;
grn_obj *tokenizer;
- /* portions for io_hash */
+
+ /* For grn_io_hash. */
grn_io *io;
struct grn_hash_header *header;
uint32_t *lock;
@@ -177,7 +178,8 @@ struct _grn_hash {
// int limit;
// void *userdata;
// grn_id subrec_id;
- /* portions for tiny_hash */
+
+ /* For grn_tiny_hash. */
uint32_t max_offset_;
uint32_t n_garbages_;
uint32_t n_entries_;
@@ -187,6 +189,7 @@ struct _grn_hash {
grn_tiny_array bitmap;
};
+/* Header of grn_io_hash. */
struct grn_hash_header {
uint32_t flags;
grn_encoding encoding;