uringmachine 0.31.0 → 0.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/ext/um/um_class.c CHANGED
@@ -22,7 +22,6 @@ VALUE SYM_ops_free;
22
22
  VALUE SYM_ops_transient;
23
23
  VALUE SYM_time_total_cpu;
24
24
  VALUE SYM_time_total_wait;
25
- VALUE SYM_buffer_groups;
26
25
  VALUE SYM_buffers_allocated;
27
26
  VALUE SYM_buffers_free;
28
27
  VALUE SYM_segments_free;
@@ -129,18 +128,6 @@ VALUE UM_initialize(int argc, VALUE *argv, VALUE self) {
129
128
  return self;
130
129
  }
131
130
 
132
- /* Creates a buffer group (buffer ring) with the given buffer size and buffer count.
133
- *
134
- * @param size [Integer] buffer size in bytes
135
- * @param count [Integer] number of buffers in group
136
- * @return [Integer] buffer group id
137
- */
138
- VALUE UM_setup_buffer_ring(VALUE self, VALUE size, VALUE count) {
139
- struct um *machine = um_get_machine(self);
140
- int bgid = um_setup_buffer_ring(machine, NUM2UINT(size), NUM2UINT(count));
141
- return INT2NUM(bgid);
142
- }
143
-
144
131
  /* Returns the SQ (submission queue) size.
145
132
  *
146
133
  * @return [Integer] SQ size
@@ -408,21 +395,19 @@ VALUE UM_read(int argc, VALUE *argv, VALUE self) {
408
395
  }
409
396
 
410
397
  /* call-seq:
411
- * machine.read_each(fd, bgid) { |data| }
398
+ * machine.read_each(fd) { |data| }
412
399
  *
413
- * Reads repeatedly from the given `fd` using the given buffer group id. The
414
- * buffer group should have been previously setup using `#setup_buffer_ring`.
415
- * Read data is yielded in an infinite loop to the given block.
400
+ * Reads repeatedly from the given fd. Read data is yielded in an infinite
401
+ * loop to the given block.
416
402
  *
417
403
  * - https://www.man7.org/linux/man-pages/man3/io_uring_prep_read_multishot.3.html
418
404
  *
419
405
  * @param fd [Integer] file descriptor
420
- * @param bgid [Integer] buffer group id
421
406
  * @return [void]
422
407
  */
