1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159
|
/*
Copyright (C) 2016 Brazil
Copyright (C) 2019-2023 Sutou Kouhei <kou@clear-code.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "grn_ctx.h"
grn_rc
grn_dump_table_create_flags(grn_ctx *ctx,
grn_table_flags flags,
grn_obj *buffer)
{
GRN_API_ENTER;
switch (flags & GRN_OBJ_TABLE_TYPE_MASK) {
case GRN_OBJ_TABLE_HASH_KEY:
GRN_TEXT_PUTS(ctx, buffer, "TABLE_HASH_KEY");
break;
case GRN_OBJ_TABLE_PAT_KEY:
GRN_TEXT_PUTS(ctx, buffer, "TABLE_PAT_KEY");
break;
case GRN_OBJ_TABLE_DAT_KEY:
GRN_TEXT_PUTS(ctx, buffer, "TABLE_DAT_KEY");
break;
case GRN_OBJ_TABLE_NO_KEY:
GRN_TEXT_PUTS(ctx, buffer, "TABLE_NO_KEY");
break;
}
if (flags & GRN_OBJ_KEY_LARGE) {
GRN_TEXT_PUTS(ctx, buffer, "|KEY_LARGE");
}
if (flags & GRN_OBJ_KEY_WITH_SIS) {
GRN_TEXT_PUTS(ctx, buffer, "|KEY_WITH_SIS");
}
if (flags & GRN_OBJ_KEY_NORMALIZE) {
GRN_TEXT_PUTS(ctx, buffer, "|KEY_NORMALIZE");
}
if (flags & GRN_OBJ_PERSISTENT) {
GRN_TEXT_PUTS(ctx, buffer, "|PERSISTENT");
}
GRN_API_RETURN(ctx->rc);
}
grn_rc
grn_dump_column_create_flags(grn_ctx *ctx,
grn_column_flags flags,
grn_obj *buffer)
{
GRN_API_ENTER;
switch (flags & GRN_OBJ_COLUMN_TYPE_MASK) {
case GRN_OBJ_COLUMN_SCALAR:
GRN_TEXT_PUTS(ctx, buffer, "COLUMN_SCALAR");
break;
case GRN_OBJ_COLUMN_VECTOR:
GRN_TEXT_PUTS(ctx, buffer, "COLUMN_VECTOR");
if (flags & GRN_OBJ_WITH_WEIGHT) {
GRN_TEXT_PUTS(ctx, buffer, "|WITH_WEIGHT");
}
if (flags & GRN_OBJ_WEIGHT_FLOAT32) {
GRN_TEXT_PUTS(ctx, buffer, "|WEIGHT_FLOAT32");
}
if (flags & GRN_OBJ_WEIGHT_BFLOAT16) {
GRN_TEXT_PUTS(ctx, buffer, "|WEIGHT_BFLOAT16");
}
break;
case GRN_OBJ_COLUMN_INDEX:
GRN_TEXT_PUTS(ctx, buffer, "COLUMN_INDEX");
if (flags & GRN_OBJ_WITH_SECTION) {
GRN_TEXT_PUTS(ctx, buffer, "|WITH_SECTION");
}
if (flags & GRN_OBJ_WITH_WEIGHT) {
GRN_TEXT_PUTS(ctx, buffer, "|WITH_WEIGHT");
}
if (flags & GRN_OBJ_WITH_POSITION) {
GRN_TEXT_PUTS(ctx, buffer, "|WITH_POSITION");
}
if (flags & GRN_OBJ_INDEX_SMALL) {
GRN_TEXT_PUTS(ctx, buffer, "|INDEX_SMALL");
}
if (flags & GRN_OBJ_INDEX_MEDIUM) {
GRN_TEXT_PUTS(ctx, buffer, "|INDEX_MEDIUM");
}
if (flags & GRN_OBJ_INDEX_LARGE) {
GRN_TEXT_PUTS(ctx, buffer, "|INDEX_LARGE");
}
if (flags & GRN_OBJ_WEIGHT_FLOAT32) {
GRN_TEXT_PUTS(ctx, buffer, "|WEIGHT_FLOAT32");
}
if (flags & GRN_OBJ_WEIGHT_BFLOAT16) {
GRN_TEXT_PUTS(ctx, buffer, "|WEIGHT_BFLOAT16");
}
break;
}
switch (flags & GRN_OBJ_COMPRESS_MASK) {
case GRN_OBJ_COMPRESS_NONE:
break;
case GRN_OBJ_COMPRESS_ZLIB:
GRN_TEXT_PUTS(ctx, buffer, "|COMPRESS_ZLIB");
break;
case GRN_OBJ_COMPRESS_LZ4:
GRN_TEXT_PUTS(ctx, buffer, "|COMPRESS_LZ4");
break;
case GRN_OBJ_COMPRESS_ZSTD:
GRN_TEXT_PUTS(ctx, buffer, "|COMPRESS_ZSTD");
break;
}
switch (flags & GRN_OBJ_MISSING_MASK) {
case GRN_OBJ_MISSING_ADD:
break;
case GRN_OBJ_MISSING_IGNORE:
GRN_TEXT_PUTS(ctx, buffer, "|MISSING_IGNORE");
break;
case GRN_OBJ_MISSING_NIL:
GRN_TEXT_PUTS(ctx, buffer, "|MISSING_NIL");
break;
}
switch (flags & GRN_OBJ_INVALID_MASK) {
case GRN_OBJ_INVALID_ERROR:
break;
case GRN_OBJ_INVALID_WARN:
GRN_TEXT_PUTS(ctx, buffer, "|INVALID_WARN");
break;
case GRN_OBJ_INVALID_IGNORE:
GRN_TEXT_PUTS(ctx, buffer, "|INVALID_IGNORE");
break;
}
if (flags & GRN_OBJ_COMPRESS_FILTER_SHUFFLE) {
GRN_TEXT_PUTS(ctx, buffer, "|COMPRESS_FILTER_SHUFFLE");
}
if (flags & GRN_OBJ_COMPRESS_FILTER_BYTE_DELTA) {
GRN_TEXT_PUTS(ctx, buffer, "|COMPRESS_FILTER_BYTE_DELTA");
}
if (flags & GRN_OBJ_COMPRESS_FILTER_TRUNCATE_PRECISION_2BYTES) {
GRN_TEXT_PUTS(ctx, buffer, "|COMPRESS_FILTER_TRUNCATE_PRECISION_2BYTES");
} else if (flags & GRN_OBJ_COMPRESS_FILTER_TRUNCATE_PRECISION_1BYTE) {
GRN_TEXT_PUTS(ctx, buffer, "|COMPRESS_FILTER_TRUNCATE_PRECISION_1BYTE");
}
if (flags & GRN_OBJ_PERSISTENT) {
GRN_TEXT_PUTS(ctx, buffer, "|PERSISTENT");
}
GRN_API_RETURN(ctx->rc);
}
|