line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Licensed to the Apache Software Foundation (ASF) under one |
2
|
|
|
|
|
|
|
# or more contributor license agreements. See the NOTICE file |
3
|
|
|
|
|
|
|
# distributed with this work for additional information |
4
|
|
|
|
|
|
|
# regarding copyright ownership. The ASF licenses this file |
5
|
|
|
|
|
|
|
# to you under the Apache License, Version 2.0 (the |
6
|
|
|
|
|
|
|
# "License"); you may not use this file except in compliance |
7
|
|
|
|
|
|
|
# with the License. You may obtain a copy of the License at |
8
|
|
|
|
|
|
|
# |
9
|
|
|
|
|
|
|
# https://www.apache.org/licenses/LICENSE-2.0 |
10
|
|
|
|
|
|
|
# |
11
|
|
|
|
|
|
|
# Unless required by applicable law or agreed to in writing, |
12
|
|
|
|
|
|
|
# software distributed under the License is distributed on an |
13
|
|
|
|
|
|
|
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
14
|
|
|
|
|
|
|
# KIND, either express or implied. See the License for the |
15
|
|
|
|
|
|
|
# specific language governing permissions and limitations |
16
|
|
|
|
|
|
|
# under the License. |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
package Avro::Protocol::Message; |
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
1
|
|
8
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
31
|
|
21
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
8
|
|
|
1
|
|
|
|
|
24
|
|
22
|
|
|
|
|
|
|
|
23
|
1
|
|
|
1
|
|
465
|
use Avro::Schema; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
32
|
|
24
|
1
|
|
|
1
|
|
6
|
use Avro::Protocol; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
21
|
|
25
|
1
|
|
|
1
|
|
5
|
use Error; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
3
|
|
26
|
|
|
|
|
|
|
|
27
|
1
|
|
|
|
|
7
|
use Object::Tiny qw{ |
28
|
|
|
|
|
|
|
doc |
29
|
|
|
|
|
|
|
request |
30
|
|
|
|
|
|
|
response |
31
|
|
|
|
|
|
|
errors |
32
|
1
|
|
|
1
|
|
487
|
}; |
|
1
|
|
|
|
|
343
|
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
our $VERSION = '1.11.2'; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub new { |
37
|
1
|
|
|
1
|
0
|
2
|
my $class = shift; |
38
|
1
|
|
|
|
|
2
|
my $struct = shift; |
39
|
1
|
|
|
|
|
10
|
my $types = shift; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
my $resp_struct = $struct->{response} |
42
|
1
|
50
|
|
|
|
4
|
or throw Avro::Protocol::Error::Parse("response is missing"); |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
my $req_struct = $struct->{request} |
45
|
1
|
50
|
|
|
|
3
|
or throw Avro::Protocol::Error::Parse("request is missing"); |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
my $request = [ |
48
|
1
|
|
|
|
|
3
|
map { Avro::Schema::Field->new($_, $types) } @$req_struct |
|
1
|
|
|
|
|
3
|
|
49
|
|
|
|
|
|
|
]; |
50
|
|
|
|
|
|
|
|
51
|
1
|
|
|
|
|
3
|
my $err_struct = $struct->{errors}; |
52
|
|
|
|
|
|
|
|
53
|
1
|
|
|
|
|
3
|
my $response = Avro::Schema->parse_struct($resp_struct, $types); |
54
|
1
|
50
|
|
|
|
5
|
my $errors = $err_struct ? Avro::Schema->parse_struct($err_struct, $types) : undef; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
return $class->SUPER::new( |
57
|
|
|
|
|
|
|
doc => $struct->{doc}, |
58
|
1
|
|
|
|
|
6
|
request => $request, |
59
|
|
|
|
|
|
|
response => $response, |
60
|
|
|
|
|
|
|
errors => $errors, |
61
|
|
|
|
|
|
|
); |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
1; |