Types.pm
上传用户:quxuerui
上传日期:2018-01-08
资源大小:41811k
文件大小:15k
- #
- # Autogenerated by Thrift
- #
- # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- #
- require 5.6.0;
- use strict;
- use warnings;
- use Thrift;
- package ThriftHandle;
- use base('Class::Accessor');
- ThriftHandle->mk_accessors( qw( id ) );
- sub new {
- my $classname = shift;
- my $self = {};
- my $vals = shift || {};
- $self->{id} = undef;
- if (UNIVERSAL::isa($vals,'HASH')) {
- if (defined $vals->{id}) {
- $self->{id} = $vals->{id};
- }
- }
- return bless($self,$classname);
- }
- sub getName {
- return 'ThriftHandle';
- }
- sub read {
- my $self = shift;
- my $input = shift;
- my $xfer = 0;
- my $fname;
- my $ftype = 0;
- my $fid = 0;
- $xfer += $input->readStructBegin($fname);
- while (1)
- {
- $xfer += $input->readFieldBegin($fname, $ftype, $fid);
- if ($ftype == TType::STOP) {
- last;
- }
- SWITCH: for($fid)
- {
- /^-1$/ && do{ if ($ftype == TType::I64) {
- $xfer += $input->readI64($self->{id});
- } else {
- $xfer += $input->skip($ftype);
- }
- last; };
- $xfer += $input->skip($ftype);
- }
- $xfer += $input->readFieldEnd();
- }
- $xfer += $input->readStructEnd();
- return $xfer;
- }
- sub write {
- my $self = shift;
- my $output = shift;
- my $xfer = 0;
- $xfer += $output->writeStructBegin('ThriftHandle');
- if (defined $self->{id}) {
- $xfer += $output->writeFieldBegin('id', TType::I64, -1);
- $xfer += $output->writeI64($self->{id});
- $xfer += $output->writeFieldEnd();
- }
- $xfer += $output->writeFieldStop();
- $xfer += $output->writeStructEnd();
- return $xfer;
- }
- package Pathname;
- use base('Class::Accessor');
- Pathname->mk_accessors( qw( pathname ) );
- sub new {
- my $classname = shift;
- my $self = {};
- my $vals = shift || {};
- $self->{pathname} = undef;
- if (UNIVERSAL::isa($vals,'HASH')) {
- if (defined $vals->{pathname}) {
- $self->{pathname} = $vals->{pathname};
- }
- }
- return bless($self,$classname);
- }
- sub getName {
- return 'Pathname';
- }
- sub read {
- my $self = shift;
- my $input = shift;
- my $xfer = 0;
- my $fname;
- my $ftype = 0;
- my $fid = 0;
- $xfer += $input->readStructBegin($fname);
- while (1)
- {
- $xfer += $input->readFieldBegin($fname, $ftype, $fid);
- if ($ftype == TType::STOP) {
- last;
- }
- SWITCH: for($fid)
- {
- /^-1$/ && do{ if ($ftype == TType::STRING) {
- $xfer += $input->readString($self->{pathname});
- } else {
- $xfer += $input->skip($ftype);
- }
- last; };
- $xfer += $input->skip($ftype);
- }
- $xfer += $input->readFieldEnd();
- }
- $xfer += $input->readStructEnd();
- return $xfer;
- }
- sub write {
- my $self = shift;
- my $output = shift;
- my $xfer = 0;
- $xfer += $output->writeStructBegin('Pathname');
- if (defined $self->{pathname}) {
- $xfer += $output->writeFieldBegin('pathname', TType::STRING, -1);
- $xfer += $output->writeString($self->{pathname});
- $xfer += $output->writeFieldEnd();
- }
- $xfer += $output->writeFieldStop();
- $xfer += $output->writeStructEnd();
- return $xfer;
- }
- package FileStatus;
- use base('Class::Accessor');
- FileStatus->mk_accessors( qw( path length isdir block_replication blocksize modification_time permission owner group ) );
- sub new {
- my $classname = shift;
- my $self = {};
- my $vals = shift || {};
- $self->{path} = undef;
- $self->{length} = undef;
- $self->{isdir} = undef;
- $self->{block_replication} = undef;
- $self->{blocksize} = undef;
- $self->{modification_time} = undef;
- $self->{permission} = undef;
- $self->{owner} = undef;
- $self->{group} = undef;
- if (UNIVERSAL::isa($vals,'HASH')) {
- if (defined $vals->{path}) {
- $self->{path} = $vals->{path};
- }
- if (defined $vals->{length}) {
- $self->{length} = $vals->{length};
- }
- if (defined $vals->{isdir}) {
- $self->{isdir} = $vals->{isdir};
- }
- if (defined $vals->{block_replication}) {
- $self->{block_replication} = $vals->{block_replication};
- }
- if (defined $vals->{blocksize}) {
- $self->{blocksize} = $vals->{blocksize};
- }
- if (defined $vals->{modification_time}) {
- $self->{modification_time} = $vals->{modification_time};
- }
- if (defined $vals->{permission}) {
- $self->{permission} = $vals->{permission};
- }
- if (defined $vals->{owner}) {
- $self->{owner} = $vals->{owner};
- }
- if (defined $vals->{group}) {
- $self->{group} = $vals->{group};
- }
- }
- return bless($self,$classname);
- }
- sub getName {
- return 'FileStatus';
- }
- sub read {
- my $self = shift;
- my $input = shift;
- my $xfer = 0;
- my $fname;
- my $ftype = 0;
- my $fid = 0;
- $xfer += $input->readStructBegin($fname);
- while (1)
- {
- $xfer += $input->readFieldBegin($fname, $ftype, $fid);
- if ($ftype == TType::STOP) {
- last;
- }
- SWITCH: for($fid)
- {
- /^1$/ && do{ if ($ftype == TType::STRING) {
- $xfer += $input->readString($self->{path});
- } else {
- $xfer += $input->skip($ftype);
- }
- last; };
- /^2$/ && do{ if ($ftype == TType::I64) {
- $xfer += $input->readI64($self->{length});
- } else {
- $xfer += $input->skip($ftype);
- }
- last; };
- /^3$/ && do{ if ($ftype == TType::BOOL) {
- $xfer += $input->readBool($self->{isdir});
- } else {
- $xfer += $input->skip($ftype);
- }
- last; };
- /^4$/ && do{ if ($ftype == TType::I16) {
- $xfer += $input->readI16($self->{block_replication});
- } else {
- $xfer += $input->skip($ftype);
- }
- last; };
- /^5$/ && do{ if ($ftype == TType::I64) {
- $xfer += $input->readI64($self->{blocksize});
- } else {
- $xfer += $input->skip($ftype);
- }
- last; };
- /^6$/ && do{ if ($ftype == TType::I64) {
- $xfer += $input->readI64($self->{modification_time});
- } else {
- $xfer += $input->skip($ftype);
- }
- last; };
- /^7$/ && do{ if ($ftype == TType::STRING) {
- $xfer += $input->readString($self->{permission});
- } else {
- $xfer += $input->skip($ftype);
- }
- last; };
- /^8$/ && do{ if ($ftype == TType::STRING) {
- $xfer += $input->readString($self->{owner});
- } else {
- $xfer += $input->skip($ftype);
- }
- last; };
- /^9$/ && do{ if ($ftype == TType::STRING) {
- $xfer += $input->readString($self->{group});
- } else {
- $xfer += $input->skip($ftype);
- }
- last; };
- $xfer += $input->skip($ftype);
- }
- $xfer += $input->readFieldEnd();
- }
- $xfer += $input->readStructEnd();
- return $xfer;
- }
- sub write {
- my $self = shift;
- my $output = shift;
- my $xfer = 0;
- $xfer += $output->writeStructBegin('FileStatus');
- if (defined $self->{path}) {
- $xfer += $output->writeFieldBegin('path', TType::STRING, 1);
- $xfer += $output->writeString($self->{path});
- $xfer += $output->writeFieldEnd();
- }
- if (defined $self->{length}) {
- $xfer += $output->writeFieldBegin('length', TType::I64, 2);
- $xfer += $output->writeI64($self->{length});
- $xfer += $output->writeFieldEnd();
- }
- if (defined $self->{isdir}) {
- $xfer += $output->writeFieldBegin('isdir', TType::BOOL, 3);
- $xfer += $output->writeBool($self->{isdir});
- $xfer += $output->writeFieldEnd();
- }
- if (defined $self->{block_replication}) {
- $xfer += $output->writeFieldBegin('block_replication', TType::I16, 4);
- $xfer += $output->writeI16($self->{block_replication});
- $xfer += $output->writeFieldEnd();
- }
- if (defined $self->{blocksize}) {
- $xfer += $output->writeFieldBegin('blocksize', TType::I64, 5);
- $xfer += $output->writeI64($self->{blocksize});
- $xfer += $output->writeFieldEnd();
- }
- if (defined $self->{modification_time}) {
- $xfer += $output->writeFieldBegin('modification_time', TType::I64, 6);
- $xfer += $output->writeI64($self->{modification_time});
- $xfer += $output->writeFieldEnd();
- }
- if (defined $self->{permission}) {
- $xfer += $output->writeFieldBegin('permission', TType::STRING, 7);
- $xfer += $output->writeString($self->{permission});
- $xfer += $output->writeFieldEnd();
- }
- if (defined $self->{owner}) {
- $xfer += $output->writeFieldBegin('owner', TType::STRING, 8);
- $xfer += $output->writeString($self->{owner});
- $xfer += $output->writeFieldEnd();
- }
- if (defined $self->{group}) {
- $xfer += $output->writeFieldBegin('group', TType::STRING, 9);
- $xfer += $output->writeString($self->{group});
- $xfer += $output->writeFieldEnd();
- }
- $xfer += $output->writeFieldStop();
- $xfer += $output->writeStructEnd();
- return $xfer;
- }
- package BlockLocation;
- use base('Class::Accessor');
- BlockLocation->mk_accessors( qw( hosts names offset length ) );
- sub new {
- my $classname = shift;
- my $self = {};
- my $vals = shift || {};
- $self->{hosts} = undef;
- $self->{names} = undef;
- $self->{offset} = undef;
- $self->{length} = undef;
- if (UNIVERSAL::isa($vals,'HASH')) {
- if (defined $vals->{hosts}) {
- $self->{hosts} = $vals->{hosts};
- }
- if (defined $vals->{names}) {
- $self->{names} = $vals->{names};
- }
- if (defined $vals->{offset}) {
- $self->{offset} = $vals->{offset};
- }
- if (defined $vals->{length}) {
- $self->{length} = $vals->{length};
- }
- }
- return bless($self,$classname);
- }
- sub getName {
- return 'BlockLocation';
- }
- sub read {
- my $self = shift;
- my $input = shift;
- my $xfer = 0;
- my $fname;
- my $ftype = 0;
- my $fid = 0;
- $xfer += $input->readStructBegin($fname);
- while (1)
- {
- $xfer += $input->readFieldBegin($fname, $ftype, $fid);
- if ($ftype == TType::STOP) {
- last;
- }
- SWITCH: for($fid)
- {
- /^1$/ && do{ if ($ftype == TType::LIST) {
- {
- my $_size0 = 0;
- $self->{hosts} = [];
- my $_etype3 = 0;
- $xfer += $input->readListBegin($_etype3, $_size0);
- for (my $_i4 = 0; $_i4 < $_size0; ++$_i4)
- {
- my $elem5 = undef;
- $xfer += $input->readString($elem5);
- push(@{$self->{hosts}},$elem5);
- }
- $xfer += $input->readListEnd();
- }
- } else {
- $xfer += $input->skip($ftype);
- }
- last; };
- /^2$/ && do{ if ($ftype == TType::LIST) {
- {
- my $_size6 = 0;
- $self->{names} = [];
- my $_etype9 = 0;
- $xfer += $input->readListBegin($_etype9, $_size6);
- for (my $_i10 = 0; $_i10 < $_size6; ++$_i10)
- {
- my $elem11 = undef;
- $xfer += $input->readString($elem11);
- push(@{$self->{names}},$elem11);
- }
- $xfer += $input->readListEnd();
- }
- } else {
- $xfer += $input->skip($ftype);
- }
- last; };
- /^3$/ && do{ if ($ftype == TType::I64) {
- $xfer += $input->readI64($self->{offset});
- } else {
- $xfer += $input->skip($ftype);
- }
- last; };
- /^4$/ && do{ if ($ftype == TType::I64) {
- $xfer += $input->readI64($self->{length});
- } else {
- $xfer += $input->skip($ftype);
- }
- last; };
- $xfer += $input->skip($ftype);
- }
- $xfer += $input->readFieldEnd();
- }
- $xfer += $input->readStructEnd();
- return $xfer;
- }
- sub write {
- my $self = shift;
- my $output = shift;
- my $xfer = 0;
- $xfer += $output->writeStructBegin('BlockLocation');
- if (defined $self->{hosts}) {
- $xfer += $output->writeFieldBegin('hosts', TType::LIST, 1);
- {
- $output->writeListBegin(TType::STRING, scalar(@{$self->{hosts}}));
- {
- foreach my $iter12 (@{$self->{hosts}})
- {
- $xfer += $output->writeString($iter12);
- }
- }
- $output->writeListEnd();
- }
- $xfer += $output->writeFieldEnd();
- }
- if (defined $self->{names}) {
- $xfer += $output->writeFieldBegin('names', TType::LIST, 2);
- {
- $output->writeListBegin(TType::STRING, scalar(@{$self->{names}}));
- {
- foreach my $iter13 (@{$self->{names}})
- {
- $xfer += $output->writeString($iter13);
- }
- }
- $output->writeListEnd();
- }
- $xfer += $output->writeFieldEnd();
- }
- if (defined $self->{offset}) {
- $xfer += $output->writeFieldBegin('offset', TType::I64, 3);
- $xfer += $output->writeI64($self->{offset});
- $xfer += $output->writeFieldEnd();
- }
- if (defined $self->{length}) {
- $xfer += $output->writeFieldBegin('length', TType::I64, 4);
- $xfer += $output->writeI64($self->{length});
- $xfer += $output->writeFieldEnd();
- }
- $xfer += $output->writeFieldStop();
- $xfer += $output->writeStructEnd();
- return $xfer;
- }
- package MalformedInputException;
- use base('Thrift::TException');
- use base('Class::Accessor');
- MalformedInputException->mk_accessors( qw( message ) );
- sub new {
- my $classname = shift;
- my $self = {};
- my $vals = shift || {};
- $self->{message} = undef;
- if (UNIVERSAL::isa($vals,'HASH')) {
- if (defined $vals->{message}) {
- $self->{message} = $vals->{message};
- }
- }
- return bless($self,$classname);
- }
- sub getName {
- return 'MalformedInputException';
- }
- sub read {
- my $self = shift;
- my $input = shift;
- my $xfer = 0;
- my $fname;
- my $ftype = 0;
- my $fid = 0;
- $xfer += $input->readStructBegin($fname);
- while (1)
- {
- $xfer += $input->readFieldBegin($fname, $ftype, $fid);
- if ($ftype == TType::STOP) {
- last;
- }
- SWITCH: for($fid)
- {
- /^-1$/ && do{ if ($ftype == TType::STRING) {
- $xfer += $input->readString($self->{message});
- } else {
- $xfer += $input->skip($ftype);
- }
- last; };
- $xfer += $input->skip($ftype);
- }
- $xfer += $input->readFieldEnd();
- }
- $xfer += $input->readStructEnd();
- return $xfer;
- }
- sub write {
- my $self = shift;
- my $output = shift;
- my $xfer = 0;
- $xfer += $output->writeStructBegin('MalformedInputException');
- if (defined $self->{message}) {
- $xfer += $output->writeFieldBegin('message', TType::STRING, -1);
- $xfer += $output->writeString($self->{message});
- $xfer += $output->writeFieldEnd();
- }
- $xfer += $output->writeFieldStop();
- $xfer += $output->writeStructEnd();
- return $xfer;
- }
- package ThriftIOException;
- use base('Thrift::TException');
- use base('Class::Accessor');
- ThriftIOException->mk_accessors( qw( message ) );
- sub new {
- my $classname = shift;
- my $self = {};
- my $vals = shift || {};
- $self->{message} = undef;
- if (UNIVERSAL::isa($vals,'HASH')) {
- if (defined $vals->{message}) {
- $self->{message} = $vals->{message};
- }
- }
- return bless($self,$classname);
- }
- sub getName {
- return 'ThriftIOException';
- }
- sub read {
- my $self = shift;
- my $input = shift;
- my $xfer = 0;
- my $fname;
- my $ftype = 0;
- my $fid = 0;
- $xfer += $input->readStructBegin($fname);
- while (1)
- {
- $xfer += $input->readFieldBegin($fname, $ftype, $fid);
- if ($ftype == TType::STOP) {
- last;
- }
- SWITCH: for($fid)
- {
- /^-1$/ && do{ if ($ftype == TType::STRING) {
- $xfer += $input->readString($self->{message});
- } else {
- $xfer += $input->skip($ftype);
- }
- last; };
- $xfer += $input->skip($ftype);
- }
- $xfer += $input->readFieldEnd();
- }
- $xfer += $input->readStructEnd();
- return $xfer;
- }
- sub write {
- my $self = shift;
- my $output = shift;
- my $xfer = 0;
- $xfer += $output->writeStructBegin('ThriftIOException');
- if (defined $self->{message}) {
- $xfer += $output->writeFieldBegin('message', TType::STRING, -1);
- $xfer += $output->writeString($self->{message});
- $xfer += $output->writeFieldEnd();
- }
- $xfer += $output->writeFieldStop();
- $xfer += $output->writeStructEnd();
- return $xfer;
- }
- 1;