Added: hadoop/core/trunk/src/contrib/thriftfs/gen-php/hadoopfs_types.php URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/contrib/thriftfs/gen-php/hadoopfs_types.php?rev=690096&view=auto ============================================================================== --- hadoop/core/trunk/src/contrib/thriftfs/gen-php/hadoopfs_types.php (added) +++ hadoop/core/trunk/src/contrib/thriftfs/gen-php/hadoopfs_types.php Thu Aug 28 21:31:57 2008 @@ -0,0 +1,714 @@ +<?php +/** + * Autogenerated by Thrift + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + */ +include_once $GLOBALS['THRIFT_ROOT'].'/Thrift.php'; + + +class ThriftHandle { + static $_TSPEC; + + public $id = null; + + public function __construct($vals=null) { + if (!isset(self::$_TSPEC)) { + self::$_TSPEC = array( + -1 => array( + 'var' => 'id', + 'type' => TType::I64, + ), + ); + } + if (is_array($vals)) { + if (isset($vals['id'])) { + $this->id = $vals['id']; + } + } + } + + public function getName() { + return 'ThriftHandle'; + } + + public function read($input) + { + $xfer = 0; + $fname = null; + $ftype = 0; + $fid = 0; + $xfer += $input->readStructBegin($fname); + while (true) + { + $xfer += $input->readFieldBegin($fname, $ftype, $fid); + if ($ftype == TType::STOP) { + break; + } + switch ($fid) + { + case -1: + if ($ftype == TType::I64) { + $xfer += $input->readI64($this->id); + } else { + $xfer += $input->skip($ftype); + } + break; + default: + $xfer += $input->skip($ftype); + break; + } + $xfer += $input->readFieldEnd(); + } + $xfer += $input->readStructEnd(); + return $xfer; + } + + public function write($output) { + $xfer = 0; + $xfer += $output->writeStructBegin('ThriftHandle'); + if ($this->id !== null) { + $xfer += $output->writeFieldBegin('id', TType::I64, -1); + $xfer += $output->writeI64($this->id); + $xfer += $output->writeFieldEnd(); + } + $xfer += $output->writeFieldStop(); + $xfer += $output->writeStructEnd(); + return $xfer; + } + +} + +class Pathname { + static $_TSPEC; + + public $pathname = null; + + public function __construct($vals=null) { + if (!isset(self::$_TSPEC)) { + self::$_TSPEC = array( + -1 => array( + 'var' => 'pathname', + 'type' => TType::STRING, + ), + ); + } + if (is_array($vals)) { + if (isset($vals['pathname'])) { + $this->pathname = $vals['pathname']; + } + } + } + + public function getName() { + return 'Pathname'; + } + + public function read($input) + { + $xfer = 0; + $fname = null; + $ftype = 0; + $fid = 0; + $xfer += $input->readStructBegin($fname); + while (true) + { + $xfer += $input->readFieldBegin($fname, $ftype, $fid); + if ($ftype == TType::STOP) { + break; + } + switch ($fid) + { + case -1: + if ($ftype == TType::STRING) { + $xfer += $input->readString($this->pathname); + } else { + $xfer += $input->skip($ftype); + } + break; + default: + $xfer += $input->skip($ftype); + break; + } + $xfer += $input->readFieldEnd(); + } + $xfer += $input->readStructEnd(); + return $xfer; + } + + public function write($output) { + $xfer = 0; + $xfer += $output->writeStructBegin('Pathname'); + if ($this->pathname !== null) { + $xfer += $output->writeFieldBegin('pathname', TType::STRING, -1); + $xfer += $output->writeString($this->pathname); + $xfer += $output->writeFieldEnd(); + } + $xfer += $output->writeFieldStop(); + $xfer += $output->writeStructEnd(); + return $xfer; + } + +} + +class FileStatus { + static $_TSPEC; + + public $path = null; + public $length = null; + public $isdir = null; + public $block_replication = null; + public $blocksize = null; + public $modification_time = null; + public $permission = null; + public $owner = null; + public $group = null; + + public function __construct($vals=null) { + if (!isset(self::$_TSPEC)) { + self::$_TSPEC = array( + 1 => array( + 'var' => 'path', + 'type' => TType::STRING, + ), + 2 => array( + 'var' => 'length', + 'type' => TType::I64, + ), + 3 => array( + 'var' => 'isdir', + 'type' => TType::BOOL, + ), + 4 => array( + 'var' => 'block_replication', + 'type' => TType::I16, + ), + 5 => array( + 'var' => 'blocksize', + 'type' => TType::I64, + ), + 6 => array( + 'var' => 'modification_time', + 'type' => TType::I64, + ), + 7 => array( + 'var' => 'permission', + 'type' => TType::STRING, + ), + 8 => array( + 'var' => 'owner', + 'type' => TType::STRING, + ), + 9 => array( + 'var' => 'group', + 'type' => TType::STRING, + ), + ); + } + if (is_array($vals)) { + if (isset($vals['path'])) { + $this->path = $vals['path']; + } + if (isset($vals['length'])) { + $this->length = $vals['length']; + } + if (isset($vals['isdir'])) { + $this->isdir = $vals['isdir']; + } + if (isset($vals['block_replication'])) { + $this->block_replication = $vals['block_replication']; + } + if (isset($vals['blocksize'])) { + $this->blocksize = $vals['blocksize']; + } + if (isset($vals['modification_time'])) { + $this->modification_time = $vals['modification_time']; + } + if (isset($vals['permission'])) { + $this->permission = $vals['permission']; + } + if (isset($vals['owner'])) { + $this->owner = $vals['owner']; + } + if (isset($vals['group'])) { + $this->group = $vals['group']; + } + } + } + + public function getName() { + return 'FileStatus'; + } + + public function read($input) + { + $xfer = 0; + $fname = null; + $ftype = 0; + $fid = 0; + $xfer += $input->readStructBegin($fname); + while (true) + { + $xfer += $input->readFieldBegin($fname, $ftype, $fid); + if ($ftype == TType::STOP) { + break; + } + switch ($fid) + { + case 1: + if ($ftype == TType::STRING) { + $xfer += $input->readString($this->path); + } else { + $xfer += $input->skip($ftype); + } + break; + case 2: + if ($ftype == TType::I64) { + $xfer += $input->readI64($this->length); + } else { + $xfer += $input->skip($ftype); + } + break; + case 3: + if ($ftype == TType::BOOL) { + $xfer += $input->readBool($this->isdir); + } else { + $xfer += $input->skip($ftype); + } + break; + case 4: + if ($ftype == TType::I16) { + $xfer += $input->readI16($this->block_replication); + } else { + $xfer += $input->skip($ftype); + } + break; + case 5: + if ($ftype == TType::I64) { + $xfer += $input->readI64($this->blocksize); + } else { + $xfer += $input->skip($ftype); + } + break; + case 6: + if ($ftype == TType::I64) { + $xfer += $input->readI64($this->modification_time); + } else { + $xfer += $input->skip($ftype); + } + break; + case 7: + if ($ftype == TType::STRING) { + $xfer += $input->readString($this->permission); + } else { + $xfer += $input->skip($ftype); + } + break; + case 8: + if ($ftype == TType::STRING) { + $xfer += $input->readString($this->owner); + } else { + $xfer += $input->skip($ftype); + } + break; + case 9: + if ($ftype == TType::STRING) { + $xfer += $input->readString($this->group); + } else { + $xfer += $input->skip($ftype); + } + break; + default: + $xfer += $input->skip($ftype); + break; + } + $xfer += $input->readFieldEnd(); + } + $xfer += $input->readStructEnd(); + return $xfer; + } + + public function write($output) { + $xfer = 0; + $xfer += $output->writeStructBegin('FileStatus'); + if ($this->path !== null) { + $xfer += $output->writeFieldBegin('path', TType::STRING, 1); + $xfer += $output->writeString($this->path); + $xfer += $output->writeFieldEnd(); + } + if ($this->length !== null) { + $xfer += $output->writeFieldBegin('length', TType::I64, 2); + $xfer += $output->writeI64($this->length); + $xfer += $output->writeFieldEnd(); + } + if ($this->isdir !== null) { + $xfer += $output->writeFieldBegin('isdir', TType::BOOL, 3); + $xfer += $output->writeBool($this->isdir); + $xfer += $output->writeFieldEnd(); + } + if ($this->block_replication !== null) { + $xfer += $output->writeFieldBegin('block_replication', TType::I16, 4); + $xfer += $output->writeI16($this->block_replication); + $xfer += $output->writeFieldEnd(); + } + if ($this->blocksize !== null) { + $xfer += $output->writeFieldBegin('blocksize', TType::I64, 5); + $xfer += $output->writeI64($this->blocksize); + $xfer += $output->writeFieldEnd(); + } + if ($this->modification_time !== null) { + $xfer += $output->writeFieldBegin('modification_time', TType::I64, 6); + $xfer += $output->writeI64($this->modification_time); + $xfer += $output->writeFieldEnd(); + } + if ($this->permission !== null) { + $xfer += $output->writeFieldBegin('permission', TType::STRING, 7); + $xfer += $output->writeString($this->permission); + $xfer += $output->writeFieldEnd(); + } + if ($this->owner !== null) { + $xfer += $output->writeFieldBegin('owner', TType::STRING, 8); + $xfer += $output->writeString($this->owner); + $xfer += $output->writeFieldEnd(); + } + if ($this->group !== null) { + $xfer += $output->writeFieldBegin('group', TType::STRING, 9); + $xfer += $output->writeString($this->group); + $xfer += $output->writeFieldEnd(); + } + $xfer += $output->writeFieldStop(); + $xfer += $output->writeStructEnd(); + return $xfer; + } + +} + +class BlockLocation { + static $_TSPEC; + + public $hosts = null; + public $names = null; + public $offset = null; + public $length = null; + + public function __construct($vals=null) { + if (!isset(self::$_TSPEC)) { + self::$_TSPEC = array( + 1 => array( + 'var' => 'hosts', + 'type' => TType::LST, + 'etype' => TType::STRING, + 'elem' => array( + 'type' => TType::STRING, + ), + ), + 2 => array( + 'var' => 'names', + 'type' => TType::LST, + 'etype' => TType::STRING, + 'elem' => array( + 'type' => TType::STRING, + ), + ), + 3 => array( + 'var' => 'offset', + 'type' => TType::I64, + ), + 4 => array( + 'var' => 'length', + 'type' => TType::I64, + ), + ); + } + if (is_array($vals)) { + if (isset($vals['hosts'])) { + $this->hosts = $vals['hosts']; + } + if (isset($vals['names'])) { + $this->names = $vals['names']; + } + if (isset($vals['offset'])) { + $this->offset = $vals['offset']; + } + if (isset($vals['length'])) { + $this->length = $vals['length']; + } + } + } + + public function getName() { + return 'BlockLocation'; + } + + public function read($input) + { + $xfer = 0; + $fname = null; + $ftype = 0; + $fid = 0; + $xfer += $input->readStructBegin($fname); + while (true) + { + $xfer += $input->readFieldBegin($fname, $ftype, $fid); + if ($ftype == TType::STOP) { + break; + } + switch ($fid) + { + case 1: + if ($ftype == TType::LST) { + $this->hosts = array(); + $_size0 = 0; + $_etype3 = 0; + $xfer += $input->readListBegin($_etype3, $_size0); + for ($_i4 = 0; $_i4 < $_size0; ++$_i4) + { + $elem5 = null; + $xfer += $input->readString($elem5); + $this->hosts []= $elem5; + } + $xfer += $input->readListEnd(); + } else { + $xfer += $input->skip($ftype); + } + break; + case 2: + if ($ftype == TType::LST) { + $this->names = array(); + $_size6 = 0; + $_etype9 = 0; + $xfer += $input->readListBegin($_etype9, $_size6); + for ($_i10 = 0; $_i10 < $_size6; ++$_i10) + { + $elem11 = null; + $xfer += $input->readString($elem11); + $this->names []= $elem11; + } + $xfer += $input->readListEnd(); + } else { + $xfer += $input->skip($ftype); + } + break; + case 3: + if ($ftype == TType::I64) { + $xfer += $input->readI64($this->offset); + } else { + $xfer += $input->skip($ftype); + } + break; + case 4: + if ($ftype == TType::I64) { + $xfer += $input->readI64($this->length); + } else { + $xfer += $input->skip($ftype); + } + break; + default: + $xfer += $input->skip($ftype); + break; + } + $xfer += $input->readFieldEnd(); + } + $xfer += $input->readStructEnd(); + return $xfer; + } + + public function write($output) { + $xfer = 0; + $xfer += $output->writeStructBegin('BlockLocation'); + if ($this->hosts !== null) { + if (!is_array($this->hosts)) { + throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA); + } + $xfer += $output->writeFieldBegin('hosts', TType::LST, 1); + { + $output->writeListBegin(TType::STRING, count($this->hosts)); + { + foreach ($this->hosts as $iter12) + { + $xfer += $output->writeString($iter12); + } + } + $output->writeListEnd(); + } + $xfer += $output->writeFieldEnd(); + } + if ($this->names !== null) { + if (!is_array($this->names)) { + throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA); + } + $xfer += $output->writeFieldBegin('names', TType::LST, 2); + { + $output->writeListBegin(TType::STRING, count($this->names)); + { + foreach ($this->names as $iter13) + { + $xfer += $output->writeString($iter13); + } + } + $output->writeListEnd(); + } + $xfer += $output->writeFieldEnd(); + } + if ($this->offset !== null) { + $xfer += $output->writeFieldBegin('offset', TType::I64, 3); + $xfer += $output->writeI64($this->offset); + $xfer += $output->writeFieldEnd(); + } + if ($this->length !== null) { + $xfer += $output->writeFieldBegin('length', TType::I64, 4); + $xfer += $output->writeI64($this->length); + $xfer += $output->writeFieldEnd(); + } + $xfer += $output->writeFieldStop(); + $xfer += $output->writeStructEnd(); + return $xfer; + } + +} + +class MalformedInputException extends TException { + static $_TSPEC; + + public $message = null; + + public function __construct($vals=null) { + if (!isset(self::$_TSPEC)) { + self::$_TSPEC = array( + -1 => array( + 'var' => 'message', + 'type' => TType::STRING, + ), + ); + } + if (is_array($vals)) { + if (isset($vals['message'])) { + $this->message = $vals['message']; + } + } + } + + public function getName() { + return 'MalformedInputException'; + } + + public function read($input) + { + $xfer = 0; + $fname = null; + $ftype = 0; + $fid = 0; + $xfer += $input->readStructBegin($fname); + while (true) + { + $xfer += $input->readFieldBegin($fname, $ftype, $fid); + if ($ftype == TType::STOP) { + break; + } + switch ($fid) + { + case -1: + if ($ftype == TType::STRING) { + $xfer += $input->readString($this->message); + } else { + $xfer += $input->skip($ftype); + } + break; + default: + $xfer += $input->skip($ftype); + break; + } + $xfer += $input->readFieldEnd(); + } + $xfer += $input->readStructEnd(); + return $xfer; + } + + public function write($output) { + $xfer = 0; + $xfer += $output->writeStructBegin('MalformedInputException'); + if ($this->message !== null) { + $xfer += $output->writeFieldBegin('message', TType::STRING, -1); + $xfer += $output->writeString($this->message); + $xfer += $output->writeFieldEnd(); + } + $xfer += $output->writeFieldStop(); + $xfer += $output->writeStructEnd(); + return $xfer; + } + +} + +class ThriftIOException extends TException { + static $_TSPEC; + + public $message = null; + + public function __construct($vals=null) { + if (!isset(self::$_TSPEC)) { + self::$_TSPEC = array( + -1 => array( + 'var' => 'message', + 'type' => TType::STRING, + ), + ); + } + if (is_array($vals)) { + if (isset($vals['message'])) { + $this->message = $vals['message']; + } + } + } + + public function getName() { + return 'ThriftIOException'; + } + + public function read($input) + { + $xfer = 0; + $fname = null; + $ftype = 0; + $fid = 0; + $xfer += $input->readStructBegin($fname); + while (true) + { + $xfer += $input->readFieldBegin($fname, $ftype, $fid); + if ($ftype == TType::STOP) { + break; + } + switch ($fid) + { + case -1: + if ($ftype == TType::STRING) { + $xfer += $input->readString($this->message); + } else { + $xfer += $input->skip($ftype); + } + break; + default: + $xfer += $input->skip($ftype); + break; + } + $xfer += $input->readFieldEnd(); + } + $xfer += $input->readStructEnd(); + return $xfer; + } + + public function write($output) { + $xfer = 0; + $xfer += $output->writeStructBegin('ThriftIOException'); + if ($this->message !== null) { + $xfer += $output->writeFieldBegin('message', TType::STRING, -1); + $xfer += $output->writeString($this->message); + $xfer += $output->writeFieldEnd(); + } + $xfer += $output->writeFieldStop(); + $xfer += $output->writeStructEnd(); + return $xfer; + } + +} + +?>
Added: hadoop/core/trunk/src/contrib/thriftfs/gen-py/__init__.py URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/contrib/thriftfs/gen-py/__init__.py?rev=690096&view=auto ============================================================================== (empty) Added: hadoop/core/trunk/src/contrib/thriftfs/gen-py/hadoopfs/ThriftHadoopFileSystem-remote URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/contrib/thriftfs/gen-py/hadoopfs/ThriftHadoopFileSystem-remote?rev=690096&view=auto ============================================================================== --- hadoop/core/trunk/src/contrib/thriftfs/gen-py/hadoopfs/ThriftHadoopFileSystem-remote (added) +++ hadoop/core/trunk/src/contrib/thriftfs/gen-py/hadoopfs/ThriftHadoopFileSystem-remote Thu Aug 28 21:31:57 2008 @@ -0,0 +1,205 @@ +#!/usr/bin/env python +# +# Autogenerated by Thrift +# +# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +# + +import sys +import pprint +from urlparse import urlparse +from thrift.transport import TTransport +from thrift.transport import TSocket +from thrift.transport import THttpClient +from thrift.protocol import TBinaryProtocol + +import ThriftHadoopFileSystem +from ttypes import * + +if len(sys.argv) <= 1 or sys.argv[1] == '--help': + print '' + print 'Usage: ' + sys.argv[0] + ' [-h host:port] [-u url] [-f[ramed]] function [arg1 [arg2...]]' + print '' + print 'Functions:' + print ' void setInactivityTimeoutPeriod(i64 periodInSeconds)' + print ' void shutdown(i32 status)' + print ' ThriftHandle create(Pathname path)' + print ' ThriftHandle createFile(Pathname path, i16 mode, bool overwrite, i32 bufferSize, i16 block_replication, i64 blocksize)' + print ' ThriftHandle open(Pathname path)' + print ' ThriftHandle append(Pathname path)' + print ' bool write(ThriftHandle handle, string data)' + print ' string read(ThriftHandle handle, i64 offset, i32 size)' + print ' bool close(ThriftHandle out)' + print ' bool rm(Pathname path, bool recursive)' + print ' bool rename(Pathname path, Pathname dest)' + print ' bool mkdirs(Pathname path)' + print ' bool exists(Pathname path)' + print ' FileStatus stat(Pathname path)' + print ' listStatus(Pathname path)' + print ' void chmod(Pathname path, i16 mode)' + print ' void chown(Pathname path, string owner, string group)' + print ' void setReplication(Pathname path, i16 replication)' + print ' getFileBlockLocations(Pathname path, i64 start, i64 length)' + print '' + sys.exit(0) + +pp = pprint.PrettyPrinter(indent = 2) +host = 'localhost' +port = 9090 +uri = '' +framed = False +http = False +argi = 1 + +if sys.argv[argi] == '-h': + parts = sys.argv[argi+1].split(':') + host = parts[0] + port = int(parts[1]) + argi += 2 + +if sys.argv[argi] == '-u': + url = urlparse(sys.argv[argi+1]) + parts = url[1].split(':') + host = parts[0] + if len(parts) > 1: + port = int(parts[1]) + else: + port = 80 + uri = url[2] + http = True + argi += 2 + +if sys.argv[argi] == '-f' or sys.argv[argi] == '-framed': + framed = True + argi += 1 + +cmd = sys.argv[argi] +args = sys.argv[argi+1:] + +if http: + transport = THttpClient.THttpClient(host, port, uri) +else: + socket = TSocket.TSocket(host, port) + if framed: + transport = TTransport.TFramedTransport(socket) + else: + transport = TTransport.TBufferedTransport(socket) +protocol = TBinaryProtocol.TBinaryProtocol(transport) +client = ThriftHadoopFileSystem.Client(protocol) +transport.open() + +if cmd == 'setInactivityTimeoutPeriod': + if len(args) != 1: + print 'setInactivityTimeoutPeriod requires 1 args' + sys.exit(1) + pp.pprint(client.setInactivityTimeoutPeriod(eval(args[0]),)) + +elif cmd == 'shutdown': + if len(args) != 1: + print 'shutdown requires 1 args' + sys.exit(1) + pp.pprint(client.shutdown(eval(args[0]),)) + +elif cmd == 'create': + if len(args) != 1: + print 'create requires 1 args' + sys.exit(1) + pp.pprint(client.create(eval(args[0]),)) + +elif cmd == 'createFile': + if len(args) != 6: + print 'createFile requires 6 args' + sys.exit(1) + pp.pprint(client.createFile(eval(args[0]),eval(args[1]),eval(args[2]),eval(args[3]),eval(args[4]),eval(args[5]),)) + +elif cmd == 'open': + if len(args) != 1: + print 'open requires 1 args' + sys.exit(1) + pp.pprint(client.open(eval(args[0]),)) + +elif cmd == 'append': + if len(args) != 1: + print 'append requires 1 args' + sys.exit(1) + pp.pprint(client.append(eval(args[0]),)) + +elif cmd == 'write': + if len(args) != 2: + print 'write requires 2 args' + sys.exit(1) + pp.pprint(client.write(eval(args[0]),args[1],)) + +elif cmd == 'read': + if len(args) != 3: + print 'read requires 3 args' + sys.exit(1) + pp.pprint(client.read(eval(args[0]),eval(args[1]),eval(args[2]),)) + +elif cmd == 'close': + if len(args) != 1: + print 'close requires 1 args' + sys.exit(1) + pp.pprint(client.close(eval(args[0]),)) + +elif cmd == 'rm': + if len(args) != 2: + print 'rm requires 2 args' + sys.exit(1) + pp.pprint(client.rm(eval(args[0]),eval(args[1]),)) + +elif cmd == 'rename': + if len(args) != 2: + print 'rename requires 2 args' + sys.exit(1) + pp.pprint(client.rename(eval(args[0]),eval(args[1]),)) + +elif cmd == 'mkdirs': + if len(args) != 1: + print 'mkdirs requires 1 args' + sys.exit(1) + pp.pprint(client.mkdirs(eval(args[0]),)) + +elif cmd == 'exists': + if len(args) != 1: + print 'exists requires 1 args' + sys.exit(1) + pp.pprint(client.exists(eval(args[0]),)) + +elif cmd == 'stat': + if len(args) != 1: + print 'stat requires 1 args' + sys.exit(1) + pp.pprint(client.stat(eval(args[0]),)) + +elif cmd == 'listStatus': + if len(args) != 1: + print 'listStatus requires 1 args' + sys.exit(1) + pp.pprint(client.listStatus(eval(args[0]),)) + +elif cmd == 'chmod': + if len(args) != 2: + print 'chmod requires 2 args' + sys.exit(1) + pp.pprint(client.chmod(eval(args[0]),eval(args[1]),)) + +elif cmd == 'chown': + if len(args) != 3: + print 'chown requires 3 args' + sys.exit(1) + pp.pprint(client.chown(eval(args[0]),args[1],args[2],)) + +elif cmd == 'setReplication': + if len(args) != 2: + print 'setReplication requires 2 args' + sys.exit(1) + pp.pprint(client.setReplication(eval(args[0]),eval(args[1]),)) + +elif cmd == 'getFileBlockLocations': + if len(args) != 3: + print 'getFileBlockLocations requires 3 args' + sys.exit(1) + pp.pprint(client.getFileBlockLocations(eval(args[0]),eval(args[1]),eval(args[2]),)) + +transport.close() Propchange: hadoop/core/trunk/src/contrib/thriftfs/gen-py/hadoopfs/ThriftHadoopFileSystem-remote ------------------------------------------------------------------------------ svn:executable = *
