本文整理汇总了C++中sp_setint函数的典型用法代码示例。如果您正苦于以下问题:C++ sp_setint函数的具体用法?C++ sp_setint怎么用?C++ sp_setint使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sp_setint函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: compact_index
static void
compact_index(void)
{
void *env = sp_env();
t( env != NULL );
t( sp_setstring(env, "sophia.path", st_r.conf->sophia_dir, 0) == 0 );
t( sp_setint(env, "scheduler.threads", 0) == 0 );
t( sp_setstring(env, "log.path", st_r.conf->log_dir, 0) == 0 );
t( sp_setstring(env, "db", "test", 0) == 0 );
t( sp_setint(env, "db.test.compaction.branch_wm", 1) == 0 );
t( sp_setint(env, "db.test.compaction.compact_mode", 0) == 0 );
t( sp_setstring(env, "db.test.path", st_r.conf->db_dir, 0) == 0 );
t( sp_setstring(env, "db.test.scheme", "key", 0) == 0 );
t( sp_setstring(env, "db.test.scheme.key", "u32,key(0)", 0) == 0 );
t( sp_setstring(env, "db.test.scheme", "value", 0) == 0 );
t( sp_setint(env, "db.test.sync", 0) == 0 );
void *db = sp_getobject(env, "db.test");
t( db != NULL );
t( sp_open(env) == 0 );
int key = 0;
while (key < 20) {
void *o = sp_document(db);
t( o != NULL );
t( sp_setstring(o, "key", &key, sizeof(key)) == 0 );
t( sp_setstring(o, "value", &key, sizeof(key)) == 0 );
t( sp_set(db, o) == 0 );
key++;
}
t( sp_setint(env, "db.test.compaction.compact_index", 0) == 0 );
key = 0;
while (key < 20) {
void *o = sp_document(db);
t( o != NULL );
t( sp_setstring(o, "key", &key, sizeof(key)) == 0 );
o = sp_get(db, o);
t( o != NULL );
sp_destroy(o);
key++;
}
t( sp_destroy(env) == 0 );
}
开发者ID:ConfusedReality,项目名称:sophia,代码行数:44,代码来源:compact.test.c
示例2: github_97
static void
github_97(void)
{
void *env = sp_env();
t( env != NULL );
t( sp_setstring(env, "sophia.path", st_r.conf->sophia_dir, 0) == 0 );
t( sp_setint(env, "scheduler.threads", 0) == 0 );
t( sp_setint(env, "compaction.0.branch_wm", 1) == 0 );
t( sp_setstring(env, "log.path", st_r.conf->log_dir, 0) == 0 );
t( sp_setstring(env, "db", "test", 0) == 0 );
t( sp_setstring(env, "db.test.path", st_r.conf->db_dir, 0) == 0 );
t( sp_setstring(env, "db.test.index.key", "u32", 0) == 0 );
t( sp_setint(env, "db.test.sync", 0) == 0 );
t( sp_open(env) == 0 );
void *db = sp_getobject(env, "db.test");
t( db != NULL );
/* we must pass sizeof(uint32_t) in sp_setstring() */
uint32_t i = 0;
while ( i < 100 ) {
void *o = sp_document(db);
t( sp_setstring(o, "key", &i, sizeof(i)) == 0 ); /* < */
t( sp_setstring(o, "value", &i, sizeof(i)) == 0 ); /* < */
t( sp_set(db, o) == 0 );
i++;
}
void *cur = sp_cursor(env);
t( cur != NULL );
void *o = sp_document(db);
t( o != NULL );
uint32_t key = 99;
t( sp_setstring(o, "key", &key, sizeof(key)) == 0 ); /* < */
i = 0;
while ((o = sp_get(cur, o)))
i++;
t( i == 1 );
sp_destroy(cur);
t( sp_destroy(env) == 0 );
}
开发者ID:EgoIncarnate,项目名称:sophia,代码行数:43,代码来源:github.test.c
示例3: leak_tx_tx_set_rollback
static void
leak_tx_tx_set_rollback(void)
{
void *env = sp_env();
t( env != NULL );
t( sp_setstring(env, "sophia.path", st_r.conf->sophia_dir, 0) == 0 );
t( sp_setint(env, "scheduler.threads", 0) == 0 );
t( sp_setint(env, "compaction.0.branch_wm", 1) == 0 );
t( sp_setstring(env, "log.path", st_r.conf->log_dir, 0) == 0 );
t( sp_setstring(env, "db", "test", 0) == 0 );
t( sp_setstring(env, "db.test.path", st_r.conf->db_dir, 0) == 0 );
t( sp_setstring(env, "db.test.index.key", "u32", 0) == 0 );
t( sp_setint(env, "db.test.sync", 0) == 0 );
void *db = sp_getobject(env, "db.test");
t( db != NULL );
t( sp_open(env) == 0 );
void *a = sp_begin(env);
t( a != NULL );
void *b = sp_begin(env);
t( b != NULL );
int key = 123;
void *o = sp_document(db);
t( sp_setstring(o, "key", &key, sizeof(key)) == 0 );
t( sp_set(b, o) == 0 );
key = 124;
o = sp_document(db);
t( sp_setstring(o, "key", &key, sizeof(key)) == 0 );
t( sp_set(b, o) == 0 );
t( sp_getint(env, "performance.documents") == 2 );
t( sp_destroy(b) == 0 );
t( sp_getint(env, "performance.documents") == 0 );
t( sp_commit(a) == 0 );
t( sp_getint(env, "performance.documents") == 0 );
t( sp_destroy(env) == 0 );
}
开发者ID:ifzz,项目名称:sophia,代码行数:43,代码来源:leak.test.c
示例4: conf_validation_upsert
static void
conf_validation_upsert(void)
{
void *env = sp_env();
t( env != NULL );
t( sp_setint(env, "scheduler.threads", 0) == 0 );
t( sp_setint(env, "log.enable", 0) == 0 );
t( sp_setstring(env, "sophia.path", st_r.conf->sophia_dir, 0) == 0 );
t( sp_setint(env, "log.sync", 0) == 0 );
t( sp_setint(env, "log.rotate_sync", 0) == 0 );
t( sp_setstring(env, "db", "test", 0) == 0 );
void *db = sp_getobject(env, "db.test");
t( db != NULL );
t( sp_setint(env, "db.test.sync", 0) == 0 );
t( sp_setstring(env, "db.test.index.upsert", conf_validation_upsert_op, 0) == 0 );
t( sp_setstring(env, "db.test.format", "document", 0) == 0 );
t( sp_open(env) == -1 );
t( sp_destroy(env) == 0 );
}
开发者ID:EgoIncarnate,项目名称:sophia,代码行数:19,代码来源:conf.test.c
示例5: conf_validation1
static void
conf_validation1(void)
{
void *env = sp_env();
t( env != NULL );
t( sp_setint(env, "scheduler.threads", 0) == 0 );
t( sp_setstring(env, "scheduler.threads", NULL, 0) == -1 );
t( sp_getobject(env, "scheduler.threads") == NULL );
t( sp_setint(env, "log.enable", 0) == 0 );
t( sp_setstring(env, "log.enable", NULL, 0) == -1 );
t( sp_getobject(env, "log.enable") == NULL );
t( sp_setstring(env, "scheduler.run", NULL, 0) == 0 );
t( sp_getobject(env, "scheduler.run") == NULL );
t( sp_destroy(env) == 0 );
}
开发者ID:EgoIncarnate,项目名称:sophia,代码行数:19,代码来源:conf.test.c
示例6: object_lsn0
static void
object_lsn0(void)
{
void *env = sp_env();
t( env != NULL );
t( sp_setstring(env, "sophia.path", st_r.conf->sophia_dir, 0) == 0 );
t( sp_setint(env, "scheduler.threads", 0) == 0 );
t( sp_setstring(env, "log.path", st_r.conf->log_dir, 0) == 0 );
t( sp_open(env) == 0 );
t( sp_setstring(env, "db", "test", 0) == 0 );
t( sp_setstring(env, "db.test.path", st_r.conf->db_dir, 0) == 0 );
t( sp_setstring(env, "db.test.index.key", "u32", 0) == 0 );
t( sp_setint(env, "db.test.sync", 0) == 0 );
void *db = sp_getobject(env, "db.test");
t( db != NULL );
t( sp_open(db) == 0 );
int key = 7;
void *o = sp_object(db);
t(o != NULL);
t( sp_setstring(o, "key", &key, sizeof(key)) == 0 );
t( sp_setstring(o, "value", &key, sizeof(key)) == 0 );
t( sp_getint(o, "lsn") == -1 );
t( sp_set(db, o) == 0 );
o = sp_object(db);
t(o != NULL);
t( sp_setstring(o, "order", ">", 0) == 0 );
void *c = sp_cursor(db, o);
o = sp_get(c, NULL);
t( o != NULL );
int size = 0;
t( *(int*)sp_getstring(o, "key", &size) == key );
t( size == sizeof(key) );
t( *(int*)sp_getstring(o, "value", &size) == key );
t( size == sizeof(key) );
t( sp_getint(o, "lsn") > 0 );
t( sp_destroy(o) == 0 );
o = sp_get(c, NULL);
t( o == NULL );
sp_destroy(c);
sp_destroy(env);
}
开发者ID:mneumann,项目名称:sophia,代码行数:43,代码来源:object.test.c
示例7: meta_error_injection
static void
meta_error_injection(void)
{
void *env = sp_env();
t( env != NULL );
t( sp_getint(env, "debug.error_injection.si_branch_0") == 0 );
t( sp_setint(env, "debug.error_injection.si_branch_0", 1) == 0 );
t( sp_getint(env, "debug.error_injection.si_branch_0") == 1 );
t( sp_destroy(env) == 0 );
}
开发者ID:Wanderfalke,项目名称:sophia,代码行数:10,代码来源:meta.test.c
示例8: ddl_create_online1
static void
ddl_create_online1(void)
{
void *env = sp_env();
t( env != NULL );
t( sp_setstring(env, "sophia.path", st_r.conf->sophia_dir, 0) == 0 );
t( sp_setint(env, "scheduler.threads", 0) == 0 );
t( sp_setstring(env, "log.path", st_r.conf->log_dir, 0) == 0 );
t( sp_open(env) == 0 );
t( sp_setstring(env, "db", "test", 0) == 0 );
t( sp_setstring(env, "db.test.path", st_r.conf->db_dir, 0) == 0 );
t( sp_setstring(env, "db.test.index.key", "u32", 0) == 0 );
t( sp_setint(env, "db.test.sync", 0) == 0 );
void *db = sp_getobject(env, "db.test");
t( db != NULL );
t( sp_open(db) == 0 );
t( sp_destroy(db) == 0 );
t( sp_destroy(env) == 0 );
}
开发者ID:egmkang,项目名称:green_turtle,代码行数:19,代码来源:ddl.test.c
示例9: cache_test0
static void
cache_test0(void)
{
void *env = sp_env();
t( env != NULL );
t( sp_setstring(env, "sophia.path", st_r.conf->sophia_dir, 0) == 0 );
t( sp_setstring(env, "db", "test", 0) == 0 );
t( sp_setstring(env, "db.test.index.key", "u32",0) == 0 );
t( sp_setint(env, "db.test.sync", 0) == 0 );
t( sp_setint(env, "scheduler.threads", 0) == 0 );
t( sp_setint(env, "compaction.0.branch_wm", 1) == 0 );
t( sp_open(env) == 0 );
void *db = sp_getobject(env, "db.test");
t( db != NULL );
int i = 0;
while (i < 185) {
void *o = sp_object(db);
t( o != NULL );
t( sp_setstring(o, "key", &i, sizeof(i)) == 0 );
t( sp_setstring(o, "value", &i, sizeof(i)) == 0 );
t( sp_set(db, o) == 0 );
i++;
}
t( sp_setint(env, "db.test.branch", 0) == 0 );
void *cur = sp_cursor(env);
i = 0;
t( cur != NULL );
void *o = sp_object(db);
while ((o = sp_get(cur, o))) {
t( *(int*)sp_getstring(o, "key", 0) == i );
i++;
}
t( i == 185 );
t( sp_destroy(cur) == 0 );
t( sp_getint(env, "db.test.index.read_disk") == 1 );
t( sp_getint(env, "db.test.index.read_cache") == 184 );
t( sp_destroy(env) == 0 );
}
开发者ID:egmkang,项目名称:green_turtle,代码行数:43,代码来源:cache.test.c
示例10: repository_test3
static void
repository_test3(void)
{
rmrf("./sophia");
rmrf("./logdir");
rmrf("./dir");
void *env = sp_env();
t( env != NULL );
t( sp_setstring(env, "sophia.path", "sophia", 0) == 0 );
t( sp_setint(env, "scheduler.threads", 0) == 0 );
t( sp_setstring(env, "db", "test", 0) == 0 );
t( sp_setstring(env, "db.test.path", "dir", 0) == 0 );
t( sp_setint(env, "db.test.sync", 0) == 0 );
t( sp_open(env) == 0 );
t( exists("sophia", "log") == 1 );
t( exists("sophia", "test") == 0 );
t( exists("dir", "") == 1 );
t( sp_destroy(env) == 0 );
}
开发者ID:mneumann,项目名称:sophia,代码行数:19,代码来源:repository.test.c
示例11: compact_delete1
static void
compact_delete1(void)
{
void *env = sp_env();
t( env != NULL );
t( sp_setstring(env, "sophia.path", st_r.conf->sophia_dir, 0) == 0 );
t( sp_setint(env, "scheduler.threads", 0) == 0 );
t( sp_setint(env, "compaction.0.branch_wm", 1) == 0 );
t( sp_setstring(env, "log.path", st_r.conf->log_dir, 0) == 0 );
t( sp_setstring(env, "db", "test", 0) == 0 );
t( sp_setstring(env, "db.test.path", st_r.conf->db_dir, 0) == 0 );
t( sp_setstring(env, "db.test.scheme", "key", 0) == 0 );
t( sp_setstring(env, "db.test.scheme.key", "u32,key", 0) == 0 );
t( sp_setstring(env, "db.test.scheme", "value", 0) == 0 );
t( sp_setint(env, "db.test.sync", 0) == 0 );
void *db = sp_getobject(env, "db.test");
t( db != NULL );
t( sp_open(env) == 0 );
int key = 0;
while (key < 20) {
void *o = sp_document(db);
t( o != NULL );
t( sp_setstring(o, "key", &key, sizeof(key)) == 0 );
t( sp_setstring(o, "value", &key, sizeof(key)) == 0 );
t( sp_set(db, o) == 0 );
key++;
}
t( sp_setint(env, "db.test.branch", 0) == 0 );
t( sp_setint(env, "db.test.compact", 0) == 0 );
key = 0;
while (key < 20) {
void *o = sp_document(db);
t( o != NULL );
t( sp_setstring(o, "key", &key, sizeof(key)) == 0 );
t( sp_delete(db, o) == 0 );
key++;
}
t( sp_setint(env, "db.test.branch", 0) == 0 );
t( sp_setint(env, "db.test.compact", 0) == 0 );
void *o = sp_document(db);
t( o != NULL );
void *cur = sp_cursor(env);
t( o != NULL );
int i = 0;
while ((o = sp_get(cur, o))) {
t( *(int*)sp_getstring(o, "key", NULL) == i );
i++;
}
t( i == 0 );
t( sp_destroy(env) == 0 );
}
开发者ID:mladinox,项目名称:sophia,代码行数:57,代码来源:compact_delete.test.c
示例12: scheme_timestamp1
static void
scheme_timestamp1(void)
{
void *env = sp_env();
t( env != NULL );
t( sp_setstring(env, "sophia.path", st_r.conf->sophia_dir, 0) == 0 );
t( sp_setint(env, "scheduler.threads", 0) == 0 );
t( sp_setstring(env, "log.path", st_r.conf->log_dir, 0) == 0 );
t( sp_setstring(env, "db", "test", 0) == 0 );
t( sp_setstring(env, "db.test.path", st_r.conf->db_dir, 0) == 0 );
t( sp_setstring(env, "db.test.scheme", "key", 0) == 0 );
t( sp_setstring(env, "db.test.scheme.key", "u32,key(0)", 0) == 0 );
t( sp_setstring(env, "db.test.scheme", "ts0", 0) == 0 );
t( sp_setstring(env, "db.test.scheme.ts0", "u32,timestamp", 0) == 0 );
t( sp_setstring(env, "db.test.scheme", "ts1", 0) == 0 );
t( sp_setstring(env, "db.test.scheme.ts1", "u32,timestamp", 0) == 0 );
t( sp_setint(env, "db.test.sync", 0) == 0 );
void *db = sp_getobject(env, "db.test");
t( db != NULL );
t( sp_open(env) == 0 );
uint32_t key = 0;
while (key < 10) {
void *o = sp_document(db);
t( sp_setstring(o, "key", &key, sizeof(key)) == 0 );
t( sp_set(db, o) == 0 );
key++;
}
key = 0;
void *o = sp_document(db);
sp_setstring(o, "order", ">=", 0);
void *c = sp_cursor(env);
while ((o = sp_get(c, o))) {
t( *(uint32_t*)sp_getstring(o, "key", NULL) == key );
t( *(uint32_t*)sp_getstring(o, "ts0", NULL) > 0 );
t( *(uint32_t*)sp_getstring(o, "ts1", NULL) > 0 );
key++;
}
t( sp_destroy(env) == 0 );
}
开发者ID:muthhus,项目名称:sophia,代码行数:42,代码来源:scheme.test.c
示例13: mt_upsert0
static void
mt_upsert0(void)
{
void *env = sp_env();
t( env != NULL );
t( sp_setstring(env, "sophia.path", st_r.conf->sophia_dir, 0) == 0 );
t( sp_setint(env, "scheduler.threads", 5) == 0 );
t( sp_setstring(env, "log.path", st_r.conf->log_dir, 0) == 0 );
t( sp_open(env) == 0 );
t( sp_setstring(env, "db", "test", 0) == 0 );
t( sp_setstring(env, "db.test.index.upsert", upsert_op, 0) == 0 );
t( sp_setstring(env, "db.test.path", st_r.conf->db_dir, 0) == 0 );
t( sp_setstring(env, "db.test.index.key", "u32", 0) == 0 );
t( sp_setint(env, "db.test.sync", 0) == 0 );
void *db = sp_getobject(env, "db.test");
t( db != NULL );
t( sp_open(db) == 0 );
uint32_t n = 400000;
uint32_t i, k = 1234;
uint32_t value = 1;
for (i = 0; i < n; i++) {
void *o = sp_document(db);
t( o != NULL );
t( sp_setstring(o, "key", &k, sizeof(k)) == 0 );
t( sp_setstring(o, "value", &value, sizeof(value)) == 0 );
t( sp_upsert(db, o) == 0 );
print_current(i);
}
void *o = sp_document(db);
t( o != NULL );
t( sp_setstring(o, "key", &k, sizeof(k)) == 0 );
void *c = sp_cursor(env);
t( c != NULL );
o = sp_get(c, o);
t( o != NULL );
t( *(uint32_t*)sp_getstring(o, "value", NULL) == n);
sp_destroy(o);
sp_destroy(c);
t( sp_destroy(env) == 0 );
}
开发者ID:mknight-tag,项目名称:sophia,代码行数:42,代码来源:multithread_upsert.test.c
示例14: repository_test0
static void
repository_test0(void)
{
void *env = sp_env();
t( env != NULL );
t( sp_setstring(env, "sophia.path", st_r.conf->sophia_dir, 0) == 0 );
t( sp_setint(env, "scheduler.threads", 0) == 0 );
t( sp_open(env) == 0 );
t( exists(st_r.conf->sophia_dir, "log") == 1 );
t( sp_destroy(env) == 0 );
}
开发者ID:Alexey-Ivanensky,项目名称:sophia,代码行数:11,代码来源:repository.test.c
示例15: multipart_cmp_eq_key
static void
multipart_cmp_eq_key(void)
{
void *env = sp_env();
t( env != NULL );
t( sp_setstring(env, "sophia.path", st_r.conf->sophia_dir, 0) == 0 );
t( sp_setint(env, "scheduler.threads", 0) == 0 );
t( sp_setstring(env, "log.path", st_r.conf->log_dir, 0) == 0 );
t( sp_setstring(env, "db", "test", 0) == 0 );
t( sp_setstring(env, "db.test.path", st_r.conf->db_dir, 0) == 0 );
t( sp_setstring(env, "db.test.index.key", "u32", 0) == 0 );
t( sp_setint(env, "db.test.sync", 0) == 0 );
char *v = sp_getstring(env, "db.test.index.key", 0);
t( strcmp(v, "u32") == 0 );
free(v);
t( sp_open(env) == 0 );
t( sp_destroy(env) == 0 );
}
开发者ID:egmkang,项目名称:green_turtle,代码行数:20,代码来源:multipart.test.c
示例16: scheme_test2
static void
scheme_test2(void)
{
void *env = sp_env();
t( env != NULL );
t( sp_setstring(env, "sophia.path", st_r.conf->sophia_dir, 0) == 0 );
t( sp_setint(env, "scheduler.threads", 0) == 0 );
t( sp_setstring(env, "log.path", st_r.conf->log_dir, 0) == 0 );
t( sp_setstring(env, "db", "test", 0) == 0 );
t( sp_setstring(env, "db.test.path", st_r.conf->db_dir, 0) == 0 );
t( sp_setstring(env, "db.test.scheme", "key", 0) == 0 );
t( sp_setstring(env, "db.test.scheme.key", "u16,key(0)", 0) == 0 );
t( sp_setstring(env, "db.test.scheme", "key_b", 0) == 0 );
t( sp_setstring(env, "db.test.scheme.key_b", "u8,key(1)", 0) == 0 );
t( sp_setint(env, "db.test.sync", 0) == 0 );
void *db = sp_getobject(env, "db.test");
t( db != NULL );
t( sp_open(env) == 0 );
t( sp_destroy(env) == 0 );
}
开发者ID:muthhus,项目名称:sophia,代码行数:20,代码来源:scheme.test.c
示例17: shutdown_transaction6
static void
shutdown_transaction6(void)
{
void *env = sp_env();
t( env != NULL );
t( sp_setstring(env, "sophia.path", st_r.conf->sophia_dir, 0) == 0 );
t( sp_setint(env, "scheduler.threads", 0) == 0 );
t( sp_setstring(env, "log.path", st_r.conf->log_dir, 0) == 0 );
t( sp_open(env) == 0 );
t( sp_setstring(env, "db", "test", 0) == 0 );
t( sp_setstring(env, "db.test.path", st_r.conf->db_dir, 0) == 0 );
t( sp_setstring(env, "db.test.index.key", "u32", 0) == 0 );
void *db = sp_getobject(env, "db.test");
t( db != NULL );
t( sp_setint(env, "db.test.sync", 0) == 0 );
t( sp_open(db) == 0 );
void *a = sp_begin(env);
t( a != NULL );
sp_destroy(db); /* unref */
sp_destroy(db); /* schedule shutdown, unlink */
void *o = sp_object(db);
t( o != NULL );
uint32_t key = 7;
t( sp_setstring(o, "key", &key, sizeof(key)) == 0 );
t( sp_setstring(o, "value", &key, sizeof(key)) == 0 );
t( sp_set(a, o) == 0 ); /* ok */
key = 8;
o = sp_object(db);
t( sp_setstring(o, "key", &key, sizeof(key)) == 0 );
t( sp_set(db, o) == -1 );
t( sp_setint(env, "scheduler.run", 0) == 0 );
t( sp_destroy(a) == 0 );
t( sp_setint(env, "scheduler.run", 0) == 1 );
t( sp_destroy(env) == 0 );
}
开发者ID:egmkang,项目名称:green_turtle,代码行数:41,代码来源:shutdown.test.c
示例18: amqf_test3
static void
amqf_test3(void)
{
void *env = sp_env();
t( env != NULL );
t( sp_setstring(env, "sophia.path", st_r.conf->sophia_dir, 0) == 0 );
t( sp_setstring(env, "db", "test", 0) == 0 );
t( sp_setstring(env, "db.test.scheme", "key", 0) == 0 );
t( sp_setstring(env, "db.test.scheme.key", "u32,key",0) == 0 );
t( sp_setstring(env, "db.test.scheme", "value", 0) == 0 );
t( sp_setint(env, "db.test.sync", 0) == 0 );
t( sp_setint(env, "db.test.amqf", 1) == 0 );
t( sp_setint(env, "scheduler.threads", 0) == 0 );
t( sp_setint(env, "compaction.0.branch_wm", 1) == 0 );
t( sp_open(env) == 0 );
void *db = sp_getobject(env, "db.test");
t( db != NULL );
int i = 0;
while (i < 100) {
void *o = sp_document(db);
t( o != NULL );
t( sp_setstring(o, "key", &i, sizeof(i)) == 0 );
t( sp_setstring(o, "value", &i, sizeof(i)) == 0 );
t( sp_set(db, o) == 0 );
i++;
}
t( sp_setint(env, "db.test.branch", 0) == 0 );
i = 300;
while (i < 500) {
void *o = sp_document(db);
t( o != NULL );
t( sp_setstring(o, "key", &i, sizeof(i)) == 0 );
t( sp_setstring(o, "value", &i, sizeof(i)) == 0 );
t( sp_set(db, o) == 0 );
i++;
}
t( sp_setint(env, "db.test.branch", 0) == 0 );
t( sp_setint(env, "db.test.compact", 0) == 0 );
i = 0;
while (i < 400) {
void *o = sp_document(db);
t( o != NULL );
t( sp_setstring(o, "key", &i, sizeof(i)) == 0 );
o = sp_get(db, o);
if (o) {
sp_destroy(o);
}
i++;
}
t( sp_getint(env, "db.test.index.read_disk") == 232 );
t( sp_destroy(env) == 0 );
}
开发者ID:mladinox,项目名称:sophia,代码行数:56,代码来源:amqf.test.c
示例19: mt_quota
static void
mt_quota(void)
{
void *env = sp_env();
t( env != NULL );
t( sp_setstring(env, "sophia.path", st_r.conf->sophia_dir, 0) == 0 );
t( sp_setint(env, "memory.limit", 524288) == 0 ); /* 512k */
/* branch_wm should hit compaction.e zone */
t( sp_setint(env, "compaction.80.mode", 3) == 0 );
t( sp_setint(env, "compaction.80.branch_wm", 500000) == 0 );
t( sp_setint(env, "compaction.80.branch_prio", 3) == 0 );
t( sp_setint(env, "compaction.80.branch_age", 100) == 0 );
t( sp_setint(env, "compaction.80.branch_age_period", 1) == 0 );
t( sp_setint(env, "scheduler.threads", 5) == 0 );
t( sp_setstring(env, "log.path", st_r.conf->log_dir, 0) == 0 );
t( sp_setint(env, "log.rotate_sync", 0) == 0 );
t( sp_setint(env, "log.sync", 0) == 0 );
t( sp_setstring(env, "db", "test", 0) == 0 );
t( sp_setstring(env, "db.test.path", st_r.conf->db_dir, 0) == 0 );
t( sp_setstring(env, "db.test.scheme", "key", 0) == 0 );
t( sp_setstring(env, "db.test.scheme.key", "u32,key", 0) == 0 );
t( sp_setstring(env, "db.test.scheme", "value", 0) == 0 );
t( sp_setint(env, "db.test.sync", 0) == 0 );
void *db = sp_getobject(env, "db.test");
t( db != NULL );
t( sp_open(env) == 0 );
char value[1000];
memset(value, 0, sizeof(value));
int i = 0;
while (i < 20000) { /* ~ 20Mb */
void *o = sp_document(db);
assert(o != NULL);
sp_setstring(o, "key", &i, sizeof(i));
sp_setstring(o, "value", value, sizeof(value));
int rc = sp_set(db, o);
t( rc == 0 );
i++;
}
t( sp_destroy(env) == 0 );
}
开发者ID:mladinox,项目名称:sophia,代码行数:41,代码来源:multithread.test.c
示例20: meta_compaction
static void
meta_compaction(void)
{
void *env = sp_env();
t( env != NULL );
t( sp_setint(env, "compaction", 58) == 0 );
t( sp_getint(env, "compaction.50.mode") == 0 );
char path[64];
int i = 10;
while (i < 100) {
t( sp_setint(env, "compaction", i) == 0 );
i += 10;
}
i = 10;
while (i < 100) {
snprintf(path, sizeof(path), "compaction.%d.branch_wm", i);
t( sp_getint(env, path) >= 0 );
i += 10;
}
t( sp_destroy(env) == 0 );
}
开发者ID:Wanderfalke,项目名称:sophia,代码行数:21,代码来源:meta.test.c
注:本文中的sp_setint函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论