int main(int argc, char **argv, char **envp) {

  if (3 != argc) {
    fprintf(stderr, "Usage: ./rwdts_redis_client <ip> <port>\n");
    return -1;
  }

  //uint16_t port = atoi(argv[2]);

  myUserData.handle = rwdts_kv_allocate_handle(REDIS_DB);
  rwsched_instance_ptr_t rwsched = NULL;
  rwsched = rwsched_instance_new();
  RW_ASSERT(rwsched);

  rwsched_tasklet_ptr_t tasklet = NULL;
  tasklet = rwsched_tasklet_new(rwsched);
  RW_ASSERT(tasklet);

  rwdts_kv_light_db_connect(myUserData.handle, rwsched, tasklet, "127.0.0.1:9997",
                            redis_initialized, myUserData.handle);

  myUserData.rwsched = rwsched;
  myUserData.tasklet = tasklet;
  myUserData.count = 0;
  myUserData.my_shard_deleted = 0;

  rwsched_dispatch_main_until(tasklet, 1000, 0);

  return 1;
}
Exemple #2
0
void
rwmsg_toysched_init(rwmsg_toysched_t *tsched)
{
  rwsched_instance_ptr_t instance;
  rwmsg_toysched_t *toysched = tsched;

  // Register the rwmsg types
  RW_CF_TYPE_REGISTER(rwtoytask_tasklet_ptr_t);
  RW_CF_TYPE_REGISTER(rwmsg_toyfd_ptr_t);
  RW_CF_TYPE_REGISTER(rwmsg_toytimer_ptr_t);

  // Zero out the toysched structure
  RW_ZERO_VARIABLE(toysched);

  // Create an instance of the toy scheduler
  instance = rwsched_instance_new();
  RW_CF_TYPE_VALIDATE(instance, rwsched_instance_ptr_t);

  // Store the rwsched instance into the toysched data structure
  toysched->rwsched_instance = instance;
}