line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# Licensed to the Apache Software Foundation (ASF) under one |
3
|
|
|
|
|
|
|
# or more contributor license agreements. See the NOTICE file |
4
|
|
|
|
|
|
|
# distributed with this work for additional information |
5
|
|
|
|
|
|
|
# regarding copyright ownership. The ASF licenses this file |
6
|
|
|
|
|
|
|
# to you under the Apache License, Version 2.0 (the |
7
|
|
|
|
|
|
|
# "License"); you may not use this file except in compliance |
8
|
|
|
|
|
|
|
# with the License. You may obtain a copy of the License at |
9
|
|
|
|
|
|
|
# |
10
|
|
|
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0 |
11
|
|
|
|
|
|
|
# |
12
|
|
|
|
|
|
|
# Unless required by applicable law or agreed to in writing, |
13
|
|
|
|
|
|
|
# software distributed under the License is distributed on an |
14
|
|
|
|
|
|
|
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
15
|
|
|
|
|
|
|
# KIND, either express or implied. See the License for the |
16
|
|
|
|
|
|
|
# specific language governing permissions and limitations |
17
|
|
|
|
|
|
|
# under the License. |
18
|
|
|
|
|
|
|
# |
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
1
|
|
10
|
use 5.10.0; |
|
1
|
|
|
|
|
2
|
|
21
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
15
|
|
22
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
17
|
|
23
|
|
|
|
|
|
|
|
24
|
1
|
|
|
1
|
|
12
|
use Thrift; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
16
|
|
25
|
1
|
|
|
1
|
|
3
|
use Thrift::Exception; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
27
|
|
26
|
1
|
|
|
1
|
|
5
|
use Thrift::Transport; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
23
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
package Thrift::BufferedTransport; |
29
|
1
|
|
|
1
|
|
4
|
use base('Thrift::Transport'); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
84
|
|
30
|
1
|
|
|
1
|
|
6
|
use version 0.77; our $VERSION = version->declare("$Thrift::VERSION"); |
|
1
|
|
|
|
|
10
|
|
|
1
|
|
|
|
|
4
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub new |
33
|
|
|
|
|
|
|
{ |
34
|
0
|
|
|
0
|
0
|
|
my $classname = shift; |
35
|
0
|
|
|
|
|
|
my $transport = shift; |
36
|
0
|
|
0
|
|
|
|
my $rBufSize = shift || 512; |
37
|
0
|
|
0
|
|
|
|
my $wBufSize = shift || 512; |
38
|
|
|
|
|
|
|
|
39
|
0
|
|
|
|
|
|
my $self = { |
40
|
|
|
|
|
|
|
transport => $transport, |
41
|
|
|
|
|
|
|
rBufSize => $rBufSize, |
42
|
|
|
|
|
|
|
wBufSize => $wBufSize, |
43
|
|
|
|
|
|
|
wBuf => '', |
44
|
|
|
|
|
|
|
rBuf => '', |
45
|
|
|
|
|
|
|
}; |
46
|
|
|
|
|
|
|
|
47
|
0
|
|
|
|
|
|
return bless($self,$classname); |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub isOpen |
51
|
|
|
|
|
|
|
{ |
52
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
53
|
|
|
|
|
|
|
|
54
|
0
|
|
|
|
|
|
return $self->{transport}->isOpen(); |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub open |
58
|
|
|
|
|
|
|
{ |
59
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
60
|
0
|
|
|
|
|
|
$self->{transport}->open(); |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub close() |
64
|
|
|
|
|
|
|
{ |
65
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
66
|
0
|
|
|
|
|
|
$self->{transport}->close(); |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub readAll |
70
|
|
|
|
|
|
|
{ |
71
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
72
|
0
|
|
|
|
|
|
my $len = shift; |
73
|
|
|
|
|
|
|
|
74
|
0
|
|
|
|
|
|
return $self->{transport}->readAll($len); |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub read |
78
|
|
|
|
|
|
|
{ |
79
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
80
|
0
|
|
|
|
|
|
my $len = shift; |
81
|
0
|
|
|
|
|
|
my $ret; |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
# Methinks Perl is already buffering these for us |
84
|
0
|
|
|
|
|
|
return $self->{transport}->read($len); |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub write |
88
|
|
|
|
|
|
|
{ |
89
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
90
|
0
|
|
|
|
|
|
my $buf = shift; |
91
|
|
|
|
|
|
|
|
92
|
0
|
|
|
|
|
|
$self->{wBuf} .= $buf; |
93
|
0
|
0
|
|
|
|
|
if (length($self->{wBuf}) >= $self->{wBufSize}) { |
94
|
0
|
|
|
|
|
|
$self->{transport}->write($self->{wBuf}); |
95
|
0
|
|
|
|
|
|
$self->{wBuf} = ''; |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
sub flush |
100
|
|
|
|
|
|
|
{ |
101
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
102
|
|
|
|
|
|
|
|
103
|
0
|
0
|
|
|
|
|
if (length($self->{wBuf}) > 0) { |
104
|
0
|
|
|
|
|
|
$self->{transport}->write($self->{wBuf}); |
105
|
0
|
|
|
|
|
|
$self->{wBuf} = ''; |
106
|
|
|
|
|
|
|
} |
107
|
0
|
|
|
|
|
|
$self->{transport}->flush(); |
108
|
|
|
|
|
|
|
} |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
# |
112
|
|
|
|
|
|
|
# BufferedTransport factory creates buffered transport objects from transports |
113
|
|
|
|
|
|
|
# |
114
|
|
|
|
|
|
|
package Thrift::BufferedTransportFactory; |
115
|
1
|
|
|
1
|
|
434
|
use version 0.77; our $VERSION = version->declare("$Thrift::VERSION"); |
|
1
|
|
|
|
|
11
|
|
|
1
|
|
|
|
|
4
|
|
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
sub new { |
118
|
0
|
|
|
0
|
|
|
my $classname = shift; |
119
|
0
|
|
|
|
|
|
my $self = {}; |
120
|
|
|
|
|
|
|
|
121
|
0
|
|
|
|
|
|
return bless($self,$classname); |
122
|
|
|
|
|
|
|
} |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
# |
125
|
|
|
|
|
|
|
# Build a buffered transport from the base transport |
126
|
|
|
|
|
|
|
# |
127
|
|
|
|
|
|
|
# @return Thrift::BufferedTransport transport |
128
|
|
|
|
|
|
|
# |
129
|
|
|
|
|
|
|
sub getTransport |
130
|
|
|
|
|
|
|
{ |
131
|
0
|
|
|
0
|
|
|
my $self = shift; |
132
|
0
|
|
|
|
|
|
my $trans = shift; |
133
|
|
|
|
|
|
|
|
134
|
0
|
|
|
|
|
|
my $buffered = Thrift::BufferedTransport->new($trans); |
135
|
0
|
|
|
|
|
|
return $buffered; |
136
|
|
|
|
|
|
|
} |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
1; |