ganapati 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/hdfs_thrift_server +20 -0
- data/lib/ganapati.rb +7 -0
- data/lib/ganapati/client.rb +124 -0
- data/lib/ganapati/hfile.rb +37 -0
- data/lib/thrift/hadoopfs_constants.rb +8 -0
- data/lib/thrift/hadoopfs_types.rb +135 -0
- data/lib/thrift/thrift_hadoop_file_system.rb +1188 -0
- metadata +88 -0
@@ -0,0 +1,20 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
JARFILE=$HADOOP_HOME/lib/HadoopThriftServer.jar
|
3
|
+
CONTRIBLIB=$HADOOP_HOME/src/contrib/thriftfs/lib
|
4
|
+
CLASSPATH=$(ls $HADOOP_HOME/hadoop-core-*.jar):$(ls $HADOOP_HOME/lib/commons-logging-api-*.jar):$CONTRIBLIB/hadoopthriftapi.jar:$CONTRIBLIB/libthrift.jar:$HADOOP_HOME/conf
|
5
|
+
|
6
|
+
if [ "$1" == "" ]; then
|
7
|
+
echo "Usage: $0 <port>"
|
8
|
+
exit 1
|
9
|
+
fi
|
10
|
+
|
11
|
+
if [ ! -e "$JARFILE" ]; then
|
12
|
+
echo "Creating thrift server jar file at $JARFILE"
|
13
|
+
mkdir -p /tmp/HadoopThriftServer
|
14
|
+
javac -classpath $CLASSPATH -d /tmp/HadoopThriftServer/ $CONTRIBLIB/../src/java/org/apache/hadoop/thriftfs/HadoopThriftServer.java
|
15
|
+
jar -cf $JARFILE -C /tmp/HadoopThriftServer/ .
|
16
|
+
else
|
17
|
+
echo "Found jar file at $JARFILE"
|
18
|
+
fi
|
19
|
+
|
20
|
+
java -Dcom.sun.management.jmxremote -cp $JARFILE:$CLASSPATH org.apache.hadoop.thriftfs.HadoopThriftServer $1
|
data/lib/ganapati.rb
ADDED
@@ -0,0 +1,124 @@
|
|
1
|
+
module Ganapati
|
2
|
+
|
3
|
+
class Client
|
4
|
+
def initialize(server, port, timeout=60)
|
5
|
+
socket = Thrift::Socket.new(server, port)
|
6
|
+
@transport = Thrift::BufferedTransport.new(socket)
|
7
|
+
@transport.open
|
8
|
+
protocol = Thrift::BinaryProtocol.new(@transport)
|
9
|
+
@client = ThriftHadoopFileSystem::Client.new(protocol)
|
10
|
+
@client.setInactivityTimeoutPeriod(timeout)
|
11
|
+
end
|
12
|
+
|
13
|
+
def close
|
14
|
+
@transport.close
|
15
|
+
end
|
16
|
+
|
17
|
+
# shutdown the thrift server
|
18
|
+
def shutdown(status=0)
|
19
|
+
@client.shutdown status
|
20
|
+
end
|
21
|
+
|
22
|
+
# copy local file to remote
|
23
|
+
def put(localpath, destpath)
|
24
|
+
create(destpath) { |dest|
|
25
|
+
Kernel.open(localpath) { |source|
|
26
|
+
# read 1 MB at a time
|
27
|
+
while record = source.read(1048576)
|
28
|
+
dest.write(record)
|
29
|
+
end
|
30
|
+
}
|
31
|
+
}
|
32
|
+
end
|
33
|
+
|
34
|
+
# copy remote file to local
|
35
|
+
def get(remotepath, destpath)
|
36
|
+
Kernel.open(destpath, 'w') { |dest|
|
37
|
+
open(remotepath) { |source|
|
38
|
+
size = source.length
|
39
|
+
index = 0
|
40
|
+
while index < size
|
41
|
+
dest.write(source.read(index, 1048576))
|
42
|
+
index += 1048576
|
43
|
+
end
|
44
|
+
}
|
45
|
+
}
|
46
|
+
end
|
47
|
+
|
48
|
+
# for writing to a new file
|
49
|
+
def create(path, &block)
|
50
|
+
file_handle :create, path, &block
|
51
|
+
end
|
52
|
+
|
53
|
+
# for reading
|
54
|
+
def open(path, &block)
|
55
|
+
file_handle :open, path, &block
|
56
|
+
end
|
57
|
+
|
58
|
+
# for appending
|
59
|
+
def append(path, &block)
|
60
|
+
file_handle :append, path, &block
|
61
|
+
end
|
62
|
+
|
63
|
+
def rm(path, recursive=false)
|
64
|
+
@client.rm pname(path), recursive
|
65
|
+
end
|
66
|
+
|
67
|
+
def mv(source, dest)
|
68
|
+
@client.rename pname(source), pname(dest)
|
69
|
+
end
|
70
|
+
|
71
|
+
def mkdir(path)
|
72
|
+
@client.mkdirs pname(path)
|
73
|
+
end
|
74
|
+
|
75
|
+
def exists?(path)
|
76
|
+
@client.exists pname(path)
|
77
|
+
end
|
78
|
+
|
79
|
+
def stat(path)
|
80
|
+
@client.stat pname(path)
|
81
|
+
end
|
82
|
+
|
83
|
+
def ls(path, details=false)
|
84
|
+
statuses = @client.listStatus pname(path)
|
85
|
+
(details) ? statuses : statuses.map { |s| s.path }
|
86
|
+
end
|
87
|
+
|
88
|
+
def chmod(path, mode)
|
89
|
+
@client.chmod pname(path), mode
|
90
|
+
end
|
91
|
+
|
92
|
+
def chown(path, owner, group)
|
93
|
+
@client.chown pname(path), owner, group
|
94
|
+
end
|
95
|
+
|
96
|
+
def set_replication(path, level)
|
97
|
+
@client.setReplication pname(path), level
|
98
|
+
end
|
99
|
+
|
100
|
+
def self.run(server, port)
|
101
|
+
c = Client.new(server, port)
|
102
|
+
result = yield c
|
103
|
+
c.close
|
104
|
+
result
|
105
|
+
end
|
106
|
+
|
107
|
+
private
|
108
|
+
def file_handle(action, path)
|
109
|
+
pathname = pname(path)
|
110
|
+
fh = @client.send action, pathname
|
111
|
+
result = f = HFile.new(@client, fh, pathname)
|
112
|
+
if block_given?
|
113
|
+
result = yield f
|
114
|
+
f.close
|
115
|
+
end
|
116
|
+
result
|
117
|
+
end
|
118
|
+
|
119
|
+
def pname(path)
|
120
|
+
Pathname.new(:pathname => path.to_s)
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module Ganapati
|
2
|
+
|
3
|
+
class HFile
|
4
|
+
def initialize(client, handle, pathname)
|
5
|
+
@client = client
|
6
|
+
@handle = handle
|
7
|
+
@pathname = pathname
|
8
|
+
end
|
9
|
+
|
10
|
+
def write(data)
|
11
|
+
call :write, data
|
12
|
+
end
|
13
|
+
|
14
|
+
def read(offset=0, size=nil)
|
15
|
+
size ||= stat.length
|
16
|
+
call :read, offset, size
|
17
|
+
end
|
18
|
+
|
19
|
+
def close
|
20
|
+
call :close
|
21
|
+
end
|
22
|
+
|
23
|
+
def stat
|
24
|
+
@client.stat(@pathname)
|
25
|
+
end
|
26
|
+
|
27
|
+
def length
|
28
|
+
stat.length
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
def call(method, *args)
|
33
|
+
@client.send method, @handle, *args
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
@@ -0,0 +1,135 @@
|
|
1
|
+
#
|
2
|
+
# Autogenerated by Thrift
|
3
|
+
#
|
4
|
+
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
5
|
+
#
|
6
|
+
|
7
|
+
|
8
|
+
class ThriftHandle
|
9
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
10
|
+
ID = -1
|
11
|
+
|
12
|
+
FIELDS = {
|
13
|
+
ID => {:type => ::Thrift::Types::I64, :name => 'id'}
|
14
|
+
}
|
15
|
+
|
16
|
+
def struct_fields; FIELDS; end
|
17
|
+
|
18
|
+
def validate
|
19
|
+
end
|
20
|
+
|
21
|
+
::Thrift::Struct.generate_accessors self
|
22
|
+
end
|
23
|
+
|
24
|
+
class Pathname
|
25
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
26
|
+
PATHNAME = -1
|
27
|
+
|
28
|
+
FIELDS = {
|
29
|
+
PATHNAME => {:type => ::Thrift::Types::STRING, :name => 'pathname'}
|
30
|
+
}
|
31
|
+
|
32
|
+
def struct_fields; FIELDS; end
|
33
|
+
|
34
|
+
def validate
|
35
|
+
end
|
36
|
+
|
37
|
+
::Thrift::Struct.generate_accessors self
|
38
|
+
end
|
39
|
+
|
40
|
+
class FileStatus
|
41
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
42
|
+
PATH = 1
|
43
|
+
LENGTH = 2
|
44
|
+
ISDIR = 3
|
45
|
+
BLOCK_REPLICATION = 4
|
46
|
+
BLOCKSIZE = 5
|
47
|
+
MODIFICATION_TIME = 6
|
48
|
+
PERMISSION = 7
|
49
|
+
OWNER = 8
|
50
|
+
GROUP = 9
|
51
|
+
|
52
|
+
FIELDS = {
|
53
|
+
PATH => {:type => ::Thrift::Types::STRING, :name => 'path'},
|
54
|
+
LENGTH => {:type => ::Thrift::Types::I64, :name => 'length'},
|
55
|
+
ISDIR => {:type => ::Thrift::Types::BOOL, :name => 'isdir'},
|
56
|
+
BLOCK_REPLICATION => {:type => ::Thrift::Types::I16, :name => 'block_replication'},
|
57
|
+
BLOCKSIZE => {:type => ::Thrift::Types::I64, :name => 'blocksize'},
|
58
|
+
MODIFICATION_TIME => {:type => ::Thrift::Types::I64, :name => 'modification_time'},
|
59
|
+
PERMISSION => {:type => ::Thrift::Types::STRING, :name => 'permission'},
|
60
|
+
OWNER => {:type => ::Thrift::Types::STRING, :name => 'owner'},
|
61
|
+
GROUP => {:type => ::Thrift::Types::STRING, :name => 'group'}
|
62
|
+
}
|
63
|
+
|
64
|
+
def struct_fields; FIELDS; end
|
65
|
+
|
66
|
+
def validate
|
67
|
+
end
|
68
|
+
|
69
|
+
::Thrift::Struct.generate_accessors self
|
70
|
+
end
|
71
|
+
|
72
|
+
class BlockLocation
|
73
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
74
|
+
HOSTS = 1
|
75
|
+
NAMES = 2
|
76
|
+
OFFSET = 3
|
77
|
+
LENGTH = 4
|
78
|
+
|
79
|
+
FIELDS = {
|
80
|
+
HOSTS => {:type => ::Thrift::Types::LIST, :name => 'hosts', :element => {:type => ::Thrift::Types::STRING}},
|
81
|
+
NAMES => {:type => ::Thrift::Types::LIST, :name => 'names', :element => {:type => ::Thrift::Types::STRING}},
|
82
|
+
OFFSET => {:type => ::Thrift::Types::I64, :name => 'offset'},
|
83
|
+
LENGTH => {:type => ::Thrift::Types::I64, :name => 'length'}
|
84
|
+
}
|
85
|
+
|
86
|
+
def struct_fields; FIELDS; end
|
87
|
+
|
88
|
+
def validate
|
89
|
+
end
|
90
|
+
|
91
|
+
::Thrift::Struct.generate_accessors self
|
92
|
+
end
|
93
|
+
|
94
|
+
class MalformedInputException < ::Thrift::Exception
|
95
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
96
|
+
def initialize(message=nil)
|
97
|
+
super()
|
98
|
+
self.message = message
|
99
|
+
end
|
100
|
+
|
101
|
+
MESSAGE = -1
|
102
|
+
|
103
|
+
FIELDS = {
|
104
|
+
MESSAGE => {:type => ::Thrift::Types::STRING, :name => 'message'}
|
105
|
+
}
|
106
|
+
|
107
|
+
def struct_fields; FIELDS; end
|
108
|
+
|
109
|
+
def validate
|
110
|
+
end
|
111
|
+
|
112
|
+
::Thrift::Struct.generate_accessors self
|
113
|
+
end
|
114
|
+
|
115
|
+
class ThriftIOException < ::Thrift::Exception
|
116
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
117
|
+
def initialize(message=nil)
|
118
|
+
super()
|
119
|
+
self.message = message
|
120
|
+
end
|
121
|
+
|
122
|
+
MESSAGE = -1
|
123
|
+
|
124
|
+
FIELDS = {
|
125
|
+
MESSAGE => {:type => ::Thrift::Types::STRING, :name => 'message'}
|
126
|
+
}
|
127
|
+
|
128
|
+
def struct_fields; FIELDS; end
|
129
|
+
|
130
|
+
def validate
|
131
|
+
end
|
132
|
+
|
133
|
+
::Thrift::Struct.generate_accessors self
|
134
|
+
end
|
135
|
+
|
@@ -0,0 +1,1188 @@
|
|
1
|
+
#
|
2
|
+
# Autogenerated by Thrift
|
3
|
+
#
|
4
|
+
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
5
|
+
#
|
6
|
+
|
7
|
+
require 'thrift'
|
8
|
+
require 'hadoopfs_types'
|
9
|
+
|
10
|
+
module ThriftHadoopFileSystem
|
11
|
+
class Client
|
12
|
+
include ::Thrift::Client
|
13
|
+
|
14
|
+
def setInactivityTimeoutPeriod(periodInSeconds)
|
15
|
+
send_setInactivityTimeoutPeriod(periodInSeconds)
|
16
|
+
recv_setInactivityTimeoutPeriod()
|
17
|
+
end
|
18
|
+
|
19
|
+
def send_setInactivityTimeoutPeriod(periodInSeconds)
|
20
|
+
send_message('setInactivityTimeoutPeriod', SetInactivityTimeoutPeriod_args, :periodInSeconds => periodInSeconds)
|
21
|
+
end
|
22
|
+
|
23
|
+
def recv_setInactivityTimeoutPeriod()
|
24
|
+
result = receive_message(SetInactivityTimeoutPeriod_result)
|
25
|
+
return
|
26
|
+
end
|
27
|
+
|
28
|
+
def shutdown(status)
|
29
|
+
send_shutdown(status)
|
30
|
+
recv_shutdown()
|
31
|
+
end
|
32
|
+
|
33
|
+
def send_shutdown(status)
|
34
|
+
send_message('shutdown', Shutdown_args, :status => status)
|
35
|
+
end
|
36
|
+
|
37
|
+
def recv_shutdown()
|
38
|
+
result = receive_message(Shutdown_result)
|
39
|
+
return
|
40
|
+
end
|
41
|
+
|
42
|
+
def create(path)
|
43
|
+
send_create(path)
|
44
|
+
return recv_create()
|
45
|
+
end
|
46
|
+
|
47
|
+
def send_create(path)
|
48
|
+
send_message('create', Create_args, :path => path)
|
49
|
+
end
|
50
|
+
|
51
|
+
def recv_create()
|
52
|
+
result = receive_message(Create_result)
|
53
|
+
return result.success unless result.success.nil?
|
54
|
+
raise result.ouch unless result.ouch.nil?
|
55
|
+
raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'create failed: unknown result')
|
56
|
+
end
|
57
|
+
|
58
|
+
def createFile(path, mode, overwrite, bufferSize, block_replication, blocksize)
|
59
|
+
send_createFile(path, mode, overwrite, bufferSize, block_replication, blocksize)
|
60
|
+
return recv_createFile()
|
61
|
+
end
|
62
|
+
|
63
|
+
def send_createFile(path, mode, overwrite, bufferSize, block_replication, blocksize)
|
64
|
+
send_message('createFile', CreateFile_args, :path => path, :mode => mode, :overwrite => overwrite, :bufferSize => bufferSize, :block_replication => block_replication, :blocksize => blocksize)
|
65
|
+
end
|
66
|
+
|
67
|
+
def recv_createFile()
|
68
|
+
result = receive_message(CreateFile_result)
|
69
|
+
return result.success unless result.success.nil?
|
70
|
+
raise result.ouch unless result.ouch.nil?
|
71
|
+
raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'createFile failed: unknown result')
|
72
|
+
end
|
73
|
+
|
74
|
+
def open(path)
|
75
|
+
send_open(path)
|
76
|
+
return recv_open()
|
77
|
+
end
|
78
|
+
|
79
|
+
def send_open(path)
|
80
|
+
send_message('open', Open_args, :path => path)
|
81
|
+
end
|
82
|
+
|
83
|
+
def recv_open()
|
84
|
+
result = receive_message(Open_result)
|
85
|
+
return result.success unless result.success.nil?
|
86
|
+
raise result.ouch unless result.ouch.nil?
|
87
|
+
raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'open failed: unknown result')
|
88
|
+
end
|
89
|
+
|
90
|
+
def append(path)
|
91
|
+
send_append(path)
|
92
|
+
return recv_append()
|
93
|
+
end
|
94
|
+
|
95
|
+
def send_append(path)
|
96
|
+
send_message('append', Append_args, :path => path)
|
97
|
+
end
|
98
|
+
|
99
|
+
def recv_append()
|
100
|
+
result = receive_message(Append_result)
|
101
|
+
return result.success unless result.success.nil?
|
102
|
+
raise result.ouch unless result.ouch.nil?
|
103
|
+
raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'append failed: unknown result')
|
104
|
+
end
|
105
|
+
|
106
|
+
def write(handle, data)
|
107
|
+
send_write(handle, data)
|
108
|
+
return recv_write()
|
109
|
+
end
|
110
|
+
|
111
|
+
def send_write(handle, data)
|
112
|
+
send_message('write', Write_args, :handle => handle, :data => data)
|
113
|
+
end
|
114
|
+
|
115
|
+
def recv_write()
|
116
|
+
result = receive_message(Write_result)
|
117
|
+
return result.success unless result.success.nil?
|
118
|
+
raise result.ouch unless result.ouch.nil?
|
119
|
+
raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'write failed: unknown result')
|
120
|
+
end
|
121
|
+
|
122
|
+
def read(handle, offset, size)
|
123
|
+
send_read(handle, offset, size)
|
124
|
+
return recv_read()
|
125
|
+
end
|
126
|
+
|
127
|
+
def send_read(handle, offset, size)
|
128
|
+
send_message('read', Read_args, :handle => handle, :offset => offset, :size => size)
|
129
|
+
end
|
130
|
+
|
131
|
+
def recv_read()
|
132
|
+
result = receive_message(Read_result)
|
133
|
+
return result.success unless result.success.nil?
|
134
|
+
raise result.ouch unless result.ouch.nil?
|
135
|
+
raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'read failed: unknown result')
|
136
|
+
end
|
137
|
+
|
138
|
+
def close(out)
|
139
|
+
send_close(out)
|
140
|
+
return recv_close()
|
141
|
+
end
|
142
|
+
|
143
|
+
def send_close(out)
|
144
|
+
send_message('close', Close_args, :out => out)
|
145
|
+
end
|
146
|
+
|
147
|
+
def recv_close()
|
148
|
+
result = receive_message(Close_result)
|
149
|
+
return result.success unless result.success.nil?
|
150
|
+
raise result.ouch unless result.ouch.nil?
|
151
|
+
raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'close failed: unknown result')
|
152
|
+
end
|
153
|
+
|
154
|
+
def rm(path, recursive)
|
155
|
+
send_rm(path, recursive)
|
156
|
+
return recv_rm()
|
157
|
+
end
|
158
|
+
|
159
|
+
def send_rm(path, recursive)
|
160
|
+
send_message('rm', Rm_args, :path => path, :recursive => recursive)
|
161
|
+
end
|
162
|
+
|
163
|
+
def recv_rm()
|
164
|
+
result = receive_message(Rm_result)
|
165
|
+
return result.success unless result.success.nil?
|
166
|
+
raise result.ouch unless result.ouch.nil?
|
167
|
+
raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'rm failed: unknown result')
|
168
|
+
end
|
169
|
+
|
170
|
+
def rename(path, dest)
|
171
|
+
send_rename(path, dest)
|
172
|
+
return recv_rename()
|
173
|
+
end
|
174
|
+
|
175
|
+
def send_rename(path, dest)
|
176
|
+
send_message('rename', Rename_args, :path => path, :dest => dest)
|
177
|
+
end
|
178
|
+
|
179
|
+
def recv_rename()
|
180
|
+
result = receive_message(Rename_result)
|
181
|
+
return result.success unless result.success.nil?
|
182
|
+
raise result.ouch unless result.ouch.nil?
|
183
|
+
raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'rename failed: unknown result')
|
184
|
+
end
|
185
|
+
|
186
|
+
def mkdirs(path)
|
187
|
+
send_mkdirs(path)
|
188
|
+
return recv_mkdirs()
|
189
|
+
end
|
190
|
+
|
191
|
+
def send_mkdirs(path)
|
192
|
+
send_message('mkdirs', Mkdirs_args, :path => path)
|
193
|
+
end
|
194
|
+
|
195
|
+
def recv_mkdirs()
|
196
|
+
result = receive_message(Mkdirs_result)
|
197
|
+
return result.success unless result.success.nil?
|
198
|
+
raise result.ouch unless result.ouch.nil?
|
199
|
+
raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'mkdirs failed: unknown result')
|
200
|
+
end
|
201
|
+
|
202
|
+
def exists(path)
|
203
|
+
send_exists(path)
|
204
|
+
return recv_exists()
|
205
|
+
end
|
206
|
+
|
207
|
+
def send_exists(path)
|
208
|
+
send_message('exists', Exists_args, :path => path)
|
209
|
+
end
|
210
|
+
|
211
|
+
def recv_exists()
|
212
|
+
result = receive_message(Exists_result)
|
213
|
+
return result.success unless result.success.nil?
|
214
|
+
raise result.ouch unless result.ouch.nil?
|
215
|
+
raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'exists failed: unknown result')
|
216
|
+
end
|
217
|
+
|
218
|
+
def stat(path)
|
219
|
+
send_stat(path)
|
220
|
+
return recv_stat()
|
221
|
+
end
|
222
|
+
|
223
|
+
def send_stat(path)
|
224
|
+
send_message('stat', Stat_args, :path => path)
|
225
|
+
end
|
226
|
+
|
227
|
+
def recv_stat()
|
228
|
+
result = receive_message(Stat_result)
|
229
|
+
return result.success unless result.success.nil?
|
230
|
+
raise result.ouch unless result.ouch.nil?
|
231
|
+
raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'stat failed: unknown result')
|
232
|
+
end
|
233
|
+
|
234
|
+
def listStatus(path)
|
235
|
+
send_listStatus(path)
|
236
|
+
return recv_listStatus()
|
237
|
+
end
|
238
|
+
|
239
|
+
def send_listStatus(path)
|
240
|
+
send_message('listStatus', ListStatus_args, :path => path)
|
241
|
+
end
|
242
|
+
|
243
|
+
def recv_listStatus()
|
244
|
+
result = receive_message(ListStatus_result)
|
245
|
+
return result.success unless result.success.nil?
|
246
|
+
raise result.ouch unless result.ouch.nil?
|
247
|
+
raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'listStatus failed: unknown result')
|
248
|
+
end
|
249
|
+
|
250
|
+
def chmod(path, mode)
|
251
|
+
send_chmod(path, mode)
|
252
|
+
recv_chmod()
|
253
|
+
end
|
254
|
+
|
255
|
+
def send_chmod(path, mode)
|
256
|
+
send_message('chmod', Chmod_args, :path => path, :mode => mode)
|
257
|
+
end
|
258
|
+
|
259
|
+
def recv_chmod()
|
260
|
+
result = receive_message(Chmod_result)
|
261
|
+
raise result.ouch unless result.ouch.nil?
|
262
|
+
return
|
263
|
+
end
|
264
|
+
|
265
|
+
def chown(path, owner, group)
|
266
|
+
send_chown(path, owner, group)
|
267
|
+
recv_chown()
|
268
|
+
end
|
269
|
+
|
270
|
+
def send_chown(path, owner, group)
|
271
|
+
send_message('chown', Chown_args, :path => path, :owner => owner, :group => group)
|
272
|
+
end
|
273
|
+
|
274
|
+
def recv_chown()
|
275
|
+
result = receive_message(Chown_result)
|
276
|
+
raise result.ouch unless result.ouch.nil?
|
277
|
+
return
|
278
|
+
end
|
279
|
+
|
280
|
+
def setReplication(path, replication)
|
281
|
+
send_setReplication(path, replication)
|
282
|
+
recv_setReplication()
|
283
|
+
end
|
284
|
+
|
285
|
+
def send_setReplication(path, replication)
|
286
|
+
send_message('setReplication', SetReplication_args, :path => path, :replication => replication)
|
287
|
+
end
|
288
|
+
|
289
|
+
def recv_setReplication()
|
290
|
+
result = receive_message(SetReplication_result)
|
291
|
+
raise result.ouch unless result.ouch.nil?
|
292
|
+
return
|
293
|
+
end
|
294
|
+
|
295
|
+
def getFileBlockLocations(path, start, length)
|
296
|
+
send_getFileBlockLocations(path, start, length)
|
297
|
+
return recv_getFileBlockLocations()
|
298
|
+
end
|
299
|
+
|
300
|
+
def send_getFileBlockLocations(path, start, length)
|
301
|
+
send_message('getFileBlockLocations', GetFileBlockLocations_args, :path => path, :start => start, :length => length)
|
302
|
+
end
|
303
|
+
|
304
|
+
def recv_getFileBlockLocations()
|
305
|
+
result = receive_message(GetFileBlockLocations_result)
|
306
|
+
return result.success unless result.success.nil?
|
307
|
+
raise result.ouch unless result.ouch.nil?
|
308
|
+
raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getFileBlockLocations failed: unknown result')
|
309
|
+
end
|
310
|
+
|
311
|
+
end
|
312
|
+
|
313
|
+
class Processor
|
314
|
+
include ::Thrift::Processor
|
315
|
+
|
316
|
+
def process_setInactivityTimeoutPeriod(seqid, iprot, oprot)
|
317
|
+
args = read_args(iprot, SetInactivityTimeoutPeriod_args)
|
318
|
+
result = SetInactivityTimeoutPeriod_result.new()
|
319
|
+
@handler.setInactivityTimeoutPeriod(args.periodInSeconds)
|
320
|
+
write_result(result, oprot, 'setInactivityTimeoutPeriod', seqid)
|
321
|
+
end
|
322
|
+
|
323
|
+
def process_shutdown(seqid, iprot, oprot)
|
324
|
+
args = read_args(iprot, Shutdown_args)
|
325
|
+
result = Shutdown_result.new()
|
326
|
+
@handler.shutdown(args.status)
|
327
|
+
write_result(result, oprot, 'shutdown', seqid)
|
328
|
+
end
|
329
|
+
|
330
|
+
def process_create(seqid, iprot, oprot)
|
331
|
+
args = read_args(iprot, Create_args)
|
332
|
+
result = Create_result.new()
|
333
|
+
begin
|
334
|
+
result.success = @handler.create(args.path)
|
335
|
+
rescue ThriftIOException => ouch
|
336
|
+
result.ouch = ouch
|
337
|
+
end
|
338
|
+
write_result(result, oprot, 'create', seqid)
|
339
|
+
end
|
340
|
+
|
341
|
+
def process_createFile(seqid, iprot, oprot)
|
342
|
+
args = read_args(iprot, CreateFile_args)
|
343
|
+
result = CreateFile_result.new()
|
344
|
+
begin
|
345
|
+
result.success = @handler.createFile(args.path, args.mode, args.overwrite, args.bufferSize, args.block_replication, args.blocksize)
|
346
|
+
rescue ThriftIOException => ouch
|
347
|
+
result.ouch = ouch
|
348
|
+
end
|
349
|
+
write_result(result, oprot, 'createFile', seqid)
|
350
|
+
end
|
351
|
+
|
352
|
+
def process_open(seqid, iprot, oprot)
|
353
|
+
args = read_args(iprot, Open_args)
|
354
|
+
result = Open_result.new()
|
355
|
+
begin
|
356
|
+
result.success = @handler.open(args.path)
|
357
|
+
rescue ThriftIOException => ouch
|
358
|
+
result.ouch = ouch
|
359
|
+
end
|
360
|
+
write_result(result, oprot, 'open', seqid)
|
361
|
+
end
|
362
|
+
|
363
|
+
def process_append(seqid, iprot, oprot)
|
364
|
+
args = read_args(iprot, Append_args)
|
365
|
+
result = Append_result.new()
|
366
|
+
begin
|
367
|
+
result.success = @handler.append(args.path)
|
368
|
+
rescue ThriftIOException => ouch
|
369
|
+
result.ouch = ouch
|
370
|
+
end
|
371
|
+
write_result(result, oprot, 'append', seqid)
|
372
|
+
end
|
373
|
+
|
374
|
+
def process_write(seqid, iprot, oprot)
|
375
|
+
args = read_args(iprot, Write_args)
|
376
|
+
result = Write_result.new()
|
377
|
+
begin
|
378
|
+
result.success = @handler.write(args.handle, args.data)
|
379
|
+
rescue ThriftIOException => ouch
|
380
|
+
result.ouch = ouch
|
381
|
+
end
|
382
|
+
write_result(result, oprot, 'write', seqid)
|
383
|
+
end
|
384
|
+
|
385
|
+
def process_read(seqid, iprot, oprot)
|
386
|
+
args = read_args(iprot, Read_args)
|
387
|
+
result = Read_result.new()
|
388
|
+
begin
|
389
|
+
result.success = @handler.read(args.handle, args.offset, args.size)
|
390
|
+
rescue ThriftIOException => ouch
|
391
|
+
result.ouch = ouch
|
392
|
+
end
|
393
|
+
write_result(result, oprot, 'read', seqid)
|
394
|
+
end
|
395
|
+
|
396
|
+
def process_close(seqid, iprot, oprot)
|
397
|
+
args = read_args(iprot, Close_args)
|
398
|
+
result = Close_result.new()
|
399
|
+
begin
|
400
|
+
result.success = @handler.close(args.out)
|
401
|
+
rescue ThriftIOException => ouch
|
402
|
+
result.ouch = ouch
|
403
|
+
end
|
404
|
+
write_result(result, oprot, 'close', seqid)
|
405
|
+
end
|
406
|
+
|
407
|
+
def process_rm(seqid, iprot, oprot)
|
408
|
+
args = read_args(iprot, Rm_args)
|
409
|
+
result = Rm_result.new()
|
410
|
+
begin
|
411
|
+
result.success = @handler.rm(args.path, args.recursive)
|
412
|
+
rescue ThriftIOException => ouch
|
413
|
+
result.ouch = ouch
|
414
|
+
end
|
415
|
+
write_result(result, oprot, 'rm', seqid)
|
416
|
+
end
|
417
|
+
|
418
|
+
def process_rename(seqid, iprot, oprot)
|
419
|
+
args = read_args(iprot, Rename_args)
|
420
|
+
result = Rename_result.new()
|
421
|
+
begin
|
422
|
+
result.success = @handler.rename(args.path, args.dest)
|
423
|
+
rescue ThriftIOException => ouch
|
424
|
+
result.ouch = ouch
|
425
|
+
end
|
426
|
+
write_result(result, oprot, 'rename', seqid)
|
427
|
+
end
|
428
|
+
|
429
|
+
def process_mkdirs(seqid, iprot, oprot)
|
430
|
+
args = read_args(iprot, Mkdirs_args)
|
431
|
+
result = Mkdirs_result.new()
|
432
|
+
begin
|
433
|
+
result.success = @handler.mkdirs(args.path)
|
434
|
+
rescue ThriftIOException => ouch
|
435
|
+
result.ouch = ouch
|
436
|
+
end
|
437
|
+
write_result(result, oprot, 'mkdirs', seqid)
|
438
|
+
end
|
439
|
+
|
440
|
+
def process_exists(seqid, iprot, oprot)
|
441
|
+
args = read_args(iprot, Exists_args)
|
442
|
+
result = Exists_result.new()
|
443
|
+
begin
|
444
|
+
result.success = @handler.exists(args.path)
|
445
|
+
rescue ThriftIOException => ouch
|
446
|
+
result.ouch = ouch
|
447
|
+
end
|
448
|
+
write_result(result, oprot, 'exists', seqid)
|
449
|
+
end
|
450
|
+
|
451
|
+
def process_stat(seqid, iprot, oprot)
|
452
|
+
args = read_args(iprot, Stat_args)
|
453
|
+
result = Stat_result.new()
|
454
|
+
begin
|
455
|
+
result.success = @handler.stat(args.path)
|
456
|
+
rescue ThriftIOException => ouch
|
457
|
+
result.ouch = ouch
|
458
|
+
end
|
459
|
+
write_result(result, oprot, 'stat', seqid)
|
460
|
+
end
|
461
|
+
|
462
|
+
def process_listStatus(seqid, iprot, oprot)
|
463
|
+
args = read_args(iprot, ListStatus_args)
|
464
|
+
result = ListStatus_result.new()
|
465
|
+
begin
|
466
|
+
result.success = @handler.listStatus(args.path)
|
467
|
+
rescue ThriftIOException => ouch
|
468
|
+
result.ouch = ouch
|
469
|
+
end
|
470
|
+
write_result(result, oprot, 'listStatus', seqid)
|
471
|
+
end
|
472
|
+
|
473
|
+
def process_chmod(seqid, iprot, oprot)
|
474
|
+
args = read_args(iprot, Chmod_args)
|
475
|
+
result = Chmod_result.new()
|
476
|
+
begin
|
477
|
+
@handler.chmod(args.path, args.mode)
|
478
|
+
rescue ThriftIOException => ouch
|
479
|
+
result.ouch = ouch
|
480
|
+
end
|
481
|
+
write_result(result, oprot, 'chmod', seqid)
|
482
|
+
end
|
483
|
+
|
484
|
+
def process_chown(seqid, iprot, oprot)
|
485
|
+
args = read_args(iprot, Chown_args)
|
486
|
+
result = Chown_result.new()
|
487
|
+
begin
|
488
|
+
@handler.chown(args.path, args.owner, args.group)
|
489
|
+
rescue ThriftIOException => ouch
|
490
|
+
result.ouch = ouch
|
491
|
+
end
|
492
|
+
write_result(result, oprot, 'chown', seqid)
|
493
|
+
end
|
494
|
+
|
495
|
+
def process_setReplication(seqid, iprot, oprot)
|
496
|
+
args = read_args(iprot, SetReplication_args)
|
497
|
+
result = SetReplication_result.new()
|
498
|
+
begin
|
499
|
+
@handler.setReplication(args.path, args.replication)
|
500
|
+
rescue ThriftIOException => ouch
|
501
|
+
result.ouch = ouch
|
502
|
+
end
|
503
|
+
write_result(result, oprot, 'setReplication', seqid)
|
504
|
+
end
|
505
|
+
|
506
|
+
def process_getFileBlockLocations(seqid, iprot, oprot)
|
507
|
+
args = read_args(iprot, GetFileBlockLocations_args)
|
508
|
+
result = GetFileBlockLocations_result.new()
|
509
|
+
begin
|
510
|
+
result.success = @handler.getFileBlockLocations(args.path, args.start, args.length)
|
511
|
+
rescue ThriftIOException => ouch
|
512
|
+
result.ouch = ouch
|
513
|
+
end
|
514
|
+
write_result(result, oprot, 'getFileBlockLocations', seqid)
|
515
|
+
end
|
516
|
+
|
517
|
+
end
|
518
|
+
|
519
|
+
# HELPER FUNCTIONS AND STRUCTURES
|
520
|
+
|
521
|
+
class SetInactivityTimeoutPeriod_args
|
522
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
523
|
+
PERIODINSECONDS = 1
|
524
|
+
|
525
|
+
FIELDS = {
|
526
|
+
PERIODINSECONDS => {:type => ::Thrift::Types::I64, :name => 'periodInSeconds'}
|
527
|
+
}
|
528
|
+
|
529
|
+
def struct_fields; FIELDS; end
|
530
|
+
|
531
|
+
def validate
|
532
|
+
end
|
533
|
+
|
534
|
+
::Thrift::Struct.generate_accessors self
|
535
|
+
end
|
536
|
+
|
537
|
+
class SetInactivityTimeoutPeriod_result
|
538
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
539
|
+
|
540
|
+
FIELDS = {
|
541
|
+
|
542
|
+
}
|
543
|
+
|
544
|
+
def struct_fields; FIELDS; end
|
545
|
+
|
546
|
+
def validate
|
547
|
+
end
|
548
|
+
|
549
|
+
::Thrift::Struct.generate_accessors self
|
550
|
+
end
|
551
|
+
|
552
|
+
class Shutdown_args
|
553
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
554
|
+
STATUS = 1
|
555
|
+
|
556
|
+
FIELDS = {
|
557
|
+
STATUS => {:type => ::Thrift::Types::I32, :name => 'status'}
|
558
|
+
}
|
559
|
+
|
560
|
+
def struct_fields; FIELDS; end
|
561
|
+
|
562
|
+
def validate
|
563
|
+
end
|
564
|
+
|
565
|
+
::Thrift::Struct.generate_accessors self
|
566
|
+
end
|
567
|
+
|
568
|
+
class Shutdown_result
|
569
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
570
|
+
|
571
|
+
FIELDS = {
|
572
|
+
|
573
|
+
}
|
574
|
+
|
575
|
+
def struct_fields; FIELDS; end
|
576
|
+
|
577
|
+
def validate
|
578
|
+
end
|
579
|
+
|
580
|
+
::Thrift::Struct.generate_accessors self
|
581
|
+
end
|
582
|
+
|
583
|
+
class Create_args
|
584
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
585
|
+
PATH = 1
|
586
|
+
|
587
|
+
FIELDS = {
|
588
|
+
PATH => {:type => ::Thrift::Types::STRUCT, :name => 'path', :class => Pathname}
|
589
|
+
}
|
590
|
+
|
591
|
+
def struct_fields; FIELDS; end
|
592
|
+
|
593
|
+
def validate
|
594
|
+
end
|
595
|
+
|
596
|
+
::Thrift::Struct.generate_accessors self
|
597
|
+
end
|
598
|
+
|
599
|
+
class Create_result
|
600
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
601
|
+
SUCCESS = 0
|
602
|
+
OUCH = 1
|
603
|
+
|
604
|
+
FIELDS = {
|
605
|
+
SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => ThriftHandle},
|
606
|
+
OUCH => {:type => ::Thrift::Types::STRUCT, :name => 'ouch', :class => ThriftIOException}
|
607
|
+
}
|
608
|
+
|
609
|
+
def struct_fields; FIELDS; end
|
610
|
+
|
611
|
+
def validate
|
612
|
+
end
|
613
|
+
|
614
|
+
::Thrift::Struct.generate_accessors self
|
615
|
+
end
|
616
|
+
|
617
|
+
class CreateFile_args
|
618
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
619
|
+
PATH = 1
|
620
|
+
MODE = 2
|
621
|
+
OVERWRITE = 3
|
622
|
+
BUFFERSIZE = 4
|
623
|
+
BLOCK_REPLICATION = 5
|
624
|
+
BLOCKSIZE = 6
|
625
|
+
|
626
|
+
FIELDS = {
|
627
|
+
PATH => {:type => ::Thrift::Types::STRUCT, :name => 'path', :class => Pathname},
|
628
|
+
MODE => {:type => ::Thrift::Types::I16, :name => 'mode'},
|
629
|
+
OVERWRITE => {:type => ::Thrift::Types::BOOL, :name => 'overwrite'},
|
630
|
+
BUFFERSIZE => {:type => ::Thrift::Types::I32, :name => 'bufferSize'},
|
631
|
+
BLOCK_REPLICATION => {:type => ::Thrift::Types::I16, :name => 'block_replication'},
|
632
|
+
BLOCKSIZE => {:type => ::Thrift::Types::I64, :name => 'blocksize'}
|
633
|
+
}
|
634
|
+
|
635
|
+
def struct_fields; FIELDS; end
|
636
|
+
|
637
|
+
def validate
|
638
|
+
end
|
639
|
+
|
640
|
+
::Thrift::Struct.generate_accessors self
|
641
|
+
end
|
642
|
+
|
643
|
+
class CreateFile_result
|
644
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
645
|
+
SUCCESS = 0
|
646
|
+
OUCH = 1
|
647
|
+
|
648
|
+
FIELDS = {
|
649
|
+
SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => ThriftHandle},
|
650
|
+
OUCH => {:type => ::Thrift::Types::STRUCT, :name => 'ouch', :class => ThriftIOException}
|
651
|
+
}
|
652
|
+
|
653
|
+
def struct_fields; FIELDS; end
|
654
|
+
|
655
|
+
def validate
|
656
|
+
end
|
657
|
+
|
658
|
+
::Thrift::Struct.generate_accessors self
|
659
|
+
end
|
660
|
+
|
661
|
+
class Open_args
|
662
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
663
|
+
PATH = 1
|
664
|
+
|
665
|
+
FIELDS = {
|
666
|
+
PATH => {:type => ::Thrift::Types::STRUCT, :name => 'path', :class => Pathname}
|
667
|
+
}
|
668
|
+
|
669
|
+
def struct_fields; FIELDS; end
|
670
|
+
|
671
|
+
def validate
|
672
|
+
end
|
673
|
+
|
674
|
+
::Thrift::Struct.generate_accessors self
|
675
|
+
end
|
676
|
+
|
677
|
+
class Open_result
|
678
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
679
|
+
SUCCESS = 0
|
680
|
+
OUCH = 1
|
681
|
+
|
682
|
+
FIELDS = {
|
683
|
+
SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => ThriftHandle},
|
684
|
+
OUCH => {:type => ::Thrift::Types::STRUCT, :name => 'ouch', :class => ThriftIOException}
|
685
|
+
}
|
686
|
+
|
687
|
+
def struct_fields; FIELDS; end
|
688
|
+
|
689
|
+
def validate
|
690
|
+
end
|
691
|
+
|
692
|
+
::Thrift::Struct.generate_accessors self
|
693
|
+
end
|
694
|
+
|
695
|
+
class Append_args
|
696
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
697
|
+
PATH = 1
|
698
|
+
|
699
|
+
FIELDS = {
|
700
|
+
PATH => {:type => ::Thrift::Types::STRUCT, :name => 'path', :class => Pathname}
|
701
|
+
}
|
702
|
+
|
703
|
+
def struct_fields; FIELDS; end
|
704
|
+
|
705
|
+
def validate
|
706
|
+
end
|
707
|
+
|
708
|
+
::Thrift::Struct.generate_accessors self
|
709
|
+
end
|
710
|
+
|
711
|
+
class Append_result
|
712
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
713
|
+
SUCCESS = 0
|
714
|
+
OUCH = 1
|
715
|
+
|
716
|
+
FIELDS = {
|
717
|
+
SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => ThriftHandle},
|
718
|
+
OUCH => {:type => ::Thrift::Types::STRUCT, :name => 'ouch', :class => ThriftIOException}
|
719
|
+
}
|
720
|
+
|
721
|
+
def struct_fields; FIELDS; end
|
722
|
+
|
723
|
+
def validate
|
724
|
+
end
|
725
|
+
|
726
|
+
::Thrift::Struct.generate_accessors self
|
727
|
+
end
|
728
|
+
|
729
|
+
class Write_args
|
730
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
731
|
+
HANDLE = 1
|
732
|
+
DATA = -1
|
733
|
+
|
734
|
+
FIELDS = {
|
735
|
+
HANDLE => {:type => ::Thrift::Types::STRUCT, :name => 'handle', :class => ThriftHandle},
|
736
|
+
DATA => {:type => ::Thrift::Types::STRING, :name => 'data'}
|
737
|
+
}
|
738
|
+
|
739
|
+
def struct_fields; FIELDS; end
|
740
|
+
|
741
|
+
def validate
|
742
|
+
end
|
743
|
+
|
744
|
+
::Thrift::Struct.generate_accessors self
|
745
|
+
end
|
746
|
+
|
747
|
+
class Write_result
|
748
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
749
|
+
SUCCESS = 0
|
750
|
+
OUCH = 1
|
751
|
+
|
752
|
+
FIELDS = {
|
753
|
+
SUCCESS => {:type => ::Thrift::Types::BOOL, :name => 'success'},
|
754
|
+
OUCH => {:type => ::Thrift::Types::STRUCT, :name => 'ouch', :class => ThriftIOException}
|
755
|
+
}
|
756
|
+
|
757
|
+
def struct_fields; FIELDS; end
|
758
|
+
|
759
|
+
def validate
|
760
|
+
end
|
761
|
+
|
762
|
+
::Thrift::Struct.generate_accessors self
|
763
|
+
end
|
764
|
+
|
765
|
+
class Read_args
|
766
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
767
|
+
HANDLE = 1
|
768
|
+
OFFSET = -1
|
769
|
+
SIZE = -2
|
770
|
+
|
771
|
+
FIELDS = {
|
772
|
+
HANDLE => {:type => ::Thrift::Types::STRUCT, :name => 'handle', :class => ThriftHandle},
|
773
|
+
OFFSET => {:type => ::Thrift::Types::I64, :name => 'offset'},
|
774
|
+
SIZE => {:type => ::Thrift::Types::I32, :name => 'size'}
|
775
|
+
}
|
776
|
+
|
777
|
+
def struct_fields; FIELDS; end
|
778
|
+
|
779
|
+
def validate
|
780
|
+
end
|
781
|
+
|
782
|
+
::Thrift::Struct.generate_accessors self
|
783
|
+
end
|
784
|
+
|
785
|
+
class Read_result
|
786
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
787
|
+
SUCCESS = 0
|
788
|
+
OUCH = 1
|
789
|
+
|
790
|
+
FIELDS = {
|
791
|
+
SUCCESS => {:type => ::Thrift::Types::STRING, :name => 'success'},
|
792
|
+
OUCH => {:type => ::Thrift::Types::STRUCT, :name => 'ouch', :class => ThriftIOException}
|
793
|
+
}
|
794
|
+
|
795
|
+
def struct_fields; FIELDS; end
|
796
|
+
|
797
|
+
def validate
|
798
|
+
end
|
799
|
+
|
800
|
+
::Thrift::Struct.generate_accessors self
|
801
|
+
end
|
802
|
+
|
803
|
+
class Close_args
|
804
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
805
|
+
OUT = 1
|
806
|
+
|
807
|
+
FIELDS = {
|
808
|
+
OUT => {:type => ::Thrift::Types::STRUCT, :name => 'out', :class => ThriftHandle}
|
809
|
+
}
|
810
|
+
|
811
|
+
def struct_fields; FIELDS; end
|
812
|
+
|
813
|
+
def validate
|
814
|
+
end
|
815
|
+
|
816
|
+
::Thrift::Struct.generate_accessors self
|
817
|
+
end
|
818
|
+
|
819
|
+
class Close_result
|
820
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
821
|
+
SUCCESS = 0
|
822
|
+
OUCH = 1
|
823
|
+
|
824
|
+
FIELDS = {
|
825
|
+
SUCCESS => {:type => ::Thrift::Types::BOOL, :name => 'success'},
|
826
|
+
OUCH => {:type => ::Thrift::Types::STRUCT, :name => 'ouch', :class => ThriftIOException}
|
827
|
+
}
|
828
|
+
|
829
|
+
def struct_fields; FIELDS; end
|
830
|
+
|
831
|
+
def validate
|
832
|
+
end
|
833
|
+
|
834
|
+
::Thrift::Struct.generate_accessors self
|
835
|
+
end
|
836
|
+
|
837
|
+
class Rm_args
|
838
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
839
|
+
PATH = 1
|
840
|
+
RECURSIVE = 2
|
841
|
+
|
842
|
+
FIELDS = {
|
843
|
+
PATH => {:type => ::Thrift::Types::STRUCT, :name => 'path', :class => Pathname},
|
844
|
+
RECURSIVE => {:type => ::Thrift::Types::BOOL, :name => 'recursive'}
|
845
|
+
}
|
846
|
+
|
847
|
+
def struct_fields; FIELDS; end
|
848
|
+
|
849
|
+
def validate
|
850
|
+
end
|
851
|
+
|
852
|
+
::Thrift::Struct.generate_accessors self
|
853
|
+
end
|
854
|
+
|
855
|
+
class Rm_result
|
856
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
857
|
+
SUCCESS = 0
|
858
|
+
OUCH = 1
|
859
|
+
|
860
|
+
FIELDS = {
|
861
|
+
SUCCESS => {:type => ::Thrift::Types::BOOL, :name => 'success'},
|
862
|
+
OUCH => {:type => ::Thrift::Types::STRUCT, :name => 'ouch', :class => ThriftIOException}
|
863
|
+
}
|
864
|
+
|
865
|
+
def struct_fields; FIELDS; end
|
866
|
+
|
867
|
+
def validate
|
868
|
+
end
|
869
|
+
|
870
|
+
::Thrift::Struct.generate_accessors self
|
871
|
+
end
|
872
|
+
|
873
|
+
class Rename_args
|
874
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
875
|
+
PATH = 1
|
876
|
+
DEST = 2
|
877
|
+
|
878
|
+
FIELDS = {
|
879
|
+
PATH => {:type => ::Thrift::Types::STRUCT, :name => 'path', :class => Pathname},
|
880
|
+
DEST => {:type => ::Thrift::Types::STRUCT, :name => 'dest', :class => Pathname}
|
881
|
+
}
|
882
|
+
|
883
|
+
def struct_fields; FIELDS; end
|
884
|
+
|
885
|
+
def validate
|
886
|
+
end
|
887
|
+
|
888
|
+
::Thrift::Struct.generate_accessors self
|
889
|
+
end
|
890
|
+
|
891
|
+
class Rename_result
|
892
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
893
|
+
SUCCESS = 0
|
894
|
+
OUCH = 1
|
895
|
+
|
896
|
+
FIELDS = {
|
897
|
+
SUCCESS => {:type => ::Thrift::Types::BOOL, :name => 'success'},
|
898
|
+
OUCH => {:type => ::Thrift::Types::STRUCT, :name => 'ouch', :class => ThriftIOException}
|
899
|
+
}
|
900
|
+
|
901
|
+
def struct_fields; FIELDS; end
|
902
|
+
|
903
|
+
def validate
|
904
|
+
end
|
905
|
+
|
906
|
+
::Thrift::Struct.generate_accessors self
|
907
|
+
end
|
908
|
+
|
909
|
+
class Mkdirs_args
|
910
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
911
|
+
PATH = 1
|
912
|
+
|
913
|
+
FIELDS = {
|
914
|
+
PATH => {:type => ::Thrift::Types::STRUCT, :name => 'path', :class => Pathname}
|
915
|
+
}
|
916
|
+
|
917
|
+
def struct_fields; FIELDS; end
|
918
|
+
|
919
|
+
def validate
|
920
|
+
end
|
921
|
+
|
922
|
+
::Thrift::Struct.generate_accessors self
|
923
|
+
end
|
924
|
+
|
925
|
+
class Mkdirs_result
|
926
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
927
|
+
SUCCESS = 0
|
928
|
+
OUCH = 1
|
929
|
+
|
930
|
+
FIELDS = {
|
931
|
+
SUCCESS => {:type => ::Thrift::Types::BOOL, :name => 'success'},
|
932
|
+
OUCH => {:type => ::Thrift::Types::STRUCT, :name => 'ouch', :class => ThriftIOException}
|
933
|
+
}
|
934
|
+
|
935
|
+
def struct_fields; FIELDS; end
|
936
|
+
|
937
|
+
def validate
|
938
|
+
end
|
939
|
+
|
940
|
+
::Thrift::Struct.generate_accessors self
|
941
|
+
end
|
942
|
+
|
943
|
+
class Exists_args
|
944
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
945
|
+
PATH = 1
|
946
|
+
|
947
|
+
FIELDS = {
|
948
|
+
PATH => {:type => ::Thrift::Types::STRUCT, :name => 'path', :class => Pathname}
|
949
|
+
}
|
950
|
+
|
951
|
+
def struct_fields; FIELDS; end
|
952
|
+
|
953
|
+
def validate
|
954
|
+
end
|
955
|
+
|
956
|
+
::Thrift::Struct.generate_accessors self
|
957
|
+
end
|
958
|
+
|
959
|
+
class Exists_result
|
960
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
961
|
+
SUCCESS = 0
|
962
|
+
OUCH = 1
|
963
|
+
|
964
|
+
FIELDS = {
|
965
|
+
SUCCESS => {:type => ::Thrift::Types::BOOL, :name => 'success'},
|
966
|
+
OUCH => {:type => ::Thrift::Types::STRUCT, :name => 'ouch', :class => ThriftIOException}
|
967
|
+
}
|
968
|
+
|
969
|
+
def struct_fields; FIELDS; end
|
970
|
+
|
971
|
+
def validate
|
972
|
+
end
|
973
|
+
|
974
|
+
::Thrift::Struct.generate_accessors self
|
975
|
+
end
|
976
|
+
|
977
|
+
class Stat_args
|
978
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
979
|
+
PATH = 1
|
980
|
+
|
981
|
+
FIELDS = {
|
982
|
+
PATH => {:type => ::Thrift::Types::STRUCT, :name => 'path', :class => Pathname}
|
983
|
+
}
|
984
|
+
|
985
|
+
def struct_fields; FIELDS; end
|
986
|
+
|
987
|
+
def validate
|
988
|
+
end
|
989
|
+
|
990
|
+
::Thrift::Struct.generate_accessors self
|
991
|
+
end
|
992
|
+
|
993
|
+
class Stat_result
|
994
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
995
|
+
SUCCESS = 0
|
996
|
+
OUCH = 1
|
997
|
+
|
998
|
+
FIELDS = {
|
999
|
+
SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => FileStatus},
|
1000
|
+
OUCH => {:type => ::Thrift::Types::STRUCT, :name => 'ouch', :class => ThriftIOException}
|
1001
|
+
}
|
1002
|
+
|
1003
|
+
def struct_fields; FIELDS; end
|
1004
|
+
|
1005
|
+
def validate
|
1006
|
+
end
|
1007
|
+
|
1008
|
+
::Thrift::Struct.generate_accessors self
|
1009
|
+
end
|
1010
|
+
|
1011
|
+
class ListStatus_args
|
1012
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
1013
|
+
PATH = 1
|
1014
|
+
|
1015
|
+
FIELDS = {
|
1016
|
+
PATH => {:type => ::Thrift::Types::STRUCT, :name => 'path', :class => Pathname}
|
1017
|
+
}
|
1018
|
+
|
1019
|
+
def struct_fields; FIELDS; end
|
1020
|
+
|
1021
|
+
def validate
|
1022
|
+
end
|
1023
|
+
|
1024
|
+
::Thrift::Struct.generate_accessors self
|
1025
|
+
end
|
1026
|
+
|
1027
|
+
class ListStatus_result
|
1028
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
1029
|
+
SUCCESS = 0
|
1030
|
+
OUCH = 1
|
1031
|
+
|
1032
|
+
FIELDS = {
|
1033
|
+
SUCCESS => {:type => ::Thrift::Types::LIST, :name => 'success', :element => {:type => ::Thrift::Types::STRUCT, :class => FileStatus}},
|
1034
|
+
OUCH => {:type => ::Thrift::Types::STRUCT, :name => 'ouch', :class => ThriftIOException}
|
1035
|
+
}
|
1036
|
+
|
1037
|
+
def struct_fields; FIELDS; end
|
1038
|
+
|
1039
|
+
def validate
|
1040
|
+
end
|
1041
|
+
|
1042
|
+
::Thrift::Struct.generate_accessors self
|
1043
|
+
end
|
1044
|
+
|
1045
|
+
class Chmod_args
|
1046
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
1047
|
+
PATH = 1
|
1048
|
+
MODE = 2
|
1049
|
+
|
1050
|
+
FIELDS = {
|
1051
|
+
PATH => {:type => ::Thrift::Types::STRUCT, :name => 'path', :class => Pathname},
|
1052
|
+
MODE => {:type => ::Thrift::Types::I16, :name => 'mode'}
|
1053
|
+
}
|
1054
|
+
|
1055
|
+
def struct_fields; FIELDS; end
|
1056
|
+
|
1057
|
+
def validate
|
1058
|
+
end
|
1059
|
+
|
1060
|
+
::Thrift::Struct.generate_accessors self
|
1061
|
+
end
|
1062
|
+
|
1063
|
+
class Chmod_result
|
1064
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
1065
|
+
OUCH = 1
|
1066
|
+
|
1067
|
+
FIELDS = {
|
1068
|
+
OUCH => {:type => ::Thrift::Types::STRUCT, :name => 'ouch', :class => ThriftIOException}
|
1069
|
+
}
|
1070
|
+
|
1071
|
+
def struct_fields; FIELDS; end
|
1072
|
+
|
1073
|
+
def validate
|
1074
|
+
end
|
1075
|
+
|
1076
|
+
::Thrift::Struct.generate_accessors self
|
1077
|
+
end
|
1078
|
+
|
1079
|
+
class Chown_args
|
1080
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
1081
|
+
PATH = 1
|
1082
|
+
OWNER = 2
|
1083
|
+
GROUP = 3
|
1084
|
+
|
1085
|
+
FIELDS = {
|
1086
|
+
PATH => {:type => ::Thrift::Types::STRUCT, :name => 'path', :class => Pathname},
|
1087
|
+
OWNER => {:type => ::Thrift::Types::STRING, :name => 'owner'},
|
1088
|
+
GROUP => {:type => ::Thrift::Types::STRING, :name => 'group'}
|
1089
|
+
}
|
1090
|
+
|
1091
|
+
def struct_fields; FIELDS; end
|
1092
|
+
|
1093
|
+
def validate
|
1094
|
+
end
|
1095
|
+
|
1096
|
+
::Thrift::Struct.generate_accessors self
|
1097
|
+
end
|
1098
|
+
|
1099
|
+
class Chown_result
|
1100
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
1101
|
+
OUCH = 1
|
1102
|
+
|
1103
|
+
FIELDS = {
|
1104
|
+
OUCH => {:type => ::Thrift::Types::STRUCT, :name => 'ouch', :class => ThriftIOException}
|
1105
|
+
}
|
1106
|
+
|
1107
|
+
def struct_fields; FIELDS; end
|
1108
|
+
|
1109
|
+
def validate
|
1110
|
+
end
|
1111
|
+
|
1112
|
+
::Thrift::Struct.generate_accessors self
|
1113
|
+
end
|
1114
|
+
|
1115
|
+
class SetReplication_args
|
1116
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
1117
|
+
PATH = 1
|
1118
|
+
REPLICATION = 2
|
1119
|
+
|
1120
|
+
FIELDS = {
|
1121
|
+
PATH => {:type => ::Thrift::Types::STRUCT, :name => 'path', :class => Pathname},
|
1122
|
+
REPLICATION => {:type => ::Thrift::Types::I16, :name => 'replication'}
|
1123
|
+
}
|
1124
|
+
|
1125
|
+
def struct_fields; FIELDS; end
|
1126
|
+
|
1127
|
+
def validate
|
1128
|
+
end
|
1129
|
+
|
1130
|
+
::Thrift::Struct.generate_accessors self
|
1131
|
+
end
|
1132
|
+
|
1133
|
+
class SetReplication_result
|
1134
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
1135
|
+
OUCH = 1
|
1136
|
+
|
1137
|
+
FIELDS = {
|
1138
|
+
OUCH => {:type => ::Thrift::Types::STRUCT, :name => 'ouch', :class => ThriftIOException}
|
1139
|
+
}
|
1140
|
+
|
1141
|
+
def struct_fields; FIELDS; end
|
1142
|
+
|
1143
|
+
def validate
|
1144
|
+
end
|
1145
|
+
|
1146
|
+
::Thrift::Struct.generate_accessors self
|
1147
|
+
end
|
1148
|
+
|
1149
|
+
class GetFileBlockLocations_args
|
1150
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
1151
|
+
PATH = 1
|
1152
|
+
START = 2
|
1153
|
+
LENGTH = 3
|
1154
|
+
|
1155
|
+
FIELDS = {
|
1156
|
+
PATH => {:type => ::Thrift::Types::STRUCT, :name => 'path', :class => Pathname},
|
1157
|
+
START => {:type => ::Thrift::Types::I64, :name => 'start'},
|
1158
|
+
LENGTH => {:type => ::Thrift::Types::I64, :name => 'length'}
|
1159
|
+
}
|
1160
|
+
|
1161
|
+
def struct_fields; FIELDS; end
|
1162
|
+
|
1163
|
+
def validate
|
1164
|
+
end
|
1165
|
+
|
1166
|
+
::Thrift::Struct.generate_accessors self
|
1167
|
+
end
|
1168
|
+
|
1169
|
+
class GetFileBlockLocations_result
|
1170
|
+
include ::Thrift::Struct, ::Thrift::Struct_Union
|
1171
|
+
SUCCESS = 0
|
1172
|
+
OUCH = 1
|
1173
|
+
|
1174
|
+
FIELDS = {
|
1175
|
+
SUCCESS => {:type => ::Thrift::Types::LIST, :name => 'success', :element => {:type => ::Thrift::Types::STRUCT, :class => BlockLocation}},
|
1176
|
+
OUCH => {:type => ::Thrift::Types::STRUCT, :name => 'ouch', :class => ThriftIOException}
|
1177
|
+
}
|
1178
|
+
|
1179
|
+
def struct_fields; FIELDS; end
|
1180
|
+
|
1181
|
+
def validate
|
1182
|
+
end
|
1183
|
+
|
1184
|
+
::Thrift::Struct.generate_accessors self
|
1185
|
+
end
|
1186
|
+
|
1187
|
+
end
|
1188
|
+
|