示例#1
0
文件: bench.c 项目: haikusw/sparkey
static void sparkey_create(int n, sparkey_compression_type compression_type, int block_size) {
    sparkey_logwriter *mywriter;
    sparkey_assert(sparkey_logwriter_create(&mywriter, "test.spl", compression_type, block_size));
    for (int i = 0; i < n; i++) {
        char mykey[100];
        char myvalue[100];
        sprintf(mykey, "key_%d", i);
        sprintf(myvalue, "value_%d", i);
        sparkey_assert(sparkey_logwriter_put(mywriter, strlen(mykey), (uint8_t*)mykey, strlen(myvalue), (uint8_t*)myvalue));
    }
    sparkey_assert(sparkey_logwriter_close(&mywriter));
    sparkey_assert(sparkey_hash_write("test.spi", "test.spl", 0));
}
示例#2
0
文件: main.c 项目: nresare/sparkey
int writehash(const char *indexfile, const char *logfile) {
  assert(sparkey_hash_write(indexfile, logfile, 0));
  return 0;
}