Virt/Callback.pm

filter: Statementstmt 52.4% 43 / 82 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 58.8% 10 / 17 Podpod 40.0% 2 / 5 totaltotal 49.1% 55 / 112 CC 5 SCAR 10.5
CC
5
Cov
48%
cancel
6.0
cleanup
6.0
_dispatch_event
6.0
CRAP 2.9
« Virt/Connection/Local.pm ↑ Summary Virt/Connection/Process.pm »
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 qw/ signatures /;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 1 ▶use Feature::Compat::Try;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 1 ▶use Future::AsyncAwait;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 1 ▶use Object::Pad 0.821;
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 class Sys::Async::Virt::Callback v0.6.9;
21  
22  
23 1 ▶use Carp qw(croak);
Subroutine BEGIN: called CC=1 SCAR=0.0
24 1 ▶use Future::Queue;
Subroutine BEGIN: called CC=1 SCAR=0.0
25 1 ▶use Log::Any qw($log);
Subroutine BEGIN: called CC=1 SCAR=0.0
26  
27 1 ▶use Protocol::Sys::Virt::Remote::XDR v12.9.0;
Subroutine BEGIN: called CC=1 SCAR=0.0
28 1 my $remote = 'Protocol::Sys::Virt::Remote::XDR';
29  
30 0 ▶field $_rpc_id :reader :param;
Subroutine rpc_id: not called CC=1 SCAR=2.6
Pod undocumented
31 0 ▶field $_client :reader :param;
Subroutine client: not called CC=1 SCAR=2.6
Pod undocumented
32 1 field $_deregister_call :param;
33 1 field $_queue;
34 1 field $_cancelled;
35  
36 ADJUST :params (:$queue_len //= 12, :$factory) {
37 $_queue = Future::Queue->new(
38 max_items => $queue_len,
39 prototype => $factory
40 );
41 }
42  
43 0 ▶async method next_event() {
Subroutine next_event: not called CC=2 SCAR=15.7
Pod documented
44 0 ▶ return unless $_queue; # simulate an empty queue
Branch: 1 branch
BranchTrueFalseTotal
unless $_queue 0 0 0
45 0 return await $_queue->shift;
46 1 }
47  
48 0 ▶async method cancel() {
Subroutine cancel: not called CC=2 SCAR=17.9
Pod documented
49 0 ▶ return await $_cancelled if $_cancelled;
Branch: 1 branch
BranchTrueFalseTotal
if $_cancelled 0 0 0
50  
51 0 $_cancelled = $_client->loop->new_future;
52 0 $self->cleanup;
53 0 await $_cancelled;
54  
55 0 return;
56 1 }
57  
58 0 ▶method cleanup() {
Subroutine cleanup: not called CC=2 SCAR=17.9
Pod undocumented
59 0 ▶ return unless $_queue;
Branch: 1 branch
BranchTrueFalseTotal
unless $_queue 0 0 0
60  
61 0 $_queue->finish;
62 0 $_queue = undef;
63 0 $_client->_deregister_callback(
64 $_cancelled,
65 $_deregister_call,
66 $_rpc_id );
67  
68 0 return;
69 1 }
70  
71 0 ▶method _dispatch_event($event) {
Subroutine _dispatch_event: not called CC=2 SCAR=17.9
72 0 ▶ return if $_cancelled;
Branch: 1 branch
BranchTrueFalseTotal
if $_cancelled 0 0 0
73  
74 0 try {
75 0 $_queue->push($event);
76 }
77 catch ($e) {
78 0 $self->cleanup;
79 }
80 1 }
81  
82 0 ▶method DESTROY() {
Subroutine DESTROY: not called CC=1 SCAR=6.9
83 0 $self->cleanup;
84 1 }
85  
86  
87 1 1;
88  
89 __END__
« Virt/Connection/Local.pm ↑ Summary Virt/Connection/Process.pm »