| 1 | #################################################################### | ||||||||||||||||||||||||||||
| 2 | # | ||||||||||||||||||||||||||||
| 3 | # This file was generated using XDR::Parse version v1.0.1 | ||||||||||||||||||||||||||||
| 4 | # and LibVirt version v12.9.0 | ||||||||||||||||||||||||||||
| 5 | # | ||||||||||||||||||||||||||||
| 6 | # Don't edit this file, use the source template instead | ||||||||||||||||||||||||||||
| 7 | # | ||||||||||||||||||||||||||||
| 8 | # ANY CHANGES HERE WILL BE LOST ! | ||||||||||||||||||||||||||||
| 9 | # | ||||||||||||||||||||||||||||
| 10 | #################################################################### | ||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | 1 | ▶ | use v5.26; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 14 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 15 | 1 | ▶ | use experimental 'signatures'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 16 | 1 | ▶ | use Future::AsyncAwait; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 17 | 1 | ▶ | use Object::Pad 0.821; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | class Sys::Async::Virt::Stream v0.6.9; | ||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | 1 | ▶ | use Carp qw(croak); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 22 | 1 | ▶ | use Future; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 23 | 1 | ▶ | use Future::Queue; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 24 | 1 | ▶ | use Log::Any qw($log); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | 1 | ▶ | use Protocol::Sys::Virt::Remote::XDR v12.9.0; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 27 | 1 | my $remote = 'Protocol::Sys::Virt::Remote::XDR'; | |||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | 0 | ▶ | field $_rpc_id :param :reader; | ||||||||||||||||||||||||||
|
Subroutine
rpc_id: not called CC=1 SCAR=2.6
Pod
undocumented
| |||||||||||||||||||||||||||||
| 30 | 0 | ▶ | field $_proc :param :reader; | ||||||||||||||||||||||||||
|
Subroutine
proc: not called CC=1 SCAR=2.6
Pod
documented
| |||||||||||||||||||||||||||||
| 31 | 0 | ▶ | field $_client :param :reader; | ||||||||||||||||||||||||||
|
Subroutine
client: not called CC=1 SCAR=2.6
Pod
documented
| |||||||||||||||||||||||||||||
| 32 | 0 | ▶ | field $_direction :param :reader; | ||||||||||||||||||||||||||
|
Subroutine
direction: not called CC=1 SCAR=2.6
Pod
documented
| |||||||||||||||||||||||||||||
| 33 | 0 | field $_max_items :param :reader = 5; | |||||||||||||||||||||||||||
| 34 | 0 | ▶ | field $_pending_error = undef; | ||||||||||||||||||||||||||
|
Subroutine
max_items: not called CC=1 SCAR=1.2
Pod
documented
| |||||||||||||||||||||||||||||
| 35 | 1 | field $_finished = Future->new; | |||||||||||||||||||||||||||
| 36 | 1 | field $_queue = Future::Queue->new; | |||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | 0 | ▶ | async method receive() { | ||||||||||||||||||||||||||
|
Subroutine
receive: not called CC=3 SCAR=23.3
Pod
documented
| |||||||||||||||||||||||||||||
| 39 | 0 | ▶ | if ($_direction eq 'send') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 40 | 0 | die "Receive called on sending stream (id: $self->{id})"; | |||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||
| 42 | 0 | ▶ | if (my $e = $_pending_error) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 43 | 0 | $_pending_error = undef; | |||||||||||||||||||||||||||
| 44 | 0 | die $e; | |||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | 0 | return await $_queue->shift; | |||||||||||||||||||||||||||
| 48 | 1 | } | |||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | 0 | ▶ | async method _dispatch_receive($data, $hole, $eof, $final) { | ||||||||||||||||||||||||||
|
Subroutine
_dispatch_receive: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||
| 51 | 0 | ▶ | if ($final) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 52 | 0 | $_finished->done; | |||||||||||||||||||||||||||
| 53 | 0 | return; | |||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||
| 55 | 0 | ▶ | if ($eof) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 56 | 0 | $_queue->finish; | |||||||||||||||||||||||||||
| 57 | 0 | return; | |||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||
| 59 | 0 | ▶ | if ($_direction eq 'send') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 60 | 0 | die; | |||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | # throttle receiving if the queue gets too long | ||||||||||||||||||||||||||||
| 64 | 0 | await $_queue->push({ data => $data, hole => $hole }); | |||||||||||||||||||||||||||
| 65 | 0 | return; | |||||||||||||||||||||||||||
| 66 | 1 | } | |||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | 0 | ▶ | async method _dispatch_error($error) { | ||||||||||||||||||||||||||
|
Subroutine
_dispatch_error: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||
| 69 | 0 | ▶ | return if $_finished->is_ready; # discard all input | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 70 | 0 | $_finished->done; | |||||||||||||||||||||||||||
| 71 | 0 | ▶ | unless ($_pending_error) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 72 | 0 | $_pending_error = $error; | |||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||
| 74 | 0 | return; | |||||||||||||||||||||||||||
| 75 | 1 | } | |||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||
| 77 | 0 | ▶ | async method send($data, $offset = 0, $length = undef) { | ||||||||||||||||||||||||||
|
Subroutine
send: not called CC=8 SCAR=42.8
Pod
documented
| |||||||||||||||||||||||||||||
| 78 | 0 | ▶ | if ($_direction eq 'receive') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 79 | 0 | die "'send' called on receiving stream (id: $self->{id}"; | |||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||
| 81 | 0 | ▶ | if (my $e = $_pending_error) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 82 | 0 | $_pending_error = undef; | |||||||||||||||||||||||||||
| 83 | 0 | die $e; | |||||||||||||||||||||||||||
| 84 | } | ||||||||||||||||||||||||||||
| 85 | 0 | ▶ | return if $_finished->is_ready; # discard all transfers | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||
| 87 | 0 | ▶ | my $chunk = ($offset or $length) ? substr($data, $offset, $length) : $data; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$offset or $length
MC/DC0%0/2
$offset or $length
$offset
$length
Truth table0%0/3
A or B
A= $offsetB= $length
| |||||||||||||||||||||||||||||
| 88 | 0 | return await $_client->_send( | |||||||||||||||||||||||||||
| 89 | $_proc, $_rpc_id, | ||||||||||||||||||||||||||||
| 90 | data => $chunk ); | ||||||||||||||||||||||||||||
| 91 | 1 | } | |||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||
| 93 | 0 | ▶ | async method send_hole($length, $flags = 0) { | ||||||||||||||||||||||||||
|
Subroutine
send_hole: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||
| 94 | 0 | ▶ | if ($_direction eq 'receive') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 95 | 0 | die "'send_hole' called on receiving stream (id: $self->{id}"; | |||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||
| 97 | 0 | ▶ | if (my $e = $_pending_error) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 98 | 0 | $_pending_error = undef; | |||||||||||||||||||||||||||
| 99 | 0 | die $e; | |||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||
| 102 | 0 | ▶ | return if $_finished->is_ready; # discard all transfers | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 103 | 0 | return await $_client->_send( | |||||||||||||||||||||||||||
| 104 | $_proc, $_rpc_id, | ||||||||||||||||||||||||||||
| 105 | hole => { length => $length, flags => $flags } ); | ||||||||||||||||||||||||||||
| 106 | 1 | } | |||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||
| 108 | 0 | ▶ | async method abort() { | ||||||||||||||||||||||||||
|
Subroutine
abort: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 109 | 0 | ▶ | return if $_finished->is_ready; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 110 | 0 | $_client->_send_finish( $_proc, $_rpc_id, 1 ); | |||||||||||||||||||||||||||
| 111 | 0 | await $_finished; | |||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||
| 113 | 0 | $self->cleanup; | |||||||||||||||||||||||||||
| 114 | 0 | ▶ | if (my $e = $_pending_error) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 115 | 0 | $_pending_error = undef; | |||||||||||||||||||||||||||
| 116 | 0 | die $e; | |||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||
| 118 | 0 | return; | |||||||||||||||||||||||||||
| 119 | 1 | } | |||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||
| 121 | 0 | ▶ | method cleanup() { | ||||||||||||||||||||||||||
|
Subroutine
cleanup: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 122 | 0 | $_queue = undef; | |||||||||||||||||||||||||||
| 123 | 0 | ▶ | $_finished->done | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 124 | unless $_finished->is_ready; | ||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||
| 126 | 0 | return; | |||||||||||||||||||||||||||
| 127 | 1 | } | |||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||
| 129 | 0 | ▶ | async method finish() { | ||||||||||||||||||||||||||
|
Subroutine
finish: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 130 | 0 | ▶ | return if $_finished->is_ready; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 131 | 0 | $_client->_send_finish( $_proc, $_rpc_id, 0 ); | |||||||||||||||||||||||||||
| 132 | 0 | await $_finished; | |||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||
| 134 | 0 | $self->cleanup; | |||||||||||||||||||||||||||
| 135 | 0 | ▶ | if (my $e = $_pending_error) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 136 | 0 | $_pending_error = undef; | |||||||||||||||||||||||||||
| 137 | 0 | die $e; | |||||||||||||||||||||||||||
| 138 | } | ||||||||||||||||||||||||||||
| 139 | 0 | return; | |||||||||||||||||||||||||||
| 140 | 1 | } | |||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||
| 142 | 0 | ▶ | method DESTROY() { | ||||||||||||||||||||||||||
|
Subroutine
DESTROY: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 143 | 0 | ▶ | if (not $_finished->is_ready) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 144 | # abort the stream | ||||||||||||||||||||||||||||
| 145 | 0 | $_client->_send_finish( $_proc, $_rpc_id, 1 ); | |||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||
| 147 | 1 | } | |||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||
| 149 | 1 | 1; | |||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||
| 151 | __END__ | ||||||||||||||||||||||||||||