]>
git.proxmox.com Git - ceph.git/blob - ceph/src/jaegertracing/thrift/lib/perl/lib/Thrift/ProtocolDecorator.pm
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
10 # http://www.apache.org/licenses/LICENSE-2.0
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
27 package Thrift
::ProtocolDecorator
;
28 use base
qw(Thrift::Protocol);
29 use version
0.77; our $VERSION = version-
>declare("$Thrift::VERSION");
32 my $classname = shift;
34 my $self = $classname->SUPER::new
($protocol->getTransport());
36 $self->{concreteProtocol
} = $protocol;
38 return bless($self,$classname);
42 # Writes the message header
44 # @param string $name Function name
45 # @param int $type message type TMessageType::CALL or TMessageType::REPLY
46 # @param int $seqid The sequence id of this message
48 sub writeMessageBegin
{
50 my ($name, $type, $seqid) = @_;
52 return $self->{concreteProtocol
}->writeMessageBegin($name, $type, $seqid);
61 return $self->{concreteProtocol
}->writeMessageEnd();
65 # Writes a struct header.
67 # @param string $name Struct name
68 # @throws TException on write error
69 # @return int How many bytes written
71 sub writeStructBegin
{
75 return $self->{concreteProtocol
}->writeStructBegin($name);
81 # @throws TException on write error
82 # @return int How many bytes written
87 return $self->{concreteProtocol
}->writeStructEnd();
93 # @param string $name Field name
94 # @param int $type Field type
95 # @param int $fid Field id
96 # @throws TException on write error
97 # @return int How many bytes written
101 my ($fieldName, $fieldType, $fieldId) = @_;
103 return $self->{concreteProtocol
}->writeFieldBegin($fieldName, $fieldType, $fieldId);
109 return $self->{concreteProtocol
}->writeFieldEnd();
115 return $self->{concreteProtocol
}->writeFieldStop();
120 my ($keyType, $valType, $size) = @_;
122 return $self->{concreteProtocol
}->writeMapBegin($keyType, $valType, $size);
128 return $self->{concreteProtocol
}->writeMapEnd();
133 my ($elemType, $size) = @_;
135 return $self->{concreteProtocol
}->writeListBegin($elemType, $size);
141 return $self->{concreteProtocol
}->writeListEnd();
146 my ($elemType, $size) = @_;
148 return $self->{concreteProtocol
}->writeSetBegin($elemType, $size);
154 return $self->{concreteProtocol
}->writeListEnd();
161 return $self->{concreteProtocol
}->writeBool($bool);
168 return $self->{concreteProtocol
}->writeByte($byte);
175 return $self->{concreteProtocol
}->writeI16($i16);
182 return $self->{concreteProtocol
}->writeI32($i32);
190 return $self->{concreteProtocol
}->writeI64($i64);
197 return $self->{concreteProtocol
}->writeDouble($dub);
204 return $self->{concreteProtocol
}->writeString($str);
208 # Reads the message header
210 # @param string $name Function name
211 # @param int $type message type TMessageType::CALL or TMessageType::REPLY
212 # @parem int $seqid The sequence id of this message
217 my ($name, $type, $seqid) = @_;
219 return $self->{concreteProtocol
}->readMessageBegin($name, $type, $seqid);
223 # Read the close of message
229 return $self->{concreteProtocol
}->readMessageEnd();
237 return $self->{concreteProtocol
}->readStructBegin($name);
244 return $self->{concreteProtocol
}->readStructEnd();
250 my ($name, $fieldType, $fieldId) = @_;
252 return $self->{concreteProtocol
}->readFieldBegin($name, $fieldType, $fieldId);
259 return $self->{concreteProtocol
}->readFieldEnd();
265 my ($keyType, $valType, $size) = @_;
267 return $self->{concreteProtocol
}->readMapBegin($keyType, $valType, $size);
274 return $self->{concreteProtocol
}->readMapEnd();
280 my ($elemType, $size) = @_;
282 return $self->{concreteProtocol
}->readListBegin($elemType, $size);
289 return $self->{concreteProtocol
}->readListEnd();
295 my ($elemType, $size) = @_;
297 return $self->{concreteProtocol
}->readSetBegin($elemType, $size);
304 return $self->{concreteProtocol
}->readSetEnd();
312 return $self->{concreteProtocol
}->readBool($bool);
320 return $self->{concreteProtocol
}->readByte($byte);
328 return $self->{concreteProtocol
}->readI16($i16);
336 return $self->{concreteProtocol
}->readI32($i32);
344 return $self->{concreteProtocol
}->readI64($i64);
352 return $self->{concreteProtocol
}->readDouble($dub);
360 return $self->{concreteProtocol
}->readString($str);