423
- VALUE UM_read_each(VALUE self, VALUE fd, VALUE bgid) {
408
+ VALUE UM_read_each(VALUE self, VALUE fd) {
424
409
  struct um *machine = um_get_machine(self);
425
- return um_read_each(machine, NUM2INT(fd), NUM2INT(bgid));
410
+ return um_read_each(machine, NUM2INT(fd));
426
411
  }
427
412
 
428
413
  /* call-seq:
@@ -836,38 +821,6 @@ VALUE UM_sendv(int argc, VALUE *argv, VALUE self) {
836
821
  }
837
822
 
838
823
 
839
- /* call-seq:
840
- * machine.send_bundle(fd, bgid, *buffers) -> bytes_sent
841
- *
842
- * Sends data on the given socket from the given buffers using a registered
843
- * buffer group. The buffer group should have been previously registered using
844
- * `#setup_buffer_ring`.
845
- *
846
- * - https://www.man7.org/linux/man-pages/man2/send.2.html
847
- * - https://www.man7.org/linux/man-pages/man3/io_uring_prep_send.3.html
848
- *
849
- * @overload send_bundle(fd, bgid, *buffers)
850
- * @param fd [Integer] file descriptor
851
- * @param bgid [Integer] buffer group id
852
- * @param *buffers [Array<String, IO::Buffer>] buffers
853
- * @return [Integer] number of bytes sent
854
- */
855
- VALUE UM_send_bundle(int argc, VALUE *argv, VALUE self) {
856
- struct um *machine = um_get_machine(self);
857
- VALUE fd;
858
- VALUE bgid;
859
- VALUE strings;
860
- rb_scan_args(argc, argv, "2*", &fd, &bgid, &strings);
861
-
862
- if (RARRAY_LEN(strings) == 1) {
863
- VALUE first = rb_ary_entry(strings, 0);
864
- if (TYPE(first) == T_ARRAY)
865
- strings = first;
866
- }
867
-
868
- return um_send_bundle(machine, NUM2INT(fd), NUM2INT(bgid), strings);
869
- }
870
-
871
824
  /* call-seq:
872
825
  * machine.recv(fd, buffer, maxlen, flags) -> bytes_received
873
826
  *
@@ -888,23 +841,20 @@ VALUE UM_recv(VALUE self, VALUE fd, VALUE buffer, VALUE maxlen, VALUE flags) {
888
841
  }
889
842
 
890
843
  /* call-seq:
891
- * machine.recv_each(fd, bgid, flags) { |data| ... }
844
+ * machine.recv_each(fd, flags) { |data| ... }
892
845
  *
893
- * Repeatedlty receives data from the given socket in an infinite loop using the
894
- * given buffer group id. The buffer group should have been previously setup
895
- * using `#setup_buffer_ring`.
846
+ * Repeatedlty receives data from the given socket in an infinite loop.
896
847
  *
897
848
  * - https://www.man7.org/linux/man-pages/man2/recv.2.html
898
849
  * - https://www.man7.org/linux/man-pages/man3/io_uring_prep_recv.3.html
899
850
  *
900
851
  * @param fd [Integer] file descriptor
901
- * @param bgid [Integer] buffer group id
902
852
  * @param flags [Integer] flags mask
903
853
  * @return [void]
904
854
  */
905
- VALUE UM_recv_each(VALUE self, VALUE fd, VALUE bgid, VALUE flags) {
855
+ VALUE UM_recv_each(VALUE self, VALUE fd, VALUE flags) {
906
856
  struct um *machine = um_get_machine(self);
907
- return um_recv_each(machine, NUM2INT(fd), NUM2INT(bgid), NUM2INT(flags));
857
+ return um_recv_each(machine, NUM2INT(fd), NUM2INT(flags));
908
858
  }
909
859
 
910
860
  /* call-seq:
@@ -1512,8 +1462,6 @@ void Init_UM(void) {
1512
1462
  rb_define_method(cUM, "sidecar_start", UM_sidecar_start, 0);
1513
1463
  rb_define_method(cUM, "sidecar_stop", UM_sidecar_stop, 0);
1514
1464
 
1515
- rb_define_method(cUM, "setup_buffer_ring", UM_setup_buffer_ring, 2);
1516
-
1517
1465
  rb_define_method(cUM, "schedule", UM_schedule, 2);
1518
1466
  rb_define_method(cUM, "snooze", UM_snooze, 0);
1519
1467
  rb_define_method(cUM, "timeout", UM_timeout, 2);
@@ -1527,7 +1475,7 @@ void Init_UM(void) {
1527
1475
  rb_define_method(cUM, "close_async", UM_close_async, 1);
1528
1476
  rb_define_method(cUM, "open", UM_open, 2);
1529
1477
  rb_define_method(cUM, "read", UM_read, -1);
1530
- rb_define_method(cUM, "read_each", UM_read_each, 2);
1478
+ rb_define_method(cUM, "read_each", UM_read_each, 1);
1531
1479
  rb_define_method(cUM, "sleep", UM_sleep, 1);
1532
1480
  rb_define_method(cUM, "periodically", UM_periodically, 1);
1533
1481
  rb_define_method(cUM, "write", UM_write, -1);
@@ -1554,11 +1502,10 @@ void Init_UM(void) {
1554
1502
  rb_define_method(cUM, "getsockopt", UM_getsockopt, 3);
1555
1503
  rb_define_method(cUM, "listen", UM_listen, 2);
1556
1504
  rb_define_method(cUM, "recv", UM_recv, 4);
1557
- rb_define_method(cUM, "recv_each", UM_recv_each, 3);
1505
+ rb_define_method(cUM, "recv_each", UM_recv_each, 2);
1558
1506
  rb_define_method(cUM, "send", UM_send, 4);
1559
1507
  rb_define_method(cUM, "sendv", UM_sendv, -1);
1560
1508
 
1561
- rb_define_method(cUM, "send_bundle", UM_send_bundle, -1);
1562
1509
  rb_define_method(cUM, "setsockopt", UM_setsockopt, 4);
1563
1510
  rb_define_method(cUM, "socket", UM_socket, 4);
1564
1511
  rb_define_method(cUM, "shutdown", UM_shutdown, 2);
@@ -1595,7 +1542,6 @@ void Init_UM(void) {
1595
1542
  SYM_ops_transient = ID2SYM(rb_intern("ops_transient"));
1596
1543
  SYM_time_total_cpu = ID2SYM(rb_intern("time_total_cpu"));
1597
1544
  SYM_time_total_wait = ID2SYM(rb_intern("time_total_wait"));
1598
- SYM_buffer_groups = ID2SYM(rb_intern("buffer_groups"));
1599
1545
  SYM_buffers_allocated = ID2SYM(rb_intern("buffers_allocated"));
1600
1546
  SYM_buffers_free = ID2SYM(rb_intern("buffers_free"));
1601
1547
  SYM_segments_free = ID2SYM(rb_intern("segments_free"));
data/ext/um/um_ext.c CHANGED
@@ -2,14 +2,12 @@ void Init_UM();
2
2
  void Init_Mutex();
3
3
  void Init_Queue();
4
4
  void Init_AsyncOp();
5
- void Init_SSL();
6
- void Init_Stream();
5
+ void Init_IO();
7
6
 
8
7
  void Init_um_ext(void) {
9
8
  Init_UM();
10
9
  Init_Mutex();
11
10
  Init_Queue();
12
11
  Init_AsyncOp();
13
- // Init_SSL();
14
- Init_Stream();
12
+ Init_IO();
15
13
  }