Return-Path: Delivered-To: apmail-hadoop-core-commits-archive@www.apache.org Received: (qmail 11464 invoked from network); 29 Aug 2008 04:33:56 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 29 Aug 2008 04:33:56 -0000 Received: (qmail 37117 invoked by uid 500); 29 Aug 2008 04:33:54 -0000 Delivered-To: apmail-hadoop-core-commits-archive@hadoop.apache.org Received: (qmail 37097 invoked by uid 500); 29 Aug 2008 04:33:54 -0000 Mailing-List: contact core-commits-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: core-dev@hadoop.apache.org Delivered-To: mailing list core-commits@hadoop.apache.org Received: (qmail 37088 invoked by uid 99); 29 Aug 2008 04:33:53 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 28 Aug 2008 21:33:53 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 29 Aug 2008 04:32:54 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 2A3C22388A8D; Thu, 28 Aug 2008 21:32:03 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r690096 [14/15] - in /hadoop/core/trunk: ./ src/contrib/thriftfs/ src/contrib/thriftfs/gen-cocoa/ src/contrib/thriftfs/gen-cpp/ src/contrib/thriftfs/gen-java/ src/contrib/thriftfs/gen-java/org/ src/contrib/thriftfs/gen-java/org/apache/ src/... Date: Fri, 29 Aug 2008 04:32:00 -0000 To: core-commits@hadoop.apache.org From: omalley@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080829043203.2A3C22388A8D@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Added: hadoop/core/trunk/src/contrib/thriftfs/gen-st/hadoopfs.st URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/contrib/thriftfs/gen-st/hadoopfs.st?rev=690096&view=auto ============================================================================== --- hadoop/core/trunk/src/contrib/thriftfs/gen-st/hadoopfs.st (added) +++ hadoop/core/trunk/src/contrib/thriftfs/gen-st/hadoopfs.st Thu Aug 28 21:31:57 2008 @@ -0,0 +1,1486 @@ +'Autogenerated by Thrift + +DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +'! + +Object subclass: #Hadoopfs + instanceVariableNames: '' + classVariableNames: '' + poolDictionaries: '' + category: 'Generated-Hadoopfs'! + +Hadoopfs class + instanceVariableNames: 'constants enums'! + +!Hadoopfs class methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +enums: anObject + enums := anObject! ! + +!Hadoopfs class methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +enums + ^ enums! ! + +!Hadoopfs class methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +constants: anObject + constants := anObject! ! + +!Hadoopfs class methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +constants + ^ constants! ! + +Hadoopfs enums: Dictionary new! +Hadoopfs constants: Dictionary new! + +Object subclass: #ThriftHandle + instanceVariableNames: 'id' + classVariableNames: '' + poolDictionaries: '' + category: 'Generated-Hadoopfs'! + +!ThriftHandle methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +id: anI64 + id := anI64! ! + +!ThriftHandle methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +id + ^ id! ! + + +Object subclass: #Pathname + instanceVariableNames: 'pathname' + classVariableNames: '' + poolDictionaries: '' + category: 'Generated-Hadoopfs'! + +!Pathname methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +pathname: aString + pathname := aString! ! + +!Pathname methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +pathname + ^ pathname! ! + + +Object subclass: #FileStatus + instanceVariableNames: 'path length isdir blockReplication blocksize modificationTime permission owner group' + classVariableNames: '' + poolDictionaries: '' + category: 'Generated-Hadoopfs'! + +!FileStatus methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +path: aString + path := aString! ! + +!FileStatus methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +path + ^ path! ! + +!FileStatus methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +length: anI64 + length := anI64! ! + +!FileStatus methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +length + ^ length! ! + +!FileStatus methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +isdir: aBool + isdir := aBool! ! + +!FileStatus methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +isdir + ^ isdir! ! + +!FileStatus methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +blockReplication: anI16 + blockReplication := anI16! ! + +!FileStatus methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +blockReplication + ^ blockReplication! ! + +!FileStatus methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +blocksize: anI64 + blocksize := anI64! ! + +!FileStatus methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +blocksize + ^ blocksize! ! + +!FileStatus methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +modificationTime: anI64 + modificationTime := anI64! ! + +!FileStatus methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +modificationTime + ^ modificationTime! ! + +!FileStatus methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +permission: aString + permission := aString! ! + +!FileStatus methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +permission + ^ permission! ! + +!FileStatus methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +owner: aString + owner := aString! ! + +!FileStatus methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +owner + ^ owner! ! + +!FileStatus methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +group: aString + group := aString! ! + +!FileStatus methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +group + ^ group! ! + + +Object subclass: #BlockLocation + instanceVariableNames: 'hosts names offset length' + classVariableNames: '' + poolDictionaries: '' + category: 'Generated-Hadoopfs'! + +!BlockLocation methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +hosts: a + hosts := a! ! + +!BlockLocation methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +hosts + ^ hosts! ! + +!BlockLocation methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +names: a + names := a! ! + +!BlockLocation methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +names + ^ names! ! + +!BlockLocation methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +offset: anI64 + offset := anI64! ! + +!BlockLocation methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +offset + ^ offset! ! + +!BlockLocation methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +length: anI64 + length := anI64! ! + +!BlockLocation methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +length + ^ length! ! + + +Error subclass: #MalformedInputException + instanceVariableNames: 'message' + classVariableNames: '' + poolDictionaries: '' + category: 'Generated-Hadoopfs'! + +!MalformedInputException methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +message: aString + message := aString! ! + +!MalformedInputException methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +message + ^ message! ! + + +Error subclass: #ThriftIOException + instanceVariableNames: 'message' + classVariableNames: '' + poolDictionaries: '' + category: 'Generated-Hadoopfs'! + +!ThriftIOException methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +message: aString + message := aString! ! + +!ThriftIOException methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +message + ^ message! ! + + +TClient subclass: #ThriftHadoopFileSystemClient + instanceVariableNames: '' + classVariableNames: '' + poolDictionaries: '' + category: 'Generated-Hadoopfs'! + +!ThriftHadoopFileSystemClient methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +setInactivityTimeoutPeriodPeriodInSeconds: periodInSeconds + "periodInSeconds: i64" + self sendSetInactivityTimeoutPeriodPeriodInSeconds: periodInSeconds. + ^ self recvSetInactivityTimeoutPeriod success +! ! + +!ThriftHadoopFileSystemClient methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +sendSetInactivityTimeoutPeriodPeriodInSeconds: periodInSeconds + oprot writeMessageBegin: + (TCallMessage new + name: 'setInactivityTimeoutPeriod'; + seqid: self nextSeqid). + oprot writeStructBegin: (TStruct new name: 'SetInactivityTimeoutPeriod_args'). + oprot writeFieldBegin: (TField new name: 'periodInSeconds'; type: TType i64; id: 1). + iprot writeI64: periodInSeconds asInteger. + oprot writeFieldEnd. + oprot writeFieldStop; writeStructEnd; writeMessageEnd. + oprot transport flush! ! + +!ThriftHadoopFileSystemClient methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +recvSetInactivityTimeoutPeriod + | f msg res | + msg := oprot readMessageBegin. + self validateRemoteMessage: msg. + res := [|temp1 temp0| + temp0 := TResult new. + iprot readStructBegin. + [temp1 := iprot readFieldBegin. + temp1 type = TType stop] whileFalse: [|temp2| + temp1 id = 0 ifTrue: [ + temp2 := true. + temp0 success: iprot readVoid]. + temp2 ifNil: [iprot skip: temp1 type]]. + oprot readStructEnd. + temp0] value. + oprot readMessageEnd. + oprot transport flush. + res exception ifNotNil: [res exception signal]. + ^ res! ! + +!ThriftHadoopFileSystemClient methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +shutdownStatus: status + "status: i32" + self sendShutdownStatus: status. + ^ self recvShutdown success +! ! + +!ThriftHadoopFileSystemClient methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +sendShutdownStatus: status + oprot writeMessageBegin: + (TCallMessage new + name: 'shutdown'; + seqid: self nextSeqid). + oprot writeStructBegin: (TStruct new name: 'Shutdown_args'). + oprot writeFieldBegin: (TField new name: 'status'; type: TType i32; id: 1). + iprot writeI32: status asInteger. + oprot writeFieldEnd. + oprot writeFieldStop; writeStructEnd; writeMessageEnd. + oprot transport flush! ! + +!ThriftHadoopFileSystemClient methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +recvShutdown + | f msg res | + msg := oprot readMessageBegin. + self validateRemoteMessage: msg. + res := [|temp4 temp3| + temp3 := TResult new. + iprot readStructBegin. + [temp4 := iprot readFieldBegin. + temp4 type = TType stop] whileFalse: [|temp5| + temp4 id = 0 ifTrue: [ + temp5 := true. + temp3 success: iprot readVoid]. + temp5 ifNil: [iprot skip: temp4 type]]. + oprot readStructEnd. + temp3] value. + oprot readMessageEnd. + oprot transport flush. + res exception ifNotNil: [res exception signal]. + ^ res! ! + +!ThriftHadoopFileSystemClient methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +createPath: path + "path: Pathname" + self sendCreatePath: path. + ^ self recvCreate success +! ! + +!ThriftHadoopFileSystemClient methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +sendCreatePath: path + oprot writeMessageBegin: + (TCallMessage new + name: 'create'; + seqid: self nextSeqid). + oprot writeStructBegin: (TStruct new name: 'Create_args'). + oprot writeFieldBegin: (TField new name: 'path'; type: TType struct; id: 1). + [oprot writeStructBegin: (TStruct new name: 'Pathname'). + oprot writeFieldBegin: (TField new name: 'pathname'; type: TType string; id: -1). + iprot writeString: path pathname. + oprot writeFieldEnd. + oprot writeFieldStop; writeStructEnd] value. + oprot writeFieldEnd. + oprot writeFieldStop; writeStructEnd; writeMessageEnd. + oprot transport flush! ! + +!ThriftHadoopFileSystemClient methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +recvCreate + | f msg res | + msg := oprot readMessageBegin. + self validateRemoteMessage: msg. + res := [|temp7 temp6| + temp6 := TResult new. + iprot readStructBegin. + [temp7 := iprot readFieldBegin. + temp7 type = TType stop] whileFalse: [|temp8| + temp7 id = 0 ifTrue: [ + temp8 := true. + temp6 success: [|temp10 temp9| + temp9 := ThriftHandle new. + iprot readStructBegin. + [temp10 := iprot readFieldBegin. + temp10 type = TType stop] whileFalse: [|temp11| + temp10 id = -1 ifTrue: [ + temp11 := true. + temp9 id: iprot readI64]. + temp11 ifNil: [iprot skip: temp10 type]]. + oprot readStructEnd. + temp9] value]. + temp7 id = 1 ifTrue: [ + temp8 := true. + temp6 exception: [|temp13 temp12| + temp12 := ThriftIOException new. + iprot readStructBegin. + [temp13 := iprot readFieldBegin. + temp13 type = TType stop] whileFalse: [|temp14| + temp13 id = -1 ifTrue: [ + temp14 := true. + temp12 message: iprot readString]. + temp14 ifNil: [iprot skip: temp13 type]]. + oprot readStructEnd. + temp12] value]. + temp8 ifNil: [iprot skip: temp7 type]]. + oprot readStructEnd. + temp6] value. + oprot readMessageEnd. + oprot transport flush. + res exception ifNotNil: [res exception signal]. + ^ res! ! + +!ThriftHadoopFileSystemClient methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +createFilePath: path mode: mode overwrite: overwrite bufferSize: bufferSize block_replication: block_replication blocksize: blocksize + "path: Pathname, mode: i16, overwrite: bool, bufferSize: i32, block_replication: i16, blocksize: i64" + self sendCreateFilePath: path mode: mode overwrite: overwrite bufferSize: bufferSize block_replication: block_replication blocksize: blocksize. + ^ self recvCreateFile success +! ! + +!ThriftHadoopFileSystemClient methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +sendCreateFilePath: path mode: mode overwrite: overwrite bufferSize: bufferSize block_replication: block_replication blocksize: blocksize + oprot writeMessageBegin: + (TCallMessage new + name: 'createFile'; + seqid: self nextSeqid). + oprot writeStructBegin: (TStruct new name: 'CreateFile_args'). + oprot writeFieldBegin: (TField new name: 'path'; type: TType struct; id: 1). + [oprot writeStructBegin: (TStruct new name: 'Pathname'). + oprot writeFieldBegin: (TField new name: 'pathname'; type: TType string; id: -1). + iprot writeString: path pathname. + oprot writeFieldEnd. + oprot writeFieldStop; writeStructEnd] value. + oprot writeFieldEnd. + oprot writeFieldBegin: (TField new name: 'mode'; type: TType i16; id: 2). + iprot writeI16: mode asInteger. + oprot writeFieldEnd. + oprot writeFieldBegin: (TField new name: 'overwrite'; type: TType bool; id: 3). + iprot writeBool: overwrite. + oprot writeFieldEnd. + oprot writeFieldBegin: (TField new name: 'bufferSize'; type: TType i32; id: 4). + iprot writeI32: bufferSize asInteger. + oprot writeFieldEnd. + oprot writeFieldBegin: (TField new name: 'block_replication'; type: TType i16; id: 5). + iprot writeI16: block_replication asInteger. + oprot writeFieldEnd. + oprot writeFieldBegin: (TField new name: 'blocksize'; type: TType i64; id: 6). + iprot writeI64: blocksize asInteger. + oprot writeFieldEnd. + oprot writeFieldStop; writeStructEnd; writeMessageEnd. + oprot transport flush! ! + +!ThriftHadoopFileSystemClient methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +recvCreateFile + | f msg res | + msg := oprot readMessageBegin. + self validateRemoteMessage: msg. + res := [|temp16 temp15| + temp15 := TResult new. + iprot readStructBegin. + [temp16 := iprot readFieldBegin. + temp16 type = TType stop] whileFalse: [|temp17| + temp16 id = 0 ifTrue: [ + temp17 := true. + temp15 success: [|temp19 temp18| + temp18 := ThriftHandle new. + iprot readStructBegin. + [temp19 := iprot readFieldBegin. + temp19 type = TType stop] whileFalse: [|temp20| + temp19 id = -1 ifTrue: [ + temp20 := true. + temp18 id: iprot readI64]. + temp20 ifNil: [iprot skip: temp19 type]]. + oprot readStructEnd. + temp18] value]. + temp16 id = 1 ifTrue: [ + temp17 := true. + temp15 exception: [|temp22 temp21| + temp21 := ThriftIOException new. + iprot readStructBegin. + [temp22 := iprot readFieldBegin. + temp22 type = TType stop] whileFalse: [|temp23| + temp22 id = -1 ifTrue: [ + temp23 := true. + temp21 message: iprot readString]. + temp23 ifNil: [iprot skip: temp22 type]]. + oprot readStructEnd. + temp21] value]. + temp17 ifNil: [iprot skip: temp16 type]]. + oprot readStructEnd. + temp15] value. + oprot readMessageEnd. + oprot transport flush. + res exception ifNotNil: [res exception signal]. + ^ res! ! + +!ThriftHadoopFileSystemClient methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +openPath: path + "path: Pathname" + self sendOpenPath: path. + ^ self recvOpen success +! ! + +!ThriftHadoopFileSystemClient methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +sendOpenPath: path + oprot writeMessageBegin: + (TCallMessage new + name: 'open'; + seqid: self nextSeqid). + oprot writeStructBegin: (TStruct new name: 'Open_args'). + oprot writeFieldBegin: (TField new name: 'path'; type: TType struct; id: 1). + [oprot writeStructBegin: (TStruct new name: 'Pathname'). + oprot writeFieldBegin: (TField new name: 'pathname'; type: TType string; id: -1). + iprot writeString: path pathname. + oprot writeFieldEnd. + oprot writeFieldStop; writeStructEnd] value. + oprot writeFieldEnd. + oprot writeFieldStop; writeStructEnd; writeMessageEnd. + oprot transport flush! ! + +!ThriftHadoopFileSystemClient methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +recvOpen + | f msg res | + msg := oprot readMessageBegin. + self validateRemoteMessage: msg. + res := [|temp25 temp24| + temp24 := TResult new. + iprot readStructBegin. + [temp25 := iprot readFieldBegin. + temp25 type = TType stop] whileFalse: [|temp26| + temp25 id = 0 ifTrue: [ + temp26 := true. + temp24 success: [|temp28 temp27| + temp27 := ThriftHandle new. + iprot readStructBegin. + [temp28 := iprot readFieldBegin. + temp28 type = TType stop] whileFalse: [|temp29| + temp28 id = -1 ifTrue: [ + temp29 := true. + temp27 id: iprot readI64]. + temp29 ifNil: [iprot skip: temp28 type]]. + oprot readStructEnd. + temp27] value]. + temp25 id = 1 ifTrue: [ + temp26 := true. + temp24 exception: [|temp31 temp30| + temp30 := ThriftIOException new. + iprot readStructBegin. + [temp31 := iprot readFieldBegin. + temp31 type = TType stop] whileFalse: [|temp32| + temp31 id = -1 ifTrue: [ + temp32 := true. + temp30 message: iprot readString]. + temp32 ifNil: [iprot skip: temp31 type]]. + oprot readStructEnd. + temp30] value]. + temp26 ifNil: [iprot skip: temp25 type]]. + oprot readStructEnd. + temp24] value. + oprot readMessageEnd. + oprot transport flush. + res exception ifNotNil: [res exception signal]. + ^ res! ! + +!ThriftHadoopFileSystemClient methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +appendPath: path + "path: Pathname" + self sendAppendPath: path. + ^ self recvAppend success +! ! + +!ThriftHadoopFileSystemClient methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +sendAppendPath: path + oprot writeMessageBegin: + (TCallMessage new + name: 'append'; + seqid: self nextSeqid). + oprot writeStructBegin: (TStruct new name: 'Append_args'). + oprot writeFieldBegin: (TField new name: 'path'; type: TType struct; id: 1). + [oprot writeStructBegin: (TStruct new name: 'Pathname'). + oprot writeFieldBegin: (TField new name: 'pathname'; type: TType string; id: -1). + iprot writeString: path pathname. + oprot writeFieldEnd. + oprot writeFieldStop; writeStructEnd] value. + oprot writeFieldEnd. + oprot writeFieldStop; writeStructEnd; writeMessageEnd. + oprot transport flush! ! + +!ThriftHadoopFileSystemClient methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +recvAppend + | f msg res | + msg := oprot readMessageBegin. + self validateRemoteMessage: msg. + res := [|temp34 temp33| + temp33 := TResult new. + iprot readStructBegin. + [temp34 := iprot readFieldBegin. + temp34 type = TType stop] whileFalse: [|temp35| + temp34 id = 0 ifTrue: [ + temp35 := true. + temp33 success: [|temp37 temp36| + temp36 := ThriftHandle new. + iprot readStructBegin. + [temp37 := iprot readFieldBegin. + temp37 type = TType stop] whileFalse: [|temp38| + temp37 id = -1 ifTrue: [ + temp38 := true. + temp36 id: iprot readI64]. + temp38 ifNil: [iprot skip: temp37 type]]. + oprot readStructEnd. + temp36] value]. + temp34 id = 1 ifTrue: [ + temp35 := true. + temp33 exception: [|temp40 temp39| + temp39 := ThriftIOException new. + iprot readStructBegin. + [temp40 := iprot readFieldBegin. + temp40 type = TType stop] whileFalse: [|temp41| + temp40 id = -1 ifTrue: [ + temp41 := true. + temp39 message: iprot readString]. + temp41 ifNil: [iprot skip: temp40 type]]. + oprot readStructEnd. + temp39] value]. + temp35 ifNil: [iprot skip: temp34 type]]. + oprot readStructEnd. + temp33] value. + oprot readMessageEnd. + oprot transport flush. + res exception ifNotNil: [res exception signal]. + ^ res! ! + +!ThriftHadoopFileSystemClient methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +writeHandle: handle data: data + "handle: ThriftHandle, data: string" + self sendWriteHandle: handle data: data. + ^ self recvWrite success +! ! + +!ThriftHadoopFileSystemClient methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +sendWriteHandle: handle data: data + oprot writeMessageBegin: + (TCallMessage new + name: 'write'; + seqid: self nextSeqid). + oprot writeStructBegin: (TStruct new name: 'Write_args'). + oprot writeFieldBegin: (TField new name: 'handle'; type: TType struct; id: 1). + [oprot writeStructBegin: (TStruct new name: 'ThriftHandle'). + oprot writeFieldBegin: (TField new name: 'id'; type: TType i64; id: -1). + iprot writeI64: handle id asInteger. + oprot writeFieldEnd. + oprot writeFieldStop; writeStructEnd] value. + oprot writeFieldEnd. + oprot writeFieldBegin: (TField new name: 'data'; type: TType string; id: -1). + iprot writeString: data. + oprot writeFieldEnd. + oprot writeFieldStop; writeStructEnd; writeMessageEnd. + oprot transport flush! ! + +!ThriftHadoopFileSystemClient methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +recvWrite + | f msg res | + msg := oprot readMessageBegin. + self validateRemoteMessage: msg. + res := [|temp43 temp42| + temp42 := TResult new. + iprot readStructBegin. + [temp43 := iprot readFieldBegin. + temp43 type = TType stop] whileFalse: [|temp44| + temp43 id = 0 ifTrue: [ + temp44 := true. + temp42 success: iprot readBool]. + temp43 id = 1 ifTrue: [ + temp44 := true. + temp42 exception: [|temp46 temp45| + temp45 := ThriftIOException new. + iprot readStructBegin. + [temp46 := iprot readFieldBegin. + temp46 type = TType stop] whileFalse: [|temp47| + temp46 id = -1 ifTrue: [ + temp47 := true. + temp45 message: iprot readString]. + temp47 ifNil: [iprot skip: temp46 type]]. + oprot readStructEnd. + temp45] value]. + temp44 ifNil: [iprot skip: temp43 type]]. + oprot readStructEnd. + temp42] value. + oprot readMessageEnd. + oprot transport flush. + res exception ifNotNil: [res exception signal]. + ^ res! ! + +!ThriftHadoopFileSystemClient methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +readHandle: handle offset: offset size: size + "handle: ThriftHandle, offset: i64, size: i32" + self sendReadHandle: handle offset: offset size: size. + ^ self recvRead success +! ! + +!ThriftHadoopFileSystemClient methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +sendReadHandle: handle offset: offset size: size + oprot writeMessageBegin: + (TCallMessage new + name: 'read'; + seqid: self nextSeqid). + oprot writeStructBegin: (TStruct new name: 'Read_args'). + oprot writeFieldBegin: (TField new name: 'handle'; type: TType struct; id: 1). + [oprot writeStructBegin: (TStruct new name: 'ThriftHandle'). + oprot writeFieldBegin: (TField new name: 'id'; type: TType i64; id: -1). + iprot writeI64: handle id asInteger. + oprot writeFieldEnd. + oprot writeFieldStop; writeStructEnd] value. + oprot writeFieldEnd. + oprot writeFieldBegin: (TField new name: 'offset'; type: TType i64; id: -1). + iprot writeI64: offset asInteger. + oprot writeFieldEnd. + oprot writeFieldBegin: (TField new name: 'size'; type: TType i32; id: -2). + iprot writeI32: size asInteger. + oprot writeFieldEnd. + oprot writeFieldStop; writeStructEnd; writeMessageEnd. + oprot transport flush! ! + +!ThriftHadoopFileSystemClient methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +recvRead + | f msg res | + msg := oprot readMessageBegin. + self validateRemoteMessage: msg. + res := [|temp49 temp48| + temp48 := TResult new. + iprot readStructBegin. + [temp49 := iprot readFieldBegin. + temp49 type = TType stop] whileFalse: [|temp50| + temp49 id = 0 ifTrue: [ + temp50 := true. + temp48 success: iprot readString]. + temp49 id = 1 ifTrue: [ + temp50 := true. + temp48 exception: [|temp52 temp51| + temp51 := ThriftIOException new. + iprot readStructBegin. + [temp52 := iprot readFieldBegin. + temp52 type = TType stop] whileFalse: [|temp53| + temp52 id = -1 ifTrue: [ + temp53 := true. + temp51 message: iprot readString]. + temp53 ifNil: [iprot skip: temp52 type]]. + oprot readStructEnd. + temp51] value]. + temp50 ifNil: [iprot skip: temp49 type]]. + oprot readStructEnd. + temp48] value. + oprot readMessageEnd. + oprot transport flush. + res exception ifNotNil: [res exception signal]. + ^ res! ! + +!ThriftHadoopFileSystemClient methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +closeOut: out + "out: ThriftHandle" + self sendCloseOut: out. + ^ self recvClose success +! ! + +!ThriftHadoopFileSystemClient methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +sendCloseOut: out + oprot writeMessageBegin: + (TCallMessage new + name: 'close'; + seqid: self nextSeqid). + oprot writeStructBegin: (TStruct new name: 'Close_args'). + oprot writeFieldBegin: (TField new name: 'out'; type: TType struct; id: 1). + [oprot writeStructBegin: (TStruct new name: 'ThriftHandle'). + oprot writeFieldBegin: (TField new name: 'id'; type: TType i64; id: -1). + iprot writeI64: out id asInteger. + oprot writeFieldEnd. + oprot writeFieldStop; writeStructEnd] value. + oprot writeFieldEnd. + oprot writeFieldStop; writeStructEnd; writeMessageEnd. + oprot transport flush! ! + +!ThriftHadoopFileSystemClient methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +recvClose + | f msg res | + msg := oprot readMessageBegin. + self validateRemoteMessage: msg. + res := [|temp55 temp54| + temp54 := TResult new. + iprot readStructBegin. + [temp55 := iprot readFieldBegin. + temp55 type = TType stop] whileFalse: [|temp56| + temp55 id = 0 ifTrue: [ + temp56 := true. + temp54 success: iprot readBool]. + temp55 id = 1 ifTrue: [ + temp56 := true. + temp54 exception: [|temp58 temp57| + temp57 := ThriftIOException new. + iprot readStructBegin. + [temp58 := iprot readFieldBegin. + temp58 type = TType stop] whileFalse: [|temp59| + temp58 id = -1 ifTrue: [ + temp59 := true. + temp57 message: iprot readString]. + temp59 ifNil: [iprot skip: temp58 type]]. + oprot readStructEnd. + temp57] value]. + temp56 ifNil: [iprot skip: temp55 type]]. + oprot readStructEnd. + temp54] value. + oprot readMessageEnd. + oprot transport flush. + res exception ifNotNil: [res exception signal]. + ^ res! ! + +!ThriftHadoopFileSystemClient methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +rmPath: path recursive: recursive + "path: Pathname, recursive: bool" + self sendRmPath: path recursive: recursive. + ^ self recvRm success +! ! + +!ThriftHadoopFileSystemClient methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +sendRmPath: path recursive: recursive + oprot writeMessageBegin: + (TCallMessage new + name: 'rm'; + seqid: self nextSeqid). + oprot writeStructBegin: (TStruct new name: 'Rm_args'). + oprot writeFieldBegin: (TField new name: 'path'; type: TType struct; id: 1). + [oprot writeStructBegin: (TStruct new name: 'Pathname'). + oprot writeFieldBegin: (TField new name: 'pathname'; type: TType string; id: -1). + iprot writeString: path pathname. + oprot writeFieldEnd. + oprot writeFieldStop; writeStructEnd] value. + oprot writeFieldEnd. + oprot writeFieldBegin: (TField new name: 'recursive'; type: TType bool; id: 2). + iprot writeBool: recursive. + oprot writeFieldEnd. + oprot writeFieldStop; writeStructEnd; writeMessageEnd. + oprot transport flush! ! + +!ThriftHadoopFileSystemClient methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +recvRm + | f msg res | + msg := oprot readMessageBegin. + self validateRemoteMessage: msg. + res := [|temp61 temp60| + temp60 := TResult new. + iprot readStructBegin. + [temp61 := iprot readFieldBegin. + temp61 type = TType stop] whileFalse: [|temp62| + temp61 id = 0 ifTrue: [ + temp62 := true. + temp60 success: iprot readBool]. + temp61 id = 1 ifTrue: [ + temp62 := true. + temp60 exception: [|temp64 temp63| + temp63 := ThriftIOException new. + iprot readStructBegin. + [temp64 := iprot readFieldBegin. + temp64 type = TType stop] whileFalse: [|temp65| + temp64 id = -1 ifTrue: [ + temp65 := true. + temp63 message: iprot readString]. + temp65 ifNil: [iprot skip: temp64 type]]. + oprot readStructEnd. + temp63] value]. + temp62 ifNil: [iprot skip: temp61 type]]. + oprot readStructEnd. + temp60] value. + oprot readMessageEnd. + oprot transport flush. + res exception ifNotNil: [res exception signal]. + ^ res! ! + +!ThriftHadoopFileSystemClient methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +renamePath: path dest: dest + "path: Pathname, dest: Pathname" + self sendRenamePath: path dest: dest. + ^ self recvRename success +! ! + +!ThriftHadoopFileSystemClient methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +sendRenamePath: path dest: dest + oprot writeMessageBegin: + (TCallMessage new + name: 'rename'; + seqid: self nextSeqid). + oprot writeStructBegin: (TStruct new name: 'Rename_args'). + oprot writeFieldBegin: (TField new name: 'path'; type: TType struct; id: 1). + [oprot writeStructBegin: (TStruct new name: 'Pathname'). + oprot writeFieldBegin: (TField new name: 'pathname'; type: TType string; id: -1). + iprot writeString: path pathname. + oprot writeFieldEnd. + oprot writeFieldStop; writeStructEnd] value. + oprot writeFieldEnd. + oprot writeFieldBegin: (TField new name: 'dest'; type: TType struct; id: 2). + [oprot writeStructBegin: (TStruct new name: 'Pathname'). + oprot writeFieldBegin: (TField new name: 'pathname'; type: TType string; id: -1). + iprot writeString: dest pathname. + oprot writeFieldEnd. + oprot writeFieldStop; writeStructEnd] value. + oprot writeFieldEnd. + oprot writeFieldStop; writeStructEnd; writeMessageEnd. + oprot transport flush! ! + +!ThriftHadoopFileSystemClient methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +recvRename + | f msg res | + msg := oprot readMessageBegin. + self validateRemoteMessage: msg. + res := [|temp67 temp66| + temp66 := TResult new. + iprot readStructBegin. + [temp67 := iprot readFieldBegin. + temp67 type = TType stop] whileFalse: [|temp68| + temp67 id = 0 ifTrue: [ + temp68 := true. + temp66 success: iprot readBool]. + temp67 id = 1 ifTrue: [ + temp68 := true. + temp66 exception: [|temp70 temp69| + temp69 := ThriftIOException new. + iprot readStructBegin. + [temp70 := iprot readFieldBegin. + temp70 type = TType stop] whileFalse: [|temp71| + temp70 id = -1 ifTrue: [ + temp71 := true. + temp69 message: iprot readString]. + temp71 ifNil: [iprot skip: temp70 type]]. + oprot readStructEnd. + temp69] value]. + temp68 ifNil: [iprot skip: temp67 type]]. + oprot readStructEnd. + temp66] value. + oprot readMessageEnd. + oprot transport flush. + res exception ifNotNil: [res exception signal]. + ^ res! ! + +!ThriftHadoopFileSystemClient methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +mkdirsPath: path + "path: Pathname" + self sendMkdirsPath: path. + ^ self recvMkdirs success +! ! + +!ThriftHadoopFileSystemClient methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +sendMkdirsPath: path + oprot writeMessageBegin: + (TCallMessage new + name: 'mkdirs'; + seqid: self nextSeqid). + oprot writeStructBegin: (TStruct new name: 'Mkdirs_args'). + oprot writeFieldBegin: (TField new name: 'path'; type: TType struct; id: 1). + [oprot writeStructBegin: (TStruct new name: 'Pathname'). + oprot writeFieldBegin: (TField new name: 'pathname'; type: TType string; id: -1). + iprot writeString: path pathname. + oprot writeFieldEnd. + oprot writeFieldStop; writeStructEnd] value. + oprot writeFieldEnd. + oprot writeFieldStop; writeStructEnd; writeMessageEnd. + oprot transport flush! ! + +!ThriftHadoopFileSystemClient methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +recvMkdirs + | f msg res | + msg := oprot readMessageBegin. + self validateRemoteMessage: msg. + res := [|temp73 temp72| + temp72 := TResult new. + iprot readStructBegin. + [temp73 := iprot readFieldBegin. + temp73 type = TType stop] whileFalse: [|temp74| + temp73 id = 0 ifTrue: [ + temp74 := true. + temp72 success: iprot readBool]. + temp73 id = 1 ifTrue: [ + temp74 := true. + temp72 exception: [|temp76 temp75| + temp75 := ThriftIOException new. + iprot readStructBegin. + [temp76 := iprot readFieldBegin. + temp76 type = TType stop] whileFalse: [|temp77| + temp76 id = -1 ifTrue: [ + temp77 := true. + temp75 message: iprot readString]. + temp77 ifNil: [iprot skip: temp76 type]]. + oprot readStructEnd. + temp75] value]. + temp74 ifNil: [iprot skip: temp73 type]]. + oprot readStructEnd. + temp72] value. + oprot readMessageEnd. + oprot transport flush. + res exception ifNotNil: [res exception signal]. + ^ res! ! + +!ThriftHadoopFileSystemClient methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +existsPath: path + "path: Pathname" + self sendExistsPath: path. + ^ self recvExists success +! ! + +!ThriftHadoopFileSystemClient methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +sendExistsPath: path + oprot writeMessageBegin: + (TCallMessage new + name: 'exists'; + seqid: self nextSeqid). + oprot writeStructBegin: (TStruct new name: 'Exists_args'). + oprot writeFieldBegin: (TField new name: 'path'; type: TType struct; id: 1). + [oprot writeStructBegin: (TStruct new name: 'Pathname'). + oprot writeFieldBegin: (TField new name: 'pathname'; type: TType string; id: -1). + iprot writeString: path pathname. + oprot writeFieldEnd. + oprot writeFieldStop; writeStructEnd] value. + oprot writeFieldEnd. + oprot writeFieldStop; writeStructEnd; writeMessageEnd. + oprot transport flush! ! + +!ThriftHadoopFileSystemClient methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +recvExists + | f msg res | + msg := oprot readMessageBegin. + self validateRemoteMessage: msg. + res := [|temp79 temp78| + temp78 := TResult new. + iprot readStructBegin. + [temp79 := iprot readFieldBegin. + temp79 type = TType stop] whileFalse: [|temp80| + temp79 id = 0 ifTrue: [ + temp80 := true. + temp78 success: iprot readBool]. + temp79 id = 1 ifTrue: [ + temp80 := true. + temp78 exception: [|temp82 temp81| + temp81 := ThriftIOException new. + iprot readStructBegin. + [temp82 := iprot readFieldBegin. + temp82 type = TType stop] whileFalse: [|temp83| + temp82 id = -1 ifTrue: [ + temp83 := true. + temp81 message: iprot readString]. + temp83 ifNil: [iprot skip: temp82 type]]. + oprot readStructEnd. + temp81] value]. + temp80 ifNil: [iprot skip: temp79 type]]. + oprot readStructEnd. + temp78] value. + oprot readMessageEnd. + oprot transport flush. + res exception ifNotNil: [res exception signal]. + ^ res! ! + +!ThriftHadoopFileSystemClient methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +statPath: path + "path: Pathname" + self sendStatPath: path. + ^ self recvStat success +! ! + +!ThriftHadoopFileSystemClient methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +sendStatPath: path + oprot writeMessageBegin: + (TCallMessage new + name: 'stat'; + seqid: self nextSeqid). + oprot writeStructBegin: (TStruct new name: 'Stat_args'). + oprot writeFieldBegin: (TField new name: 'path'; type: TType struct; id: 1). + [oprot writeStructBegin: (TStruct new name: 'Pathname'). + oprot writeFieldBegin: (TField new name: 'pathname'; type: TType string; id: -1). + iprot writeString: path pathname. + oprot writeFieldEnd. + oprot writeFieldStop; writeStructEnd] value. + oprot writeFieldEnd. + oprot writeFieldStop; writeStructEnd; writeMessageEnd. + oprot transport flush! ! + +!ThriftHadoopFileSystemClient methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +recvStat + | f msg res | + msg := oprot readMessageBegin. + self validateRemoteMessage: msg. + res := [|temp85 temp84| + temp84 := TResult new. + iprot readStructBegin. + [temp85 := iprot readFieldBegin. + temp85 type = TType stop] whileFalse: [|temp86| + temp85 id = 0 ifTrue: [ + temp86 := true. + temp84 success: [|temp88 temp87| + temp87 := FileStatus new. + iprot readStructBegin. + [temp88 := iprot readFieldBegin. + temp88 type = TType stop] whileFalse: [|temp89| + temp88 id = 1 ifTrue: [ + temp89 := true. + temp87 path: iprot readString]. + temp88 id = 2 ifTrue: [ + temp89 := true. + temp87 length: iprot readI64]. + temp88 id = 3 ifTrue: [ + temp89 := true. + temp87 isdir: iprot readBool]. + temp88 id = 4 ifTrue: [ + temp89 := true. + temp87 blockReplication: iprot readI16]. + temp88 id = 5 ifTrue: [ + temp89 := true. + temp87 blocksize: iprot readI64]. + temp88 id = 6 ifTrue: [ + temp89 := true. + temp87 modificationTime: iprot readI64]. + temp88 id = 7 ifTrue: [ + temp89 := true. + temp87 permission: iprot readString]. + temp88 id = 8 ifTrue: [ + temp89 := true. + temp87 owner: iprot readString]. + temp88 id = 9 ifTrue: [ + temp89 := true. + temp87 group: iprot readString]. + temp89 ifNil: [iprot skip: temp88 type]]. + oprot readStructEnd. + temp87] value]. + temp85 id = 1 ifTrue: [ + temp86 := true. + temp84 exception: [|temp91 temp90| + temp90 := ThriftIOException new. + iprot readStructBegin. + [temp91 := iprot readFieldBegin. + temp91 type = TType stop] whileFalse: [|temp92| + temp91 id = -1 ifTrue: [ + temp92 := true. + temp90 message: iprot readString]. + temp92 ifNil: [iprot skip: temp91 type]]. + oprot readStructEnd. + temp90] value]. + temp86 ifNil: [iprot skip: temp85 type]]. + oprot readStructEnd. + temp84] value. + oprot readMessageEnd. + oprot transport flush. + res exception ifNotNil: [res exception signal]. + ^ res! ! + +!ThriftHadoopFileSystemClient methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +listStatusPath: path + "path: Pathname" + self sendListStatusPath: path. + ^ self recvListStatus success +! ! + +!ThriftHadoopFileSystemClient methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +sendListStatusPath: path + oprot writeMessageBegin: + (TCallMessage new + name: 'listStatus'; + seqid: self nextSeqid). + oprot writeStructBegin: (TStruct new name: 'ListStatus_args'). + oprot writeFieldBegin: (TField new name: 'path'; type: TType struct; id: 1). + [oprot writeStructBegin: (TStruct new name: 'Pathname'). + oprot writeFieldBegin: (TField new name: 'pathname'; type: TType string; id: -1). + iprot writeString: path pathname. + oprot writeFieldEnd. + oprot writeFieldStop; writeStructEnd] value. + oprot writeFieldEnd. + oprot writeFieldStop; writeStructEnd; writeMessageEnd. + oprot transport flush! ! + +!ThriftHadoopFileSystemClient methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +recvListStatus + | f msg res | + msg := oprot readMessageBegin. + self validateRemoteMessage: msg. + res := [|temp94 temp93| + temp93 := TResult new. + iprot readStructBegin. + [temp94 := iprot readFieldBegin. + temp94 type = TType stop] whileFalse: [|temp95| + temp94 id = 0 ifTrue: [ + temp95 := true. + temp93 success: [|temp96 temp97| temp96 := iprot readListBegin. + temp97 := OrderedCollection new. + temp96 size timesRepeat: [ + temp97 add: [|temp99 temp98| + temp98 := FileStatus new. + iprot readStructBegin. + [temp99 := iprot readFieldBegin. + temp99 type = TType stop] whileFalse: [|temp100| + temp99 id = 1 ifTrue: [ + temp100 := true. + temp98 path: iprot readString]. + temp99 id = 2 ifTrue: [ + temp100 := true. + temp98 length: iprot readI64]. + temp99 id = 3 ifTrue: [ + temp100 := true. + temp98 isdir: iprot readBool]. + temp99 id = 4 ifTrue: [ + temp100 := true. + temp98 blockReplication: iprot readI16]. + temp99 id = 5 ifTrue: [ + temp100 := true. + temp98 blocksize: iprot readI64]. + temp99 id = 6 ifTrue: [ + temp100 := true. + temp98 modificationTime: iprot readI64]. + temp99 id = 7 ifTrue: [ + temp100 := true. + temp98 permission: iprot readString]. + temp99 id = 8 ifTrue: [ + temp100 := true. + temp98 owner: iprot readString]. + temp99 id = 9 ifTrue: [ + temp100 := true. + temp98 group: iprot readString]. + temp100 ifNil: [iprot skip: temp99 type]]. + oprot readStructEnd. + temp98] value]. + iprot readListEnd. + temp97] value]. + temp94 id = 1 ifTrue: [ + temp95 := true. + temp93 exception: [|temp102 temp101| + temp101 := ThriftIOException new. + iprot readStructBegin. + [temp102 := iprot readFieldBegin. + temp102 type = TType stop] whileFalse: [|temp103| + temp102 id = -1 ifTrue: [ + temp103 := true. + temp101 message: iprot readString]. + temp103 ifNil: [iprot skip: temp102 type]]. + oprot readStructEnd. + temp101] value]. + temp95 ifNil: [iprot skip: temp94 type]]. + oprot readStructEnd. + temp93] value. + oprot readMessageEnd. + oprot transport flush. + res exception ifNotNil: [res exception signal]. + ^ res! ! + +!ThriftHadoopFileSystemClient methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +chmodPath: path mode: mode + "path: Pathname, mode: i16" + self sendChmodPath: path mode: mode. + ^ self recvChmod success +! ! + +!ThriftHadoopFileSystemClient methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +sendChmodPath: path mode: mode + oprot writeMessageBegin: + (TCallMessage new + name: 'chmod'; + seqid: self nextSeqid). + oprot writeStructBegin: (TStruct new name: 'Chmod_args'). + oprot writeFieldBegin: (TField new name: 'path'; type: TType struct; id: 1). + [oprot writeStructBegin: (TStruct new name: 'Pathname'). + oprot writeFieldBegin: (TField new name: 'pathname'; type: TType string; id: -1). + iprot writeString: path pathname. + oprot writeFieldEnd. + oprot writeFieldStop; writeStructEnd] value. + oprot writeFieldEnd. + oprot writeFieldBegin: (TField new name: 'mode'; type: TType i16; id: 2). + iprot writeI16: mode asInteger. + oprot writeFieldEnd. + oprot writeFieldStop; writeStructEnd; writeMessageEnd. + oprot transport flush! ! + +!ThriftHadoopFileSystemClient methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +recvChmod + | f msg res | + msg := oprot readMessageBegin. + self validateRemoteMessage: msg. + res := [|temp105 temp104| + temp104 := TResult new. + iprot readStructBegin. + [temp105 := iprot readFieldBegin. + temp105 type = TType stop] whileFalse: [|temp106| + temp105 id = 0 ifTrue: [ + temp106 := true. + temp104 success: iprot readVoid]. + temp105 id = 1 ifTrue: [ + temp106 := true. + temp104 exception: [|temp108 temp107| + temp107 := ThriftIOException new. + iprot readStructBegin. + [temp108 := iprot readFieldBegin. + temp108 type = TType stop] whileFalse: [|temp109| + temp108 id = -1 ifTrue: [ + temp109 := true. + temp107 message: iprot readString]. + temp109 ifNil: [iprot skip: temp108 type]]. + oprot readStructEnd. + temp107] value]. + temp106 ifNil: [iprot skip: temp105 type]]. + oprot readStructEnd. + temp104] value. + oprot readMessageEnd. + oprot transport flush. + res exception ifNotNil: [res exception signal]. + ^ res! ! + +!ThriftHadoopFileSystemClient methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +chownPath: path owner: owner group: group + "path: Pathname, owner: string, group: string" + self sendChownPath: path owner: owner group: group. + ^ self recvChown success +! ! + +!ThriftHadoopFileSystemClient methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +sendChownPath: path owner: owner group: group + oprot writeMessageBegin: + (TCallMessage new + name: 'chown'; + seqid: self nextSeqid). + oprot writeStructBegin: (TStruct new name: 'Chown_args'). + oprot writeFieldBegin: (TField new name: 'path'; type: TType struct; id: 1). + [oprot writeStructBegin: (TStruct new name: 'Pathname'). + oprot writeFieldBegin: (TField new name: 'pathname'; type: TType string; id: -1). + iprot writeString: path pathname. + oprot writeFieldEnd. + oprot writeFieldStop; writeStructEnd] value. + oprot writeFieldEnd. + oprot writeFieldBegin: (TField new name: 'owner'; type: TType string; id: 2). + iprot writeString: owner. + oprot writeFieldEnd. + oprot writeFieldBegin: (TField new name: 'group'; type: TType string; id: 3). + iprot writeString: group. + oprot writeFieldEnd. + oprot writeFieldStop; writeStructEnd; writeMessageEnd. + oprot transport flush! ! + +!ThriftHadoopFileSystemClient methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +recvChown + | f msg res | + msg := oprot readMessageBegin. + self validateRemoteMessage: msg. + res := [|temp111 temp110| + temp110 := TResult new. + iprot readStructBegin. + [temp111 := iprot readFieldBegin. + temp111 type = TType stop] whileFalse: [|temp112| + temp111 id = 0 ifTrue: [ + temp112 := true. + temp110 success: iprot readVoid]. + temp111 id = 1 ifTrue: [ + temp112 := true. + temp110 exception: [|temp114 temp113| + temp113 := ThriftIOException new. + iprot readStructBegin. + [temp114 := iprot readFieldBegin. + temp114 type = TType stop] whileFalse: [|temp115| + temp114 id = -1 ifTrue: [ + temp115 := true. + temp113 message: iprot readString]. + temp115 ifNil: [iprot skip: temp114 type]]. + oprot readStructEnd. + temp113] value]. + temp112 ifNil: [iprot skip: temp111 type]]. + oprot readStructEnd. + temp110] value. + oprot readMessageEnd. + oprot transport flush. + res exception ifNotNil: [res exception signal]. + ^ res! ! + +!ThriftHadoopFileSystemClient methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +setReplicationPath: path replication: replication + "path: Pathname, replication: i16" + self sendSetReplicationPath: path replication: replication. + ^ self recvSetReplication success +! ! + +!ThriftHadoopFileSystemClient methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +sendSetReplicationPath: path replication: replication + oprot writeMessageBegin: + (TCallMessage new + name: 'setReplication'; + seqid: self nextSeqid). + oprot writeStructBegin: (TStruct new name: 'SetReplication_args'). + oprot writeFieldBegin: (TField new name: 'path'; type: TType struct; id: 1). + [oprot writeStructBegin: (TStruct new name: 'Pathname'). + oprot writeFieldBegin: (TField new name: 'pathname'; type: TType string; id: -1). + iprot writeString: path pathname. + oprot writeFieldEnd. + oprot writeFieldStop; writeStructEnd] value. + oprot writeFieldEnd. + oprot writeFieldBegin: (TField new name: 'replication'; type: TType i16; id: 2). + iprot writeI16: replication asInteger. + oprot writeFieldEnd. + oprot writeFieldStop; writeStructEnd; writeMessageEnd. + oprot transport flush! ! + +!ThriftHadoopFileSystemClient methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +recvSetReplication + | f msg res | + msg := oprot readMessageBegin. + self validateRemoteMessage: msg. + res := [|temp117 temp116| + temp116 := TResult new. + iprot readStructBegin. + [temp117 := iprot readFieldBegin. + temp117 type = TType stop] whileFalse: [|temp118| + temp117 id = 0 ifTrue: [ + temp118 := true. + temp116 success: iprot readVoid]. + temp117 id = 1 ifTrue: [ + temp118 := true. + temp116 exception: [|temp120 temp119| + temp119 := ThriftIOException new. + iprot readStructBegin. + [temp120 := iprot readFieldBegin. + temp120 type = TType stop] whileFalse: [|temp121| + temp120 id = -1 ifTrue: [ + temp121 := true. + temp119 message: iprot readString]. + temp121 ifNil: [iprot skip: temp120 type]]. + oprot readStructEnd. + temp119] value]. + temp118 ifNil: [iprot skip: temp117 type]]. + oprot readStructEnd. + temp116] value. + oprot readMessageEnd. + oprot transport flush. + res exception ifNotNil: [res exception signal]. + ^ res! ! + +!ThriftHadoopFileSystemClient methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +getFileBlockLocationsPath: path start: start length: length + "path: Pathname, start: i64, length: i64" + self sendGetFileBlockLocationsPath: path start: start length: length. + ^ self recvGetFileBlockLocations success +! ! + +!ThriftHadoopFileSystemClient methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +sendGetFileBlockLocationsPath: path start: start length: length + oprot writeMessageBegin: + (TCallMessage new + name: 'getFileBlockLocations'; + seqid: self nextSeqid). + oprot writeStructBegin: (TStruct new name: 'GetFileBlockLocations_args'). + oprot writeFieldBegin: (TField new name: 'path'; type: TType struct; id: 1). + [oprot writeStructBegin: (TStruct new name: 'Pathname'). + oprot writeFieldBegin: (TField new name: 'pathname'; type: TType string; id: -1). + iprot writeString: path pathname. + oprot writeFieldEnd. + oprot writeFieldStop; writeStructEnd] value. + oprot writeFieldEnd. + oprot writeFieldBegin: (TField new name: 'start'; type: TType i64; id: 2). + iprot writeI64: start asInteger. + oprot writeFieldEnd. + oprot writeFieldBegin: (TField new name: 'length'; type: TType i64; id: 3). + iprot writeI64: length asInteger. + oprot writeFieldEnd. + oprot writeFieldStop; writeStructEnd; writeMessageEnd. + oprot transport flush! ! + +!ThriftHadoopFileSystemClient methodsFor: 'as yet uncategorized' stamp: 'thrift 08/27/2008 14:54'! +recvGetFileBlockLocations + | f msg res | + msg := oprot readMessageBegin. + self validateRemoteMessage: msg. + res := [|temp123 temp122| + temp122 := TResult new. + iprot readStructBegin. + [temp123 := iprot readFieldBegin. + temp123 type = TType stop] whileFalse: [|temp124| + temp123 id = 0 ifTrue: [ + temp124 := true. + temp122 success: [|temp125 temp126| temp125 := iprot readListBegin. + temp126 := OrderedCollection new. + temp125 size timesRepeat: [ + temp126 add: [|temp128 temp127| + temp127 := BlockLocation new. + iprot readStructBegin. + [temp128 := iprot readFieldBegin. + temp128 type = TType stop] whileFalse: [|temp129| + temp128 id = 1 ifTrue: [ + temp129 := true. + temp127 hosts: [|temp130 temp131| temp130 := iprot readListBegin. + temp131 := OrderedCollection new. + temp130 size timesRepeat: [ + temp131 add: iprot readString]. + iprot readListEnd. + temp131] value]. + temp128 id = 2 ifTrue: [ + temp129 := true. + temp127 names: [|temp132 temp133| temp132 := iprot readListBegin. + temp133 := OrderedCollection new. + temp132 size timesRepeat: [ + temp133 add: iprot readString]. + iprot readListEnd. + temp133] value]. + temp128 id = 3 ifTrue: [ + temp129 := true. + temp127 offset: iprot readI64]. + temp128 id = 4 ifTrue: [ + temp129 := true. + temp127 length: iprot readI64]. + temp129 ifNil: [iprot skip: temp128 type]]. + oprot readStructEnd. + temp127] value]. + iprot readListEnd. + temp126] value]. + temp123 id = 1 ifTrue: [ + temp124 := true. + temp122 exception: [|temp135 temp134| + temp134 := ThriftIOException new. + iprot readStructBegin. + [temp135 := iprot readFieldBegin. + temp135 type = TType stop] whileFalse: [|temp136| + temp135 id = -1 ifTrue: [ + temp136 := true. + temp134 message: iprot readString]. + temp136 ifNil: [iprot skip: temp135 type]]. + oprot readStructEnd. + temp134] value]. + temp124 ifNil: [iprot skip: temp123 type]]. + oprot readStructEnd. + temp122] value. + oprot readMessageEnd. + oprot transport flush. + res exception ifNotNil: [res exception signal]. + ^ res! ! + +Hadoopfs enums keysAndValuesDo: [:k :v | Hadoopfs enums at: k put: v value].! +Hadoopfs constants keysAndValuesDo: [:k :v | Hadoopfs constants at: k put: v value].! Added: hadoop/core/trunk/src/contrib/thriftfs/if/hadoopfs.thrift URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/contrib/thriftfs/if/hadoopfs.thrift?rev=690096&view=auto ============================================================================== --- hadoop/core/trunk/src/contrib/thriftfs/if/hadoopfs.thrift (added) +++ hadoop/core/trunk/src/contrib/thriftfs/if/hadoopfs.thrift Thu Aug 28 21:31:57 2008 @@ -0,0 +1,126 @@ + +#!/usr/local/bin/thrift -java +# +# Thrift Service exported by Hadoop File System +# Dhruba Borthakur (dhruba@gmail.com) +# + +/** + * The available types in Thrift: + * + * bool Boolean, one byte + * byte Signed byte + * i16 Signed 16-bit integer + * i32 Signed 32-bit integer + * i64 Signed 64-bit integer + * double 64-bit floating point value + * string String + * map Map from one type to another + * list Ordered list of one type + * set Set of unique elements of one type + * + */ + +namespace java org.apache.hadoop.thriftfs.api +namespace php hadoopfs + +struct ThriftHandle { + i64 id +} + +struct Pathname { + string pathname +} + +struct FileStatus { + 1: string path, + 2: i64 length, + 3: bool isdir, + 4: i16 block_replication, + 5: i64 blocksize, + 6: i64 modification_time, + 7: string permission, + 8: string owner, + 9: string group +} + +struct BlockLocation { + 1: list hosts, /* hostnames of datanodes */ + 2: list names, /* hostname:portNumber of datanodes */ + 3: i64 offset, /* offset of the block in the file */ + 4: i64 length /* length of data */ +} + +exception MalformedInputException { + string message +} + +exception ThriftIOException { + string message +} + +service ThriftHadoopFileSystem +{ + + // set inactivity timeout period. The period is specified in seconds. + // if there are no RPC calls to the HadoopThrift server for this much + // time, then the server kills itself. + void setInactivityTimeoutPeriod(1:i64 periodInSeconds), + + // close session + void shutdown(1:i32 status), + + // create a file and open it for writing + ThriftHandle create(1:Pathname path) throws (1:ThriftIOException ouch), + + // create a file and open it for writing + ThriftHandle createFile(1:Pathname path, 2:i16 mode, + 3:bool overwrite, 4:i32 bufferSize, + 5:i16 block_replication, 6:i64 blocksize) + throws (1:ThriftIOException ouch), + + // returns a handle to an existing file for reading + ThriftHandle open(1:Pathname path) throws (1:ThriftIOException ouch), + + // returns a handle to an existing file for appending to it. + ThriftHandle append(1:Pathname path) throws (1:ThriftIOException ouch), + + // write a string to the open handle for the file + bool write(1:ThriftHandle handle, string data) throws (1:ThriftIOException ouch), + + // read some bytes from the open handle for the file + string read(1:ThriftHandle handle, i64 offset, i32 size) throws (1:ThriftIOException ouch), + + // close file + bool close(1:ThriftHandle out) throws (1:ThriftIOException ouch), + + // delete file(s) or directory(s) + bool rm(1:Pathname path, 2:bool recursive) throws (1:ThriftIOException ouch), + + // rename file(s) or directory(s) + bool rename(1:Pathname path, 2:Pathname dest) throws (1:ThriftIOException ouch), + + // create directory + bool mkdirs(1:Pathname path) throws (1:ThriftIOException ouch), + + // Does this pathname exist? + bool exists(1:Pathname path) throws (1:ThriftIOException ouch), + + // Returns status about the path + FileStatus stat(1:Pathname path) throws (1:ThriftIOException ouch), + + // If the path is a directory, then returns the list of pathnames in that directory + list listStatus(1:Pathname path) throws (1:ThriftIOException ouch), + + // Set permission for this file + void chmod(1:Pathname path, 2:i16 mode) throws (1:ThriftIOException ouch), + + // set the owner and group of the file. + void chown(1:Pathname path, 2:string owner, 3:string group) throws (1:ThriftIOException ouch), + + // set the replication factor for all blocks of the specified file + void setReplication(1:Pathname path, 2:i16 replication) throws (1:ThriftIOException ouch), + + // get the locations of the blocks of this file + list getFileBlockLocations(1:Pathname path, 2:i64 start, 3:i64 length) throws (1:ThriftIOException ouch), +} Added: hadoop/core/trunk/src/contrib/thriftfs/lib/README URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/contrib/thriftfs/lib/README?rev=690096&view=auto ============================================================================== --- hadoop/core/trunk/src/contrib/thriftfs/lib/README (added) +++ hadoop/core/trunk/src/contrib/thriftfs/lib/README Thu Aug 28 21:31:57 2008 @@ -0,0 +1 @@ +Thrift is from http://developers.facebook.com/thrift/. Added: hadoop/core/trunk/src/contrib/thriftfs/lib/Thrift.LICENSE URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/contrib/thriftfs/lib/Thrift.LICENSE?rev=690096&view=auto ============================================================================== --- hadoop/core/trunk/src/contrib/thriftfs/lib/Thrift.LICENSE (added) +++ hadoop/core/trunk/src/contrib/thriftfs/lib/Thrift.LICENSE Thu Aug 28 21:31:57 2008 @@ -0,0 +1,24 @@ +Thrift Software License +Copyright (c) 2006- Facebook, Inc. + +Permission is hereby granted, free of charge, to any person or organization +obtaining a copy of the software and accompanying documentation covered by +this license (the "Software") to use, reproduce, display, distribute, +execute, and transmit the Software, and to prepare derivative works of the +Software, and to permit third-parties to whom the Software is furnished to +do so, all subject to the following: + +The copyright notices in the Software and this entire statement, including +the above license grant, this restriction and the following disclaimer, +must be included in all copies of the Software, in whole or in part, and +all derivative works of the Software, unless such copies or derivative +works are solely in the form of machine-executable object code generated by +a source language processor. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. Added: hadoop/core/trunk/src/contrib/thriftfs/lib/hadoopthriftapi.jar URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/contrib/thriftfs/lib/hadoopthriftapi.jar?rev=690096&view=auto ============================================================================== Binary file - no diff available. Propchange: hadoop/core/trunk/src/contrib/thriftfs/lib/hadoopthriftapi.jar ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: hadoop/core/trunk/src/contrib/thriftfs/lib/libthrift.jar URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/contrib/thriftfs/lib/libthrift.jar?rev=690096&view=auto ============================================================================== Binary file - no diff available. Propchange: hadoop/core/trunk/src/contrib/thriftfs/lib/libthrift.jar ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: hadoop/core/trunk/src/contrib/thriftfs/scripts/hdfs.py URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/contrib/thriftfs/scripts/hdfs.py?rev=690096&view=auto ============================================================================== --- hadoop/core/trunk/src/contrib/thriftfs/scripts/hdfs.py (added) +++ hadoop/core/trunk/src/contrib/thriftfs/scripts/hdfs.py Thu Aug 28 21:31:57 2008 @@ -0,0 +1,555 @@ +#!/usr/bin/env python + +""" + hdfs.py is a python client for the thrift interface to HDFS. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied. See the License for the specific language governing permissions + and limitations under the License. + +""" +import sys +sys.path.append('../gen-py') + +from optparse import OptionParser +from thrift import Thrift +from thrift.transport import TSocket +from thrift.transport import TTransport +from thrift.protocol import TBinaryProtocol +from hadoopfs import ThriftHadoopFileSystem +from hadoopfs.ttypes import * +from readline import * +from cmd import * +import os +import re +import readline +import subprocess + +# +# The address of the FileSystemClientProxy. If the host and port are +# not specified, then a proxy server is automatically spawned. +# +host = 'localhost' +port = 4677 # use any port +proxyStartScript = './start_thrift_server.sh' +startServer = True # shall we start a proxy server? + +# +# The hdfs interactive shell. The Cmd class is a builtin that uses readline + implements +# a whole bunch of utility stuff like help and custom tab completions. +# It makes everything real easy. +# +class hadoopthrift_cli(Cmd): + + # my custom prompt looks better than the default + prompt = 'hdfs>> ' + + ############################# + # Class constructor + ############################# + def __init__(self, server_name, server_port): + Cmd.__init__(self) + self.server_name = server_name + self.server_port = server_port + + ############################# + # Start the ClientProxy Server if we can find it. + # Read in its stdout to determine what port it is running on + ############################# + def startProxyServer(self): + try: + p = subprocess.Popen(proxyStartScript, self.server_port, stdout=subprocess.PIPE) + content = p.stdout.readline() + p.stdout.close() + val = re.split( '\[|\]', content) + print val[1] + self.server_port = val[1] + return True + + except Exception, ex: + print "ERROR in starting proxy server " + proxyStartScript + print '%s' % (ex.message) + return False + + ############################# + # Connect to clientproxy + ############################# + def connect(self): + try: + # connect to hdfs thrift server + self.transport = TSocket.TSocket(self.server_name, self.server_port) + self.transport = TTransport.TBufferedTransport(self.transport) + self.protocol = TBinaryProtocol.TBinaryProtocol(self.transport) + + # Create a client to use the protocol encoder + self.client = ThriftHadoopFileSystem.Client(self.protocol) + self.transport.open() + + # tell the HadoopThrift server to die after 60 minutes of inactivity + self.client.setInactivityTimeoutPeriod(60*60) + return True + + except Thrift.TException, tx: + print "ERROR in connecting to ", self.server_name, ":", self.server_port + print '%s' % (tx.message) + return False + + + # + # Disconnect from client proxy + # + def shutdown(self): + try : + self.transport.close() + except Exception, tx: + return False + + ############################# + # Create the specified file. Returns a handle to write data. + ############################# + def do_create(self, name): + if name == "": + print " ERROR usage: create " + print + return 0 + + # Create the file, and immediately closes the handle + path = Pathname(); + path.pathname = name; + status = self.client.create(path) + self.client.close(status) + return 0 + + ############################# + # Delete the specified file. + ############################# + def do_rm(self, name): + if name == "": + print " ERROR usage: rm \n" + return 0 + + # delete file + path = Pathname(); + path.pathname = name; + status = self.client.rm(path, False) + if status == False: + print " ERROR in deleting path: " + name + return 0 + + ############################# + # Rename the specified file/dir + ############################# + def do_mv(self, line): + params = line.split() + if (len(params) != 2): + print " ERROR usage: mv \n" + return 0 + src = params[0].strip() + dest = params[1].strip() + + if src == "": + print " ERROR usage: mv \n" + return 0 + if dest == "": + print " ERROR usage: mv \n" + return 0 + + # move file + path = Pathname(); + path.pathname = src; + destpath = Pathname(); + destpath.pathname = dest; + status = self.client.rename(path, destpath) + if status == False: + print " ERROR in renaming path: " + name + return 0 + + ############################# + # Delete the specified file. + ############################# + def do_mkdirs(self, name): + if name == "": + print " ERROR usage: mkdirs \n" + return 0 + + # create directory + path = Pathname(); + path.pathname = name; + fields = self.client.mkdirs(path) + return 0 + + ############################# + # does the pathname exist? + ############################# + def do_exists(self, name): + if name == "": + print " ERROR usage: exists \n" + return 0 + + # check existence of pathname + path = Pathname(); + path.pathname = name; + fields = self.client.exists(path) + if (fields == True): + print name + " exists." + else: + print name + " does not exist." + return 0 + + ############################# + # copy local file into hdfs + ############################# + def do_put(self, line): + params = line.split() + if (len(params) != 2): + print " ERROR usage: put \n" + return 0 + local = params[0].strip() + hdfs = params[1].strip() + + if local == "": + print " ERROR usage: put \n" + return 0 + if hdfs == "": + print " ERROR usage: put \n" + return 0 + + # open local file + input = open(local, 'rb') + + # open output file + path = Pathname(); + path.pathname = hdfs; + output = self.client.create(path) + + # read 1MB at a time and upload to hdfs + while True: + chunk = input.read(1024*1024) + if not chunk: break + self.client.write(output, chunk) + + self.client.close(output) + input.close() + + ############################# + # copy hdfs file into local + ############################# + def do_get(self, line): + params = line.split() + if (len(params) != 2): + print " ERROR usage: get \n" + return 0 + hdfs = params[0].strip() + local = params[1].strip() + + if local == "": + print " ERROR usage: get \n" + return 0 + if hdfs == "": + print " ERROR usage: get \n" + return 0 + + # open output local file + output = open(local, 'wb') + + # open input hdfs file + path = Pathname(); + path.pathname = hdfs; + input = self.client.open(path) + + # find size of hdfs file + filesize = self.client.stat(path).length + + # read 1MB bytes at a time from hdfs + offset = 0 + chunksize = 1024 * 1024 + while True: + chunk = self.client.read(input, offset, chunksize) + if not chunk: break + output.write(chunk) + offset += chunksize + if (offset >= filesize): break + + self.client.close(input) + output.close() + + ############################# + # List attributes of this path + ############################# + def do_ls(self, name): + if name == "": + print " ERROR usage: list \n" + return 0 + + # list file status + path = Pathname(); + path.pathname = name; + status = self.client.stat(path) + if (status.isdir == False): + self.printStatus(status) + return 0 + + # This is a directory, fetch its contents + liststatus = self.client.listStatus(path) + for item in liststatus: + self.printStatus(item) + + ############################# + # Set permissions for a file + ############################# + def do_chmod(self, line): + params = line.split() + if (len(params) != 2): + print " ERROR usage: chmod 774 \n" + return 0 + perm = params[0].strip() + name = params[1].strip() + + if name == "": + print " ERROR usage: chmod 774 \n" + return 0 + if perm == "": + print " ERROR usage: chmod 774 \n" + return 0 + + # set permissions (in octal) + path = Pathname(); + path.pathname = name; + status = self.client.chmod(path, int(perm,8)) + return 0 + + ############################# + # Set owner for a file. This is not an atomic operation. + # A change to the group of a file may be overwritten by this one. + ############################# + def do_chown(self, line): + params = line.split() + if (len(params) != 2): + print " ERROR usage: chown \n" + return 0 + owner = params[0].strip() + name = params[1].strip() + if name == "": + print " ERROR usage: chown \n" + return 0 + + # get the current owner and group + path = Pathname(); + path.pathname = name; + cur = self.client.stat(path) + + # set new owner, keep old group + status = self.client.chown(path, owner, cur.group) + return 0 + + ####################################### + # Set the replication factor for a file + ###################################### + def do_setreplication(self, line): + params = line.split() + if (len(params) != 2): + print " ERROR usage: setreplication \n" + return 0 + repl = params[0].strip() + name = params[1].strip() + if name == "": + print " ERROR usage: setreplication \n" + return 0 + if repl == "": + print " ERROR usage: setreplication \n" + return 0 + + path = Pathname(); + path.pathname = name; + status = self.client.setReplication(path, int(repl)) + return 0 + + ############################# + # Display the locations of the blocks of this file + ############################# + def do_getlocations(self, name): + if name == "": + print " ERROR usage: getlocations \n" + return 0 + path = Pathname(); + path.pathname = name; + + # find size of hdfs file + filesize = self.client.stat(path).length + + # getlocations file + blockLocations = self.client.getFileBlockLocations(path, 0, filesize) + for item in blockLocations: + self.printLocations(item) + + return 0 + + ############################# + # Utility methods from here + ############################# + # + # If I don't do this, the last command is always re-executed which is annoying. + # + def emptyline(self): + pass + + # + # print the status of a path + # + def printStatus(self, stat): + print str(stat.block_replication) + "\t" + str(stat.length) + "\t" + str(stat.modification_time) + "\t" + stat.permission + "\t" + stat.owner + "\t" + stat.group + "\t" + stat.path + + # + # print the locations of a block + # + def printLocations(self, location): + print str(location.names) + "\t" + str(location.offset) + "\t" + str(location.length) + + # + # Various ways to exit the hdfs shell + # + def do_quit(self,ignored): + try: + if startServer: + self.client.shutdown(1) + return -1 + except Exception, ex: + return -1 + + def do_q(self,ignored): + return self.do_quit(ignored) + + # ctl-d + def do_EOF(self,ignored): + return self.do_quit(ignored) + + # + # Give the user some amount of help - I am a nice guy + # + + def help_create(self): + print "create " + + def help_rm(self): + print "rm " + + def help_mv(self): + print "mv " + + def help_mkdirs(self): + print "mkdirs " + + def help_exists(self): + print "exists " + + def help_put(self): + print "put " + + def help_get(self): + print "get " + + def help_ls(self): + print "ls " + + def help_chmod(self): + print "chmod 775 " + + def help_chown(self): + print "chown " + + def help_setreplication(self): + print "setrep " + + def help_getlocations(self): + print "getlocations " + + def help_EOF(self): + print ' will quit this program.' + + def help_quit(self): + print 'if you need to know what quit does, you shouldn\'t be using a computer.' + + def help_q(self): + print 'quit and if you need to know what quit does, you shouldn\'t be using a computer.' + + def help_help(self): + print 'duh' + + def usage(exec_name): + print "Usage: " + print " %s [proxyclientname [proxyclientport]]" % exec_name + print " %s -v" % exec_name + print " %s --help" % exec_name + print " %s -h" % exec_name + +if __name__ == "__main__": + + # + # Rudimentary command line processing. + # + + # real parsing: + parser = OptionParser() + parser.add_option("-e", "--execute", dest="command_str", + help="execute this command and exit") + parser.add_option("-s","--proxyclient",dest="host",help="the proxyclient's hostname") + parser.add_option("-p","--port",dest="port",help="the proxyclient's port number") + + (options, args) = parser.parse_args() + + # + # Save host and port information of the proxy server + # + if (options.host): + host = options.host + startServer = False + if (options.port): + port = options.port + startServer = False + + # + # Retrieve the user's readline history. + # + historyFileName = os.path.expanduser("~/.hdfs_history") + if (os.path.exists(historyFileName)): + readline.read_history_file(historyFileName) + + # + # Create class and connect to proxy server + # + c = hadoopthrift_cli(host,port) + + if startServer: + if c.startProxyServer() == False: + sys.exit(1) + if c.connect() == False: + sys.exit(1) + + + # + # If this utility was invoked with one argument, process it + # + if (options.command_str): + c.onecmd(options.command_str) + sys.exit(0) + + # + # Start looping over user commands. + # + c.cmdloop('Welcome to the Thrift interactive shell for Hadoop File System. - how can I help you? ' + '\n' + 'Press tab twice to see the list of commands. ' + '\n' + + 'To complete the name of a command press tab once. \n' + ) + c.shutdown(); + + readline.write_history_file(historyFileName) + print '' # I am nothing if not courteous. + sys.exit(0) Propchange: hadoop/core/trunk/src/contrib/thriftfs/scripts/hdfs.py ------------------------------------------------------------------------------ svn:executable = * Added: hadoop/core/trunk/src/contrib/thriftfs/scripts/start_thrift_server.sh URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/contrib/thriftfs/scripts/start_thrift_server.sh?rev=690096&view=auto ============================================================================== --- hadoop/core/trunk/src/contrib/thriftfs/scripts/start_thrift_server.sh (added) +++ hadoop/core/trunk/src/contrib/thriftfs/scripts/start_thrift_server.sh Thu Aug 28 21:31:57 2008 @@ -0,0 +1,31 @@ +#!/bin/sh + +CLASSPATH= +TOP=../../../.. + +# the hadoop libraries +for f in $TOP/build/*.jar ; do + CLASSPATH=$CLASSPATH:$f +done + +# the apache libraries +for f in $TOP/lib/*.jar ; do + CLASSPATH=$CLASSPATH:$f +done + +# the thrift libraries +for f in $TOP/lib/thrift/*.jar ; do + CLASSPATH=$CLASSPATH:$f +done + +# the thrift server +for f in $TOP/build/contrib/thriftfs/*.jar ; do + CLASSPATH=$CLASSPATH:$f +done +# the thrift hadoop api +for f in $TOP/src/contrib/thriftfs/lib/*.jar ; do + CLASSPATH=$CLASSPATH:$f +done + +java -Dcom.sun.management.jmxremote -cp $CLASSPATH org.apache.hadoop.thriftfs.HadoopThriftServer $* + Propchange: hadoop/core/trunk/src/contrib/thriftfs/scripts/start_thrift_server.sh ------------------------------------------------------------------------------ svn:executable = *