• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ sp_open函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中sp_open函数的典型用法代码示例。如果您正苦于以下问题:C++ sp_open函数的具体用法?C++ sp_open怎么用?C++ sp_open使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了sp_open函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: mt_multi_stmt_conflict

static void
mt_multi_stmt_conflict(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", 3) == 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 );
	/* conflict source */
	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 );

	seworkerpool p;
	se_workerpool_init(&p);
	void *ptr[2] = { env, db };
	t( se_workerpool_new(&p, &st_r.r, 5, multi_stmt_conflict_thread, ptr) == 0 );
	t( se_workerpool_shutdown(&p, &st_r.r) == 0 );

	t( sp_destroy(env) == 0 );
}
开发者ID:egmkang,项目名称:green_turtle,代码行数:27,代码来源:multithread.test.c


示例2: github_123

static void
github_123(void)
{
	rmrf("./abc");
	rmrf("./abc_log");

	void *env = sp_env();
	t( env != NULL );

	char path[] = { '.', '/', 'a', 'b', 'c' };
	char path_log[] = { '.', '/', 'a', 'b', 'c', '_', 'l', 'o', 'g' };
	char name[] = { 't', 'e', 's', 't' };

	t( sp_setstring(env, "sophia.path", path, sizeof(path)) == 0 );
	t( sp_setstring(env, "db", name, sizeof(name)) == 0 );
	t( sp_setstring(env, "log.path", path_log, sizeof(path_log)) == 0 );
	t( sp_setstring(env, "view", name, sizeof(name)) == 0 );
	t( sp_open(env) == 0 );

	t( exists("./", "abc") == 1 );
	t( exists("./", "abc_log") == 1 );

	void *db = sp_getobject(env, "db.test");
	t( db != NULL );

	void *view = sp_getobject(env, "view.test");
	t( view != NULL );

	t( sp_destroy(env) == 0 );

	rmrf("./abc");
	rmrf("./abc_log");
}
开发者ID:leitao,项目名称:sophia,代码行数:33,代码来源:github.test.c


示例3: st_scene_open

void
st_scene_open(stscene *g, stc *cx)
{
    printf(".open");
    fflush(NULL);
    t( sp_open(cx->env) == 0 );
}
开发者ID:venkatarajasekhar,项目名称:bee,代码行数:7,代码来源:st_scene.c


示例4: meta_scheduler

static void
meta_scheduler(void)
{
	void *env = sp_env();
	t( env != NULL );

	t( sp_setint(env, "scheduler.threads", 2) == 0 );
	t( sp_setint(env, "log.enable", 0) == 0 );
	t( sp_setstring(env, "sophia.path", st_r.conf->sophia_dir, 0) == 0 );
	t( sp_getstring(env, "scheduler.0.trace", NULL) == NULL );
	t( sp_open(env) == 0 );

	char *v = sp_getstring(env, "scheduler.0.trace", NULL);
	t( v != NULL );
	t( strcmp(v, "malfunction") != 0 );
	free(v);

	v = sp_getstring(env, "scheduler.1.trace", NULL);
	t( v != NULL );
	t( strcmp(v, "malfunction") != 0 );
	free(v);

	v = sp_getstring(env, "scheduler.2.trace", NULL);
	t( v == NULL );

	t( sp_destroy(env) == 0 );
}
开发者ID:v09-software,项目名称:sophia,代码行数:27,代码来源:meta.test.c


示例5: github_118

static void
github_118(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_open(env) == 0 );
	void *db = sp_getobject(env, "db.test");
	t( db != NULL );

	unsigned key = 123456;

	void *o = sp_document(db);
	t( o != NULL );
	t( sp_setstring(o, "key", &key, sizeof(key)) == 0 );
	t( sp_set(db, o) == 0 );

	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);

	t( sp_getint(env, "db.test.index.count") == 1 );
	char *sz = sp_getstring(env, "db.test.index.temperature_histogram", NULL);
	t( strcmp(sz, "[0]:1-1 ") == 0 );
	free(sz);

	t( sp_destroy(db) == 0 );
	t( sp_destroy(env) == 0 );
}
开发者ID:leitao,项目名称:sophia,代码行数:35,代码来源:github.test.c


