示例#1
0
static tdb_error store_info(const char *path,
                            uint64_t num_trails,
                            uint64_t num_events,
                            uint64_t min_timestamp,
                            uint64_t max_timestamp,
                            uint64_t max_timedelta)
{
    FILE *out = NULL;
    int ret = 0;
    /*
    NOTE - this file shouldn't grow to be more than 512
    bytes, so it occupies a constant amount of space in a
    tar package.
    */
    TDB_OPEN(out, path, "w");
    TDB_FPRINTF(out,
                "%"PRIu64" %"PRIu64" %"PRIu64" %"PRIu64" %"PRIu64"\n",
                num_trails,
                num_events,
                min_timestamp,
                max_timestamp,
                max_timedelta);
done:
    TDB_CLOSE_FINAL(out);
    return ret;
}
示例#2
0
static tdb_error store_lexicons(tdb_cons *cons)
{
    tdb_field i;
    FILE *out = NULL;
    char path[TDB_MAX_PATH_SIZE];
    int ret = 0;

    TDB_PATH(path, "%s/fields", cons->root);
    TDB_OPEN(out, path, "w");

    for (i = 0; i < cons->num_ofields; i++){
        TDB_PATH(path, "%s/lexicon.%s", cons->root, cons->ofield_names[i]);
        if ((ret = lexicon_store(&cons->lexicons[i], path)))
            goto done;
        TDB_FPRINTF(out, "%s\n", cons->ofield_names[i]);
    }
    TDB_FPRINTF(out, "\n");
done:
    TDB_CLOSE_FINAL(out);
    return ret;
}
示例#3
0
static tdb_error store_version(tdb_cons *cons)
{
    FILE *out = NULL;
    char path[TDB_MAX_PATH_SIZE];
    int ret = 0;

    TDB_PATH(path, "%s/version", cons->root);
    TDB_OPEN(out, path, "w");
    TDB_FPRINTF(out, "%llu", TDB_VERSION_LATEST);
done:
    TDB_CLOSE_FINAL(out);
    return ret;
}