示例#1
0
文件: sist.c 项目: wrmsr/urbit
/* _sist_make(): boot from scratch.
*/
static void
_sist_make(u3_noun fav)
{
  //  Initialize ames
  u3_ames_ef_bake();

  //  Authenticate and initialize terminal.
  //
  u3_term_ef_bake(fav);

  //  Create the ship directory.
  //
  _sist_zest();
}
static void _test_egz_bytes()
{

  // delete any old files
  c3_w ret_w = system("rm -rf ~/urb/test");
  if (ret_w < 0) { fprintf(stderr, "failure to setup\n"); exit(-1); }


  // create the directory for the minifiles
  _sist_zest(u2A);

  // start the consolidator
  u2_egz_init();

  // write
  //
  c3_y * msg_1_y= (c3_y * ) "hello world 1";
  c3_w   len_1_w = strlen( (char * )msg_1_y);
  u2_egz_push(msg_1_y, len_1_w, 1, 0);

  c3_y * msg_2_y= (c3_y * ) "hello world 2";
  c3_w   len_2_w = strlen( (char * )msg_2_y);
  u2_egz_push(msg_2_y, len_2_w, 2, 0);

  c3_y * msg_3_y= (c3_y * ) "hello world 3";
  c3_w   len_3_w = strlen( (char * )msg_3_y);
  u2_egz_push(msg_3_y, len_3_w, 3, 0);

  // read
  sleep(15);
  
  u2_egz_pull_start();

  c3_d ent_d;
  c3_w  len_w;
  c3_y* bob_y;
  c3_y  msg_type_y;

  printf("BROKEN - egz_queue - design change: we log raw bytes w/o header, thus can't read them back :-( \n");
  return;

  c3_t ret_t =  u2_egz_pull_one(& ent_d,
                                & msg_type_y,
                                & len_w,
                                & bob_y);
  printf("ret_t = %i\n", ret_t);
  printf("ent_d = %lli\n", (long long int) ent_d);
  printf("len_w = %i\n", len_w);
  printf("msg_type_y = %i\n", msg_type_y);
  printf("msg = %s\n", bob_y);

  ret_t =  u2_egz_pull_one(& ent_d,
                           & msg_type_y,
                           & len_w,
                           & bob_y);

  printf("ret_t = %i\n", ret_t);
  printf("ent_d = %lli\n", (long long int) ent_d);
  printf("len_w = %i\n", len_w);
  printf("msg_type_y = %i\n", msg_type_y);
  printf("msg = %s\n", bob_y);

  ret_t =  u2_egz_pull_one(& ent_d,
                           & msg_type_y,
                           & len_w,
                           & bob_y);

  printf("ret_t = %i\n", ret_t);
  printf("ent_d = %lli\n", (long long int) ent_d);
  printf("len_w = %i\n", len_w);
  printf("msg_type_y = %i\n", msg_type_y);
  printf("msg = %s\n", bob_y);

}