@@ -14,8 +14,12 @@ public class GEDS {
14
14
}
15
15
16
16
private long nativePtr = 0 ;
17
- public final String pathPrefix ;
18
- public final String metadataServiceAddress ;
17
+ private final GEDSConfig config ;
18
+
19
+ public GEDS (GEDSConfig config ) {
20
+ this .config = config ;
21
+ this .nativePtr = initGEDS (this .config .getNativePtr ());
22
+ }
19
23
20
24
/**
21
25
* Constructor for GEDS.
@@ -30,41 +34,57 @@ public class GEDS {
30
34
* @param blockSize Block Size used for prefetching data
31
35
* (Optional). `0` indicates default block size.
32
36
*/
37
+ @ Deprecated
33
38
public GEDS (String metadataServiceAddress , String pathPrefix , String hostname , int port , long blockSize ) {
34
39
if (port < 0 || port > 65535 ) {
35
40
throw new IllegalArgumentException ("Invalid port." );
36
41
}
37
42
if (blockSize < 0 ) {
38
43
throw new IllegalArgumentException ("Invalid block size" );
39
44
}
40
- this .metadataServiceAddress = metadataServiceAddress ;
41
- this .pathPrefix = pathPrefix ;
42
- this .nativePtr = initGEDS (metadataServiceAddress , pathPrefix , hostname , port , blockSize );
45
+ config = new GEDSConfig (metadataServiceAddress );
46
+ if (port != 0 ) {
47
+ config .set ("port" , port );
48
+ }
49
+ if (hostname != "" ) {
50
+ config .set ("hostname" , hostname );
51
+ }
52
+ if (pathPrefix != "" ) {
53
+ config .set ("local_storage_path" , pathPrefix );
54
+ }
55
+ if (blockSize != 0 ) {
56
+ config .set ("cache_block_size" , blockSize );
57
+ }
58
+ this .nativePtr = initGEDS (config .getNativePtr ());
43
59
}
44
60
61
+ @ Deprecated
45
62
public GEDS (String metadataServiceAddress , String pathPrefix , int port , long blockSize ) {
46
63
this (metadataServiceAddress , pathPrefix , "" , port , blockSize );
47
64
}
48
65
66
+ @ Deprecated
49
67
public GEDS (String metadataServiceAddress , String pathPrefix , long blockSize ) {
50
68
this (metadataServiceAddress , pathPrefix , "" , 0 , blockSize );
51
69
}
52
70
71
+ @ Deprecated
53
72
public GEDS (String metadataServiceAddress , String pathPrefix ) {
54
73
this (metadataServiceAddress , pathPrefix , "" , 0 , 0 );
55
74
}
56
75
76
+ @ Deprecated
57
77
public GEDS (String metadataServiceAddress ) {
58
78
this (metadataServiceAddress , "" , "" , 0 , 0 );
59
79
}
60
80
61
- private static native long initGEDS (String metadataServiceAddress , String pathPrefix , String hostname , int port ,
62
- long blockSize );
81
+ private static native long initGEDS (long nativePtrConfig );
63
82
64
83
public void stopGEDS () {
65
84
checkGEDS ();
66
85
nativeStopGEDS (nativePtr );
67
86
}
87
+
68
88
private static native void nativeStopGEDS (long ptr );
69
89
70
90
public static native void printStatistics ();
0 commit comments