示例6: meta_db

static void
meta_db(void)
{
	void *env = sp_env();
	t( env != NULL );
	void *c = sp_ctl(env);
	t( c != NULL );
	t( sp_set(c, "sophia.path", cx->suite->sophiadir) == 0 );
	t( sp_set(c, "scheduler.threads", "0") == 0 );
	t( sp_set(c, "db", "test") == 0 );
	t( sp_set(c, "db.test.sync", "0") == 0 );
	t( sp_open(env) == 0 );

	void *db = sp_get(c, "db.test");
	t( db != NULL );

	void *dbctl = sp_ctl(db);
	t( dbctl != NULL );

	void *o = sp_get(dbctl, "name");
	t( o != NULL );
	t( strcmp(sp_get(o, "value", NULL), "test") == 0 );
	sp_destroy(o);

	o = sp_get(dbctl, "id");
	t( o != NULL );
	t( strcmp(sp_get(o, "value", NULL), "1") == 0 );
	sp_destroy(o);

	t( sp_destroy(env) == 0 );
}
开发者ID:v09-software,项目名称:sophia,代码行数:31,代码来源:meta.test.c


示例7: meta_cursor

static void
meta_cursor(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, "db", "test", 0) == 0 );
	t( sp_setstring(env, "db.test.index", "key_b", 0) == 0 );
	t( sp_setint(env, "db.test.sync", 0) == 0 );
	t( sp_open(env) == 0 );
	t( sp_setstring(env, "snapshot", "test_snapshot0", 0) == 0 );

	printf("\n");

	void *o;
	void *cur = sp_cursor(env, NULL);
	t( cur != NULL );
	printf("\n");
	while ((o = sp_get(cur, NULL))) {
		char *key = sp_getstring(o, "key", 0);
		char *value = sp_getstring(o, "value", 0);
		printf("%s", key);
		if (value)
			printf(" = %s\n", value);
		else
			printf(" = \n");
		sp_destroy(o);
	}
	t( sp_destroy(cur) == 0 );
	t( sp_destroy(env) == 0 );
}
开发者ID:v09-software,项目名称:sophia,代码行数:33,代码来源:meta.test.c


示例8: compact_temperature

static void
compact_temperature(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.temperature", 1) == 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.branch", 0) == 0 );
	t( sp_setint(env, "db.test.compaction.compact", 0) == 0 );

	t( sp_destroy(env) == 0 );
}
开发者ID:ConfusedReality,项目名称:sophia,代码行数:35,代码来源:compact.test.c


示例9: batch_set_commit

static void
batch_set_commit(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 );
	void *db = sp_getobject(env, "db.test");
	t( db != NULL );
	t( sp_open(env) == 0 );

	void *batch = sp_batch(db);
	t( batch != NULL );

	int key = 123;
	void *o = sp_object(db);
	t( sp_setstring(o, "key", &key, sizeof(key)) == 0 );
	t( sp_setstring(o, "value", &key, sizeof(key)) == 0 );
	t( sp_set(batch, o) == 0 );
	t( sp_commit(batch) == 0 );

	t( sp_destroy(env) == 0 );
}
开发者ID:Wanderfalke,项目名称:sophia,代码行数:28,代码来源:batch.test.c


示例10: snapshot_create_delete

static void
snapshot_create_delete(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 );
	void *db = sp_getobject(env, "db.test");
	t( db != NULL );
	t( sp_open(env) == 0 );

	t( sp_setstring(env, "snapshot", "test_snapshot", 0) == 0 );
	void *snapshot = sp_getobject(env, "snapshot.test_snapshot");
	t( snapshot != NULL );
	t( sp_destroy(snapshot) == 0 );
	snapshot = sp_getobject(env, "snapshot.test_snapshot");
	t( snapshot == NULL );

	t( sp_destroy(env) == 0 );
}
开发者ID:mneumann,项目名称:sophia,代码行数:25,代码来源:snapshot.test.c


