| 1 | package OpenTracing::Role::ContextReference; | ||
| 2 | |||
| 3 | 3 | our $VERSION = 'v0.86.1'; | |
| 4 | |||
| 5 | 3 | ▶ | use Moo::Role; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 3 | ▶ | use MooX::Enumeration; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | 3 | ▶ | use MooX::ProtectedAttributes; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | 3 | ▶ | use MooX::Should; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | |||
| 10 | 3 | ▶ | use OpenTracing::Types qw/SpanContext/; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | 3 | ▶ | use Types::Standard qw/Enum/; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 12 | |||
| 13 | 3 | ▶ | use constant CHILD_OF => 'child_of'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 14 | 3 | ▶ | use constant FOLLOWS_FROM => 'follows_from'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 15 | |||
| 16 | 3 | protected_has reference_type => ( | |
| 17 | is => 'ro', | ||
| 18 | should => Enum[ CHILD_OF, FOLLOWS_FROM ], | ||
| 19 | ); | ||
| 20 | |||
| 21 | 3 | has referenced_context => ( | |
| 22 | is => 'ro', | ||
| 23 | should => SpanContext, | ||
| 24 | required => 1, | ||
| 25 | reader => 'get_referenced_context', | ||
| 26 | ); | ||
| 27 | |||
| 28 | 1 | ▶ | sub new_child_of { |
|
Subroutine
new_child_of: called CC=1 SCAR=0.0
Pod
documented
| |||
| 29 | 1 | $_[0]->new( | |
| 30 | reference_type => CHILD_OF, | ||
| 31 | referenced_context => $_[1], | ||
| 32 | ) | ||
| 33 | } | ||
| 34 | |||
| 35 | 1 | ▶ | sub type_is_child_of { $_[0]->reference_type eq CHILD_OF } |
|
Subroutine
type_is_child_of: called CC=1 SCAR=0.0
Pod
documented
| |||
| 36 | |||
| 37 | 1 | ▶ | sub new_follows_from { |
|
Subroutine
new_follows_from: called CC=1 SCAR=0.0
Pod
documented
| |||
| 38 | 1 | $_[0]->new( | |
| 39 | reference_type => FOLLOWS_FROM, | ||
| 40 | referenced_context => $_[1], | ||
| 41 | ) | ||
| 42 | } | ||
| 43 | |||
| 44 | 1 | ▶ | sub type_is_follows_from { $_[0]->reference_type eq FOLLOWS_FROM } |
|
Subroutine
type_is_follows_from: called CC=1 SCAR=0.0
Pod
documented
| |||
| 45 | |||
| 46 | |||
| 47 | |||
| 48 | 3 | ▶ | BEGIN { |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 49 | 3 | with 'OpenTracing::Interface::ContextReference' | |
| 50 | } | ||
| 51 | |||
| 52 | |||
| 53 | |||
| 54 | 3 | 1; | |