File tree 1 file changed +18
-0
lines changed
h2o-persist-s3/src/main/java/water/persist
1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -237,6 +237,24 @@ public PersistEntry[] list(String path) {
237
237
return entries ;
238
238
}
239
239
240
+ @ Override
241
+ public String getParent (String path ) {
242
+ String [] bk = decodePath (path );
243
+ String bucket = bk [0 ];
244
+ String key = bk [1 ];
245
+ if (key .endsWith ("/" )) {
246
+ key = key .substring (0 , key .length () - 1 );
247
+ }
248
+ if (key == null || key .isEmpty ()) {
249
+ throw new IllegalArgumentException ("No parent exists for a bucket-only path: " + path );
250
+ }
251
+ int lastSlash = key .lastIndexOf ("/" );
252
+ if (lastSlash == -1 ) {
253
+ return "s3://" + bucket ;
254
+ }
255
+ return "s3://" + bucket + "/" + key .substring (0 , lastSlash );
256
+ }
257
+
240
258
@ Override
241
259
public InputStream open (String path ) {
242
260
String [] bk = decodePath (path );
You can’t perform that action at this time.
0 commit comments