示例11: ddl_constraint

static void
ddl_constraint(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_setint(env, "log.sync", 0) == 0 );
	t( sp_setint(env, "log.rotate_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-1", 0) == 0 );
	t( sp_setstring(env, "db.test.scheme", "key-2", 0) == 0 );
	t( sp_setstring(env, "db.test.scheme", "key-3", 0) == 0 );
	t( sp_setstring(env, "db.test.scheme", "key-4", 0) == 0 );
	t( sp_setstring(env, "db.test.scheme", "key-5", 0) == 0 );
	t( sp_setstring(env, "db.test.scheme", "key-6", 0) == 0 );
	t( sp_setstring(env, "db.test.scheme", "key-7", 0) == 0 );
	t( sp_setstring(env, "db.test.scheme", "key-8", 0) == 0 );
	t( sp_setstring(env, "db.test.scheme", "key-9", 0) == -1 );
	t( sp_setstring(env, "db.test.scheme.key-1", "u32,key(0)", 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:ConfusedReality,项目名称:sophia,代码行数:29,代码来源:ddl.test.c


示例12: mt_quota_checkpoint

static void
mt_quota_checkpoint(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 */
	/* use default settings */
	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.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 );

	char value[1000];
	memset(value, 0, sizeof(value));
	int i = 0;
	while (i < 20000) { /* ~ 20Mb */
		void *o = sp_object(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:egmkang,项目名称:green_turtle,代码行数:34,代码来源:multithread.test.c


示例13: mt_single_stmt

static void
mt_single_stmt(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", 3) == 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_setint(env, "db.test.sync", 0) == 0 );
	void *db = sp_getobject(env, "db.test");
	t( db != NULL );
	t( sp_open(env) == 0 );

	seworkerpool p;
	se_workerpool_init(&p);
	t( se_workerpool_new(&p, &st_r.r, 5, single_stmt_thread, db) == 0 );
	t( se_workerpool_shutdown(&p, &st_r.r) == 0 );

	t (sp_getint(env, "db.test.index.count") == 100000 );

	t( sp_destroy(env) == 0 );
}
开发者ID:egmkang,项目名称:green_turtle,代码行数:26,代码来源:multithread.test.c


示例14: multi_process_2

static void
multi_process_2(void) {
	void *env = sp_env();
	t( env != NULL );
	t( sp_ctl(env, SPDIR, SPO_CREAT|SPO_RDWR, dbrep1) == 0 );
	t( sp_ctl(env, SPCMP, cmp, NULL) == 0 );
	void *db = sp_open(env);
	t( db != NULL );
	void *env2 = sp_env();
	t( env != NULL );
	t( sp_ctl(env2, SPDIR, SPO_CREAT|SPO_RDWR, dbrep2) == 0 );
	t( sp_ctl(env2, SPCMP, cmp, NULL) == 0 );
	uint32_t k = 1;
	size_t vsize = 0;
	void *vp = NULL;
	int pid = fork();
	t( pid != -1 );
	if (pid == 0) {
		void *db2 = sp_open(env2);
		t( db2 != NULL );
		t( sp_set(db2, &k, sizeof(k), &k, sizeof(k)) == 0 );
		t( sp_get(db2, &k, sizeof(k), &vp, &vsize) == 1 );
		t( vsize == sizeof(k) );
		t( *(uint32_t*)vp == k );
		free(vp);
		t( sp_destroy(db2) == 0 );
		t( sp_destroy(env2) == 0 );
		t( rmrf(dbrep2) == 0 );
		/* valgrind: parent db and env are unfreed here, and that
		 *           is correct otherwise destroy would
		 *           corrupt the database.
		*/
		exit(0);
	}
	k = 3;
	t( sp_set(db, &k, sizeof(k), &k, sizeof(k)) == 0 );
	t( sp_get(db, &k, sizeof(k), &vp, &vsize) == 1 );
	t( vsize == sizeof(k) );
	t( *(uint32_t*)vp == k );
	free(vp);
	t( sp_destroy(db) == 0 );
	t( sp_destroy(env) == 0 );
	t( rmrf(dbrep1) == 0 );
	int status = 0;
	t( waitpid(pid, &status, 0) == pid );
	t( status == 0 );
}
开发者ID:FromPointer,项目名称:sophia,代码行数:47,代码来源:concurrent.c


示例15: compact_directio

static void
compact_directio(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_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 );
	t( sp_setint(env, "db.test.direct_io", 1) == 0 );
	t( sp_setint(env, "log.sync", 0) == 0 );
	t( sp_setint(env, "log.rotate_sync", 0) == 0 );
	void *db = sp_getobject(env, "db.test");
	t( db != NULL );
	t( sp_open(env) == 0 );

	char value[100];
	memset(value, 0, sizeof(value));

	int key = 0;
	while (key < 300000) {
		void *o = sp_document(db);
		t( o != NULL );
		t( sp_setstring(o, "key", &key, sizeof(key)) == 0 );
		t( sp_setstring(o, "value", value, sizeof(value)) == 0 );
		t( sp_set(db, o) == 0 );
		if ((key % 10000) == 0 && key > 0) {
			if (sp_setint(env, "db.test.compaction.branch", 0) == -1) {
				char *e = sp_getstring(env, "sophia.error", NULL);
				printf("%s, %d\n", (e) ? e: "null", errno);
				t( 0 );
			}
			/*t( sp_setint(env, "db.test.compaction.branch", 0) == 0 );*/
		}
		key++;
	}

	t( sp_setint(env, "db.test.compaction.compact", 0) == 0 );

	key = 0;
	while (key < 1000) {
		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 );
		t( *(int*)sp_getstring(o, "key", NULL) == key );
		sp_destroy(o);
		key++;
	}

	t( sp_destroy(env) == 0 );
}
开发者ID:ConfusedReality,项目名称:sophia,代码行数:59,代码来源:compact.test.c


示例16: single_process

static void
single_process(void) {
	void *env = sp_env();
	t( env != NULL );
	t( sp_ctl(env, SPDIR, SPO_CREAT|SPO_RDWR, dbrep1) == 0 );
	void *db = sp_open(env);
	t( db != NULL );
	void *env2 = sp_env();
	t( env2 != NULL );
	t( sp_ctl(env2, SPDIR, SPO_CREAT|SPO_RDWR, dbrep1) == 0 );
	void *db2 = sp_open(env2);
	t( db2 == NULL );
	t( sp_destroy(env2) == 0 );
	t( sp_destroy(db) == 0 );
	t( sp_destroy(env) == 0 );
	rmrf(dbrep1);
}
开发者ID:FromPointer,项目名称:sophia,代码行数:17,代码来源:concurrent.c


示例17: meta_validation

static void
meta_validation(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_open(env) == 0 );

	t( sp_setstring(env, "sophia.path", st_r.conf->sophia_dir, 0) == -1 );
	t( sp_setint(env, "memory.limit", 0) == -1 );
	t( sp_setint(env, "compaction.page_size", 0) == -1 );
	t( sp_setint(env, "compaction.node_size", 0) == -1 );
	t( sp_setint(env, "scheduler.threads", 0) == -1 );

	t( sp_setint(env, "log.enable", 0) == -1 );
	t( sp_setstring(env, "log.path", st_r.conf->log_dir, 0) == -1 );
	t( sp_setint(env, "log.sync", 0) == -1 );
	t( sp_setint(env, "log.rotate_wm", 0) == -1 );
	t( sp_setint(env, "log.rotate_sync", 0) == -1 );
	t( sp_setint(env, "log.two_phase_commit", 0) == -1 );
	t( sp_setint(env, "log.commit_lsn", 0) == -1 );

	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_open(db) == 0 );
	t( sp_setstring(env, "db.test.path", "path", 0) == -1 );
	t( sp_setstring(env, "db.test.index.key", NULL, 0) == -1 );

	void *o = sp_object(db);
	t( o != NULL );

	char key[65000];
	memset(key, 0, sizeof(key));
	t( sp_setstring(o, "key", key, sizeof(key)) == -1 );
	t( sp_setstring(o, "key", key, (1 << 15)) == 0 );
	t( sp_setstring(o, "value", key, (1 << 21) + 1 ) == -1 );
	t( sp_setstring(o, "value", key, (1 << 21)) == 0 );

	t( sp_destroy(env) == 0 );
}
开发者ID:Wanderfalke,项目名称:sophia,代码行数:46,代码来源:meta.test.c


示例18: repository_empty

static void
repository_empty(void)
{
	void *env = sp_env();
	t( env != NULL );
	t( sp_open(env) == -1 );
	t( sp_destroy(env) == 0 );
}
开发者ID:Alexey-Ivanensky,项目名称:sophia,代码行数:8,代码来源:repository.test.c


示例19: shutdown_snapshot0

static void
shutdown_snapshot0(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, "snapshot", "a", 0) == 0 );
	void *a = sp_getobject(env, "snapshot.a");
	t( a != NULL );

	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 );

	t( sp_setstring(env, "snapshot", "b", 0) == 0 );
	void *b = sp_getobject(env, "snapshot.b");
	t( b != NULL );

	sp_destroy(db); /* unref */
	sp_destroy(db); /* schedule shutdown, unlink */

	t( sp_setstring(env, "snapshot", "v", 0) == 0 );
	void *v = sp_getobject(env, "snapshot.v");
	t( v != NULL );

	void *dbp = sp_getobject(env, "db.test");
	t( dbp == NULL );

	t( sp_setint(env, "scheduler.run", 0) == 0 );
	t( sp_destroy(a) == 0 );
	t( sp_setint(env, "scheduler.run", 0) == 0 ); /* no unlink */
	t( sp_destroy(v) == 0 );
	t( sp_setint(env, "scheduler.run", 0) == 0 ); /* no unlink */
	t( sp_destroy(b) == 0 );
	t( sp_setint(env, "scheduler.run", 0) == 1 );

	t( sp_destroy(env) == 0 );
}
开发者ID:egmkang,项目名称:green_turtle,代码行数:46,代码来源:shutdown.test.c


示例20: mt_async_read

static void
mt_async_read(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_setint(env, "compaction.0.async", 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_setint(env, "db.test.sync", 0) == 0 );
	t( sp_setstring(env, "db.test.format", "kv", 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_open(env) == 0 );

	int i = 0;
	while (i < 100000) {
		void *o = sp_object(db);
		assert(o != NULL);
		sp_setstring(o, "key", &i, sizeof(i));
		int rc = sp_set(db, o);
		t( rc == 0 );
		print_current(i);
		i++;
	}
	fprintf(st_r.output, " (insert done..iterate) ");

	void *async = sp_asynchronous(db);
	t( async != NULL );

	/* trigger iteration */
	void *o = sp_object(async);
	sp_setstring(o, "order", ">=", 0);
	o = sp_get(db, o);
	t( o != NULL );
	sp_destroy(o);

	i = 0;
	while (i < 100000) {
		o = sp_poll(env);
		if (o == NULL)
			continue;
		t( strcmp(sp_getstring(o, "type", 0), "on_read") == 0 );
		t( sp_getint(o, "status") == 1 );
		t( *(int*)sp_getstring(o, "key", NULL) == i );
		o = sp_get(db, o);
		t( o != NULL );
		sp_destroy(o);
		print_current(i);
		i++;
	}
	t( i == 100000 );
	fprintf(st_r.output, "(complete)");
	t( sp_destroy(env) == 0 );
}
开发者ID:holys,项目名称:sophia,代码行数:58,代码来源:multithread_be.test.c



注:本文中的sp_open函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ sp_set函数代码示例发布时间:2022-05-30
下一篇:
C++ sp_ienv函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap