Example #1
0
void mapcache_riak_connection_constructor(mapcache_context *ctx, void **conn_, void *params) {
    mapcache_cache_riak *cache = ((struct riak_conn_params*)params)->cache;
    struct RIACK_CONNECTION_OPTIONS options;
    struct RIACK_CLIENT *client = riack_new_client(0);

    if (client == NULL) {
        ctx->set_error(ctx,500,"failed to riack_new_client(0)");
        return;
    }

    options.recv_timeout_ms = 2000;
    options.send_timeout_ms = 2000;
    if (riack_connect(client, cache->host, cache->port, &options) != RIACK_SUCCESS) {
        riack_free(client);
        ctx->set_error(ctx,500,"failed to riack_connect()");
        return;
    }

    if (riack_ping(client) != RIACK_SUCCESS) {
        riack_free(client);
        ctx->set_error(ctx,500,"failed to riack_ping()");
        return;
    }

    *conn_ = client;
}
Example #2
0
void RiakTest::setUp()
{
	printf("setUp\n");
	riack_init();
	m_riak = riack_new_client(NULL);
	int ret = riack_connect(m_riak, "192.168.111.86", 8087, NULL);
	//int ret = riack_connect(m_riak, "192.168.111.104", 8087, NULL);
	//int ret = riack_connect(m_riak, "123.57.207.198", 8087, NULL);
	if (ret != RIACK_SUCCESS)
	{
		riack_free(m_riak);
		m_riak = NULL;
	}
}
Example #3
0
static struct ospf6 * ospf6_create(void)
{
  struct ospf6 * o;
  char * host = "127.0.0.1";
  int port = 8087;

  o = calloc(1, sizeof(struct ospf6));

  riack_init();
  o->riack_client = riack_new_client(0);
  if(riack_connect(o->riack_client, host, port, 0) != RIACK_SUCCESS) 
  {   
    printf("Failed to connect to riak server\n");
    riack_free(o->riack_client);
  }

  return o;
}
Example #4
0
void RiakTest::tearDown()
{
	riack_free(m_riak);
	riack_cleanup();
	printf("tearDown\n");
}
Example #5
0
void mapcache_riak_connection_destructor(void *conn_) {
    struct RIACK_CLIENT *client = (struct RIACK_CLIENT *)conn_;
    riack_free(client);
}