34
34
import org .apache .accumulo .core .client .AccumuloSecurityException ;
35
35
import org .apache .accumulo .core .client .InvalidTabletHostingRequestException ;
36
36
import org .apache .accumulo .core .client .TableNotFoundException ;
37
- import org .apache .accumulo .core .client .admin .TabletHostingGoal ;
37
+ import org .apache .accumulo .core .client .admin .TabletAvailability ;
38
38
import org .apache .accumulo .core .data .InstanceId ;
39
39
import org .apache .accumulo .core .data .Mutation ;
40
40
import org .apache .accumulo .core .data .Range ;
52
52
53
53
/**
54
54
* Client side cache of information about Tablets. Currently, a tablet prev end row is cached and
55
- * locations are cached if they exists .
55
+ * locations are cached if they exist .
56
56
*/
57
57
public abstract class ClientTabletCache {
58
58
@@ -308,39 +308,40 @@ public static class CachedTablet {
308
308
private final KeyExtent tablet_extent ;
309
309
private final String tserverLocation ;
310
310
private final String tserverSession ;
311
- private final TabletHostingGoal goal ;
311
+ private final TabletAvailability availability ;
312
312
private final boolean hostingRequested ;
313
313
314
314
private final Long creationTime = System .nanoTime ();
315
315
316
316
public CachedTablet (KeyExtent tablet_extent , String tablet_location , String session ,
317
- TabletHostingGoal goal , boolean hostingRequested ) {
317
+ TabletAvailability availability , boolean hostingRequested ) {
318
318
checkArgument (tablet_extent != null , "tablet_extent is null" );
319
319
checkArgument (tablet_location != null , "tablet_location is null" );
320
320
checkArgument (session != null , "session is null" );
321
321
this .tablet_extent = tablet_extent ;
322
322
this .tserverLocation = interner .intern (tablet_location );
323
323
this .tserverSession = interner .intern (session );
324
- this .goal = Objects .requireNonNull (goal );
324
+ this .availability = Objects .requireNonNull (availability );
325
325
this .hostingRequested = hostingRequested ;
326
326
}
327
327
328
328
public CachedTablet (KeyExtent tablet_extent , Optional <String > tablet_location ,
329
- Optional <String > session , TabletHostingGoal goal , boolean hostingRequested ) {
329
+ Optional <String > session , TabletAvailability availability , boolean hostingRequested ) {
330
330
checkArgument (tablet_extent != null , "tablet_extent is null" );
331
331
this .tablet_extent = tablet_extent ;
332
332
this .tserverLocation = tablet_location .map (interner ::intern ).orElse (null );
333
333
this .tserverSession = session .map (interner ::intern ).orElse (null );
334
- this .goal = Objects .requireNonNull (goal );
334
+ this .availability = Objects .requireNonNull (availability );
335
335
this .hostingRequested = hostingRequested ;
336
336
}
337
337
338
- public CachedTablet (KeyExtent tablet_extent , TabletHostingGoal goal , boolean hostingRequested ) {
338
+ public CachedTablet (KeyExtent tablet_extent , TabletAvailability availability ,
339
+ boolean hostingRequested ) {
339
340
checkArgument (tablet_extent != null , "tablet_extent is null" );
340
341
this .tablet_extent = tablet_extent ;
341
342
this .tserverLocation = null ;
342
343
this .tserverSession = null ;
343
- this .goal = Objects .requireNonNull (goal );
344
+ this .availability = Objects .requireNonNull (availability );
344
345
this .hostingRequested = hostingRequested ;
345
346
}
346
347
@@ -350,21 +351,23 @@ public boolean equals(Object o) {
350
351
CachedTablet otl = (CachedTablet ) o ;
351
352
return getExtent ().equals (otl .getExtent ())
352
353
&& getTserverLocation ().equals (otl .getTserverLocation ())
353
- && getTserverSession ().equals (otl .getTserverSession ()) && getGoal () == otl .getGoal ()
354
+ && getTserverSession ().equals (otl .getTserverSession ())
355
+ && getAvailability () == otl .getAvailability ()
354
356
&& hostingRequested == otl .hostingRequested ;
355
357
}
356
358
return false ;
357
359
}
358
360
359
361
@ Override
360
362
public int hashCode () {
361
- return Objects .hash (getExtent (), tserverLocation , tserverSession , goal , hostingRequested );
363
+ return Objects .hash (getExtent (), tserverLocation , tserverSession , availability ,
364
+ hostingRequested );
362
365
}
363
366
364
367
@ Override
365
368
public String toString () {
366
369
return "(" + getExtent () + "," + getTserverLocation () + "," + getTserverSession () + ","
367
- + getGoal () + ")" ;
370
+ + getAvailability () + ")" ;
368
371
}
369
372
370
373
public KeyExtent getExtent () {
@@ -381,12 +384,12 @@ public Optional<String> getTserverSession() {
381
384
382
385
/**
383
386
* The ClientTabletCache will remove and replace a CachedTablet when the location is no longer
384
- * valid. However, it will not do the same when the goal is no longer valid. The goal returned
385
- * by this method may be out of date. If this information is needed to be fresh, then you may
386
- * want to consider clearing the cache first.
387
+ * valid. However, it will not do the same when the availability is no longer valid. The
388
+ * availability returned by this method may be out of date. If this information is needed to be
389
+ * fresh, then you may want to consider clearing the cache first.
387
390
*/
388
- public TabletHostingGoal getGoal () {
389
- return this .goal ;
391
+ public TabletAvailability getAvailability () {
392
+ return this .availability ;
390
393
}
391
394
392
395
public Duration getAge () {
0 commit comments