예제 #1
0
static PyObject*
Bucket__connect(pycbc_Bucket *self)
{
    lcb_error_t err;

    if (self->flags & PYCBC_CONN_F_CONNECTED) {
        Py_RETURN_NONE;
    }

    err = lcb_connect(self->instance);

    if (err != LCB_SUCCESS) {
        PYCBC_EXC_WRAP(PYCBC_EXC_LCBERR, err,
                       "Couldn't schedule connection. This might be a result of "
                       "an invalid hostname.");
        return NULL;
    }

    pycbc_oputil_wait_common(self);
    if ((self->flags & PYCBC_CONN_F_ASYNC) == 0) {
        err = lcb_get_bootstrap_status(self->instance);
        if (err != LCB_SUCCESS) {
            PYCBC_EXCTHROW_WAIT(err);
            return NULL;
        }
    }
    Py_RETURN_NONE;
}
int _tmain(int argc, _TCHAR* argv[])
{
	// initializing

	struct lcb_create_st cropts = { 0 };
	cropts.version = 3;
	cropts.v.v3.connstr = "couchbase://localhost/default";
	lcb_error_t err;
	lcb_t instance;
	err = lcb_create(&instance, &cropts);
	if (err != LCB_SUCCESS) {
		printf("Couldn't create instance!\n");
		exit(1);
	}

	// connecting

	lcb_connect(instance);
	lcb_wait(instance);
	if ((err = lcb_get_bootstrap_status(instance)) != LCB_SUCCESS) {
		printf("Couldn't bootstrap!\n");
		exit(1);
	}

	// installing callbacks

	lcb_set_store_callback(instance, storage_callback);
	lcb_set_get_callback(instance, get_callback);


	// scheduling operations

	lcb_store_cmd_t scmd;
	const lcb_store_cmd_t *scmdlist = &scmd;
	scmd.v.v0.key = "Hello";
	scmd.v.v0.nkey = 5;
	scmd.v.v0.bytes = "Couchbase";
	scmd.v.v0.nbytes = 9;
	scmd.v.v0.operation = LCB_SET;
	err = lcb_store(instance, NULL, 1, &scmdlist);
	if (err != LCB_SUCCESS) {
		printf("Couldn't schedule storage operation!\n");
		exit(1);
	}
	lcb_wait(instance); //storage_callback is invoked here

	lcb_get_cmd_t gcmd = { 0 };
	const lcb_get_cmd_t *gcmdlist = &gcmd;
	gcmd.v.v0.key = "Hello";
	gcmd.v.v0.nkey = 5;
	err = lcb_get(instance, NULL, 1, &gcmdlist);
	if (err != LCB_SUCCESS) {
		printf("Couldn't schedule get operation!\n");
		exit(1);
	}
	lcb_wait(instance); // get_callback is invoked here
	lcb_destroy(instance);
	return 0;
}
예제 #3
0
int main(int argc, char *argv[])
{
    lcb_error_t err;
    lcb_t instance;

    {
        struct lcb_create_st create_options = {};
        create_options.version = 3;

        if (argc < 2) {
            fprintf(stderr, "Usage: %s couchbase://host/bucket [ password [ username ] ]\n", argv[0]);
            exit(EXIT_FAILURE);
        }

        create_options.v.v3.connstr = argv[1];
        if (argc > 2) {
            create_options.v.v3.passwd = argv[2];
        }
        if (argc > 3) {
            create_options.v.v3.username = argv[3];
        }

        err = lcb_create(&instance, &create_options);
        if (err != LCB_SUCCESS) {
            die(NULL, "Couldn't create couchbase handle", err);
        }

        err = lcb_connect(instance);
        if (err != LCB_SUCCESS) {
            die(instance, "Couldn't schedule connection", err);
        }

        lcb_wait(instance);

        err = lcb_get_bootstrap_status(instance);
        if (err != LCB_SUCCESS) {
            die(instance, "Couldn't bootstrap from cluster", err);
        }

        lcb_install_callback3(instance, LCB_CALLBACK_GET, op_callback);
    }

    lcbcrypto_register(instance, "AES-256-HMAC-SHA256", osp_create());

    get_encrypted(instance, "secret-1");
    printf("\n");
    get_encrypted(instance, "secret-2");
    printf("\n");
    get_encrypted(instance, "secret-3");
    printf("\n");
    get_encrypted(instance, "secret-4");
    printf("\n");
    get_encrypted(instance, "secret-5");

    lcb_destroy(instance);
    return 0;
}
예제 #4
0
int main(int argc, char *argv[])
{
    lcb_STATUS err;
    lcb_INSTANCE *instance;
    char *bucket = NULL;
    size_t ii;

    if (argc < 2) {
        printf("Usage: %s couchbase://host/beer-sample [ password [ username ] ]\n", argv[0]);
        exit(EXIT_FAILURE);
    }

    {
        struct lcb_create_st create_options = {0};
        create_options.version = 3;
        create_options.v.v3.connstr = argv[1];
        if (argc > 2) {
            create_options.v.v3.passwd = argv[2];
        }
        if (argc > 3) {
            create_options.v.v3.username = argv[3];
        }
        check(lcb_create(&instance, &create_options), "create couchbase handle");
        check(lcb_connect(instance), "schedule connection");
        lcb_wait(instance);
        check(lcb_get_bootstrap_status(instance), "bootstrap from cluster");
        check(lcb_cntl(instance, LCB_CNTL_GET, LCB_CNTL_BUCKETNAME, &bucket), "get bucket name");
        if (strcmp(bucket, "beer-sample") != 0) {
            fail("expected bucket to be \"beer-sample\"");
        }
    }

    {
        const char *stmt = "SELECT * FROM breweries LIMIT 2";
        lcb_CMDANALYTICS *cmd;
        int idx = 0;
        lcb_cmdanalytics_create(&cmd);
        lcb_cmdanalytics_callback(cmd, row_callback);
        lcb_cmdanalytics_statement(cmd, stmt, strlen(stmt));
        lcb_cmdanalytics_deferred(cmd, 1);
        check(lcb_analytics(instance, &idx, cmd), "schedule analytics query");
        printf("----> \x1b[36m%s\x1b[0m\n", stmt);
        lcb_cmdanalytics_destroy(cmd);
        lcb_wait(instance);
    }

    /* Now that we're all done, close down the connection handle */
    lcb_destroy(instance);
    return 0;
}
예제 #5
0
int
main(int argc, char **argv)
{
    lcb_t instance;
    struct lcb_create_st cropts;
    lcb_error_t rc;

    memset(&cropts, 0, sizeof cropts);
    cropts.version = 3;
    cropts.v.v3.connstr = "couchbases://10.0.0.31/default?certpath=/tmp/couchbase-ssl-certificate.pem";

    rc = lcb_create(&instance, &cropts);
    if (rc != LCB_SUCCESS) {
        die(rc, "Creating instance");
    }

    rc = lcb_connect(instance);
    if (rc != LCB_SUCCESS) {
        die(rc, "Connection scheduling");
    }

    /* This function required to actually schedule the operations on the network */
    lcb_wait(instance);

    /* Determines if the bootstrap/connection succeeded */
    rc = lcb_get_bootstrap_status(instance);
    if (rc != LCB_SUCCESS) {
        die(rc, "Connection bootstraping");
    } else {
        printf("Connection succeeded. Cluster has %d nodes\n",
            lcb_get_num_nodes(instance));
    }

    /* SSL connections use different ports. For example, the REST API
     * connection will use port 18091 rather than 8091 when using SSL */
    const char *node = lcb_get_node(instance, LCB_NODE_HTCONFIG, 0);
    printf("First node address for REST API: %s\n", node);

    lcb_destroy(instance);
    return 0;
}
예제 #6
0
PHP_METHOD(Bucket, __construct)
{
    bucket_object *data = PCBC_PHP_THISOBJ();
    zval *zdsn = NULL;
    zval *zname = NULL;
    zval *zpassword = NULL;
    char *dsn = NULL;
    char *name = NULL;
    char *password = NULL;
    lcb_error_t err;
    lcb_t instance;
    struct lcb_create_st create_options;
    char *connkey = NULL;
    pcbc_lcb *conn_iter, *conn;

    if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|zzz",
                              &zdsn, &zname, &zpassword) == FAILURE) {
        RETURN_NULL();
    }

    if (zap_zval_is_undef(zdsn)) {
        zdsn = NULL;
    }
    if (zap_zval_is_undef(zname)) {
        zname = NULL;
    }
    if (zap_zval_is_undef(zpassword)) {
        zpassword = NULL;
    }

    if (zdsn) {
        if (Z_TYPE_P(zdsn) == IS_STRING) {
            dsn = estrndup(Z_STRVAL_P(zdsn), Z_STRLEN_P(zdsn));
        } else {
            throw_pcbc_exception("Expected dsn as string", LCB_EINVAL);
            RETURN_NULL();
        }
    }

    if (zname) {
        if (Z_TYPE_P(zname) == IS_STRING) {
            name = estrndup(Z_STRVAL_P(zname), Z_STRLEN_P(zname));
        } else {
            throw_pcbc_exception("Expected bucket name as string", LCB_EINVAL);
            if (dsn) efree(dsn);
            RETURN_NULL();
        }
    }

    if (zpassword) {
        if (Z_TYPE_P(zpassword) == IS_STRING) {
            password = estrndup(Z_STRVAL_P(zpassword), Z_STRLEN_P(zpassword));
        } else {
            throw_pcbc_exception("Expected bucket password as string", LCB_EINVAL);
            if (dsn) efree(dsn);
            if (name) efree(name);
            RETURN_NULL();
        }
    }

    spprintf(&connkey, 512, "%s|%s|%s",
             dsn ? dsn : "",
             name ? name : "",
             password ? password : "");

    conn_iter = PCBCG(first_bconn);
    while (conn_iter) {
        if (strcmp(conn_iter->key, connkey) == 0) {
            break;
        }
        conn_iter = conn_iter->next;
    }

    if (!conn_iter)
    {
        memset(&create_options, 0, sizeof(create_options));
        create_options.version = 3;
        create_options.v.v3.connstr = dsn;
        create_options.v.v3.username = name;
        create_options.v.v3.passwd = password;
        create_options.v.v3.type = LCB_TYPE_BUCKET;
        err = lcb_create(&instance, &create_options);

        if (dsn) efree(dsn);
        if (password) efree(password);

        if (err != LCB_SUCCESS) {
            efree(connkey);
            efree(name);
            throw_lcb_exception(err);
            RETURN_NULL();
        }
        lcb_cntl(instance, LCB_CNTL_SET, LCB_CNTL_CLIENT_STRING, pcbc_client_string);

        lcb_install_callback3(instance, LCB_CALLBACK_GET, get_callback);
        lcb_install_callback3(instance, LCB_CALLBACK_UNLOCK, unlock_callback);
        lcb_install_callback3(instance, LCB_CALLBACK_STORE, store_callback);
        lcb_install_callback3(instance, LCB_CALLBACK_STOREDUR, store_callback);
        lcb_install_callback3(instance, LCB_CALLBACK_REMOVE, remove_callback);
        lcb_install_callback3(instance, LCB_CALLBACK_TOUCH, touch_callback);
        lcb_install_callback3(instance, LCB_CALLBACK_COUNTER, counter_callback);
        lcb_install_callback3(instance, LCB_CALLBACK_SDLOOKUP, subdoc_callback);
        lcb_install_callback3(instance, LCB_CALLBACK_SDMUTATE, subdoc_callback);
        lcb_install_callback3(instance, LCB_CALLBACK_HTTP, http_callback);

        lcb_set_durability_callback(instance, durability_callback);


        err = lcb_connect(instance);
        if (err != LCB_SUCCESS) {
            efree(connkey);
            efree(name);
            lcb_destroy(instance);
            throw_lcb_exception(err);
            RETURN_NULL();
        }

        // We use lcb_wait here as no callbacks are invoked by connect.
        lcb_wait(instance);

        err = lcb_get_bootstrap_status(instance);
        if (err != LCB_SUCCESS) {
            efree(connkey);
            efree(name);
            lcb_destroy(instance);
            throw_lcb_exception(err);
            RETURN_NULL();
        }

        conn = pemalloc(sizeof(pcbc_lcb), 1);
        conn->bucket = pestrdup(name, 1);
        efree(name);
        conn->key = pestrdup(connkey, 1);
        conn->lcb = instance;
        conn->next = NULL;
        data->conn = conn;

        if (PCBCG(last_bconn)) {
            PCBCG(last_bconn)->next = conn;
            PCBCG(last_bconn) = conn;
        } else {
            PCBCG(first_bconn) = conn;
            PCBCG(last_bconn) = conn;
        }
    } else {
        if (dsn) efree(dsn);
        if (name) efree(name);
        if (password) efree(password);

        data->conn = conn_iter;
    }

    efree(connkey);
}
예제 #7
0
int main(void)
{
  struct lcb_create_st create_options;
  memset(&create_options, 0, sizeof create_options);
  create_options.version = 3;
  create_options.v.v3.connstr = "couchbase://10.141.95.101/default";
  // create_options.v.v3.passwd = "testbucket";
  lcb_error_t err;

  lcb_t instance = NULL;
  err = lcb_create(&instance, &create_options);
  if (err != LCB_SUCCESS) {
    fprintf(stderr, "Failed to create a couchbase instance: %s\n", lcb_strerror(instance,err));
    return 1;
  }
  // Default timeout values and settings:
  //http://developer.couchbase.com/documentation/server/current/sdks/c-2.4/options.html
  //Enable details error codes:
  lcb_cntl_string(instance,"detailed_errcodes","1");

  //Connecting
  lcb_connect(instance);
  lcb_wait(instance);
  if ( (err = lcb_get_bootstrap_status(instance)) != LCB_SUCCESS ) {
    printf("Couldn't bootstrap. Exiting!\n");
    exit(1);
  }

  // installing callbacks
  lcb_set_store_callback(instance, storage_callback);
  lcb_set_durability_callback(instance, durability_callback);

  // scheduling set operations with elements that expire
  lcb_store_cmd_t scmd = { 0 };
  const lcb_store_cmd_t *scmdlist = &scmd;
/*
    INSERT, Loop through x number of keys and insert them with expiry
*/
  for( int counter=1; counter <= NUMBER_OF_DOCUMENTS; counter++){
      // Setting keys and values
      const char *doc = "{\"json\" : \"data\" }";
      char key [12];
      sprintf(key, "%s%d", "test", counter);
      scmd.v.v0.key = key;
      scmd.v.v0.nkey = strlen(key);
      scmd.v.v0.bytes = doc;
      scmd.v.v0.nbytes = strlen(doc);
      scmd.v.v0.exptime = 300; //expiry of 5 minutes
      scmd.v.v0.operation = LCB_SET;

      err = lcb_store(instance, NULL, 1, (const lcb_store_cmd_t * const *)&scmdlist);
      if (err != LCB_SUCCESS) {
        printf("Couldn't schedule storage operation!\n");
        exit(1);
      }
      lcb_wait(instance);

      //Durability is invoked here
      lcb_durability_opts_t options;
      lcb_durability_cmd_t cmd = { 0 };
      const lcb_durability_cmd_t *cmdp = &cmd;
      cmd.v.v0.key = key;
      cmd.v.v0.nkey = strlen(key);
      options.v.v0.persist_to = 1;
      options.v.v0.replicate_to = 1;

      err = lcb_durability_poll(instance,NULL,&options,1,&cmdp);
      if (err != LCB_SUCCESS) {
        printf("couldn't schedule durability operation %s \n", lcb_strerror(instance, err));
      }
    lcb_wait(instance);
  }
  //closing the connection
  lcb_destroy(instance);
  return 0;
}
예제 #8
0
파일: cb_test.c 프로젝트: nsprams/CodeBase
int main(int argc, char*argv[]) 
{
	//couchbase error type
	lcb_error_t err;
	//couchbase type
	lcb_t instance;
	// couchbase create struct? its a struct with options to create what? a cb cluster, bucket or something else?
	struct lcb_create_st create_options = {0};
	memset(&create_options,0,sizeof(create_options));
	// set command type, and creating a list of store commands?
	lcb_store_cmd_t scmd = {0};
	const lcb_store_cmd_t *scmdlist[1];
	// get command type, and list of get commands!
	lcb_get_cmd_t gcmd = {0};
	const lcb_get_cmd_t *gcmdlist[1];

	create_options.version = 3; // cb version 3?

	if (argc < 2) 
	{
		fprintf(stderr, "Usage: %s couchbase://host/bucket [password] \n",argv[0] );
		exit(EXIT_FAILURE);		
	}

	create_options.v.v3.connstr = argv[1];
	if (argc >=3)
	{
		create_options.v.v3.passwd = argv[2];
	}
	
	//fprintf(stderr, "\n %s,%s,%s\n",create_options.v.v3.connstr,create_options.v.v3.passwd,"test" );
	/*
	create_options.version = 3;
	create_options.v.v3.connstr = "couchbase://192.168.56.101/pramod";
	create_options.v.v3.passwd = "couchbase";
	*/
	err = lcb_create(&instance, &create_options);
	if(err != LCB_SUCCESS)
	{
		die(instance, "Couldn't create couchbase handle", err);
	}

	err = lcb_connect(instance);
	if(err != LCB_SUCCESS) 
	{
		die(instance, "Couldn't schedule connection", err);
	}
	lcb_wait(instance);	// It says this will be blocking wait and won't execute in a async fashion


	err = lcb_get_bootstrap_status(instance);
	if (err != LCB_SUCCESS) 
	{
		die(instance, "Couldn't bootstrap from cluster", err);
	}
	// Assign the handlers to be called for the operations types
	lcb_set_get_callback(instance, get_callback);
	lcb_set_store_callback(instance, store_callback);
	//what are these callbacks for ? I thought callbacks are for getting results of asynchronous exectution of jobs?
	

	// what is happening in here? setting values? to the source command ? 
	//let my try to wrap this up in a loop to set a 1000 values?

	
	scmd.v.v0.operation = LCB_SET;
	scmd.v.v0.key = "foo";		scmd.v.v0.nkey = 3 ;
	scmd.v.v0.bytes = "barbeque";	scmd.v.v0.nbytes = 8;
	scmdlist[0] = &scmd;

	err = lcb_store(instance, NULL, 1, scmdlist);	// so here is where the data is getting written!!
	if (err != LCB_SUCCESS) 
	{
		die (instance, "Coudn't schedule storage operations", err);
	}

	// the store_callback is involed from lcb_wait()
	fprintf(stderr, "Will wait for storage operation to complete\n");
	lcb_wait(instance);




	//now fetch the items back
	gcmd.v.v0.key = "foo";
	gcmd.v.v0.nkey = 3;
	gcmd.v.v0.exptime = 60;
	gcmdlist[0] = &gcmd;
	err = lcb_get(instance, NULL, 1, gcmdlist);
	if (err != LCB_SUCCESS) 
	{
		die(instance, "Couldn't schedule retrieval operation", err);
	}

	// get callback invoked from here.
	fprintf(stderr, "Will wait to retrieve the set item!\n");
	lcb_wait(instance);

	// close the connection handle after everything is done
	lcb_destroy(instance);
	return 0;
}
예제 #9
0
int main(void)
{

  // initializing
  struct lcb_create_st create_options;
  memset(&create_options, 0, sizeof create_options);
  create_options.version = 3;
  create_options.v.v3.connstr = "couchbase://10.141.110.101,10.141.110.102,10.141.110.103/testbucket";
  create_options.v.v3.passwd = "testbucket";
  lcb_error_t err;
  lcb_t instance = NULL;
  err = lcb_create(&instance, &create_options);
  if (err != LCB_SUCCESS) {
    fprintf(stderr, "Failed to create a couchbase instance: %s\n", lcb_strerror(instance,err));
    return 1;
  }
// Default timeout values and settings: http://developer.couchbase.com/documentation/server/current/sdks/java-2.2/env-config.html
//Enable details error codes:
//http://developer.couchbase.com/documentation/server/current/sdks/c-2.4/options.html
  lcb_cntl_string(instance,"detailed_errcodes","1");

  //connecting
  lcb_connect(instance);
  lcb_wait(instance);
  if ( (err = lcb_get_bootstrap_status(instance)) != LCB_SUCCESS ) {
    printf("Couldn't bootstrap. Exiting!\n");
    exit(1);
  }
  sleep(20);
  
  // installing callbacks
  lcb_set_store_callback(instance, storage_callback);
  lcb_set_get_callback(instance, get_callback);

  
  // scheduling set operations with elements that expire
  lcb_store_cmd_t scmd = { 0 };
  const lcb_store_cmd_t *scmdlist = &scmd;
/*
    INSERT, Loop through x number of keys and insert them with expiry
*/

  for( int counter=0; counter <NUMBER_OF_DOCUMENTS; counter ++){
      // Setting keys and values
      const char *doc = "{\"json\" : \"data\" }";
      char key [12];
      sprintf(key, "%s%d", "test", counter);
      scmd.v.v0.key = key;
      scmd.v.v0.nkey = strlen(key);
      scmd.v.v0.bytes = doc;
      scmd.v.v0.nbytes = strlen(doc);
//      scmd.v.v0.exptime = 300; //expiry of 5 minutes
      scmd.v.v0.operation = LCB_SET;

      err = lcb_store(instance, NULL, 1, &scmdlist);
      if (err != LCB_SUCCESS) {
        printf("Couldn't schedule storage operation!\n");
        exit(1);
      }
      lcb_wait(instance); //storage_callback is invoked here
  }


/*
    GET section
*/
  lcb_get_cmd_t gcmd = { 0 };
  const lcb_get_cmd_t *gcmdlist = &gcmd;
    for( int counter=0; counter <NUMBER_OF_DOCUMENTS; counter ++){
         char key[12];
//         sleep(3);
         sprintf(key,"%s%d", "test", counter);
         gcmd.v.v0.key = key;
         gcmd.v.v0.nkey = strlen(key);
         fprintf(stderr, "GET : %s\n", key);
//         printf("GET %s\n", key);
         err = lcb_get(instance, NULL, 1, &gcmdlist);
         lcb_wait(instance); // get_callback is invoked here
    }

  //closing the connection
  lcb_destroy(instance);
  return 0;
}
예제 #10
0
// Main 
int main(int argc, char* argv[])
{
  printf("Welcome.\n");

  // Do this once
  srand(time(NULL));

  // initializing
  struct lcb_create_st cropts = { 0 };
  cropts.version = 3;
  cropts.v.v3.connstr = "couchbase://localhost/default";
  // cropts.v.v3.connstr = "couchbase://192.168.38.101/default";
  lcb_error_t create_err;
  lcb_t instance;
  create_err = lcb_create(&instance, &cropts);
  if (create_err != LCB_SUCCESS) {
    printf("Couldn't create instance!\n");
    exit(1);
  }
  
  // connecting
  lcb_connect(instance);
  lcb_wait(instance);
  lcb_error_t bootstrap_status_err;
  if ( (bootstrap_status_err = lcb_get_bootstrap_status(instance)) != LCB_SUCCESS ) {
    printf("Couldn't bootstrap!\n");
    exit(1);
  }
  
  // installing callbacks
  lcb_set_store_callback(instance, storage_callback);
  lcb_set_get_callback(instance, get_callback);
  lcb_set_arithmetic_callback(instance, arithmetic_callback); 
  lcb_set_touch_callback(instance, touch_callback); 
  lcb_set_remove_callback(instance, remove_callback); 

  // Main part of the program
  int numTimesToRun = 10;   // specify how many times to iterate
  int useARandomKey = 1;    // specify whether to use a random or sequential key

  char keyNameBuffer[100];

  int i = 0;

  for (i = 0; i < numTimesToRun; i++) {

    if (useARandomKey == 0) {
	// Do NOT use a random key
        sprintf(keyNameBuffer, "NonRandomKey%d", i);
    }
    else {
	// Use a random key, generate a new one for each iteration of the loop
        int randomNumber = rand();
        sprintf(keyNameBuffer, "randomKey%d", randomNumber);
    }

    printf("#### Iteration: %5d Key: %10s\n", i, keyNameBuffer);

    // Create-Increment
    blockingArithmeticIncrement2(instance, keyNameBuffer); 

    // Make sure its there
    blockingGet(instance, keyNameBuffer); 

    // Delete
    blockingRemove(instance, keyNameBuffer); 

    // Sleep 60
    printf("About to sleep...\n");
    sleep(1);
    printf("Done with sleep...\n");
    
    // Touch, should fail
    blockingTouch2(instance, 60, keyNameBuffer);

    // Increment
    blockingArithmeticIncrement2(instance, keyNameBuffer); 
    
    // Touch
    blockingTouch2(instance, 60, keyNameBuffer);

    printf("##### touches that worked: %d touches that failed %d\n", touchesWorked, touchesFailed);

  } // loop for numTimesToRun

  printf("Almost done.  Calling lcb_destroy()\n");
  lcb_destroy(instance);

  printf("Goodbye\n");

  return 0;
}