Package io.grpc.internal
Class PickFirstLeafLoadBalancer.Index
- java.lang.Object
-
- io.grpc.internal.PickFirstLeafLoadBalancer.Index
-
- Enclosing class:
- PickFirstLeafLoadBalancer
static final class PickFirstLeafLoadBalancer.Index extends java.lang.ObjectIndex as in 'i', the pointer to an entry. Not a "search index." All updates should be done in a synchronization context.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<EquivalentAddressGroup>addressGroupsprivate intaddressIndexprivate intgroupIndexprivate intsize
-
Constructor Summary
Constructors Constructor Description Index(java.util.List<EquivalentAddressGroup> groups)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.net.SocketAddressgetCurrentAddress()java.util.List<EquivalentAddressGroup>getCurrentEagAsList()AttributesgetCurrentEagAttributes()booleanincrement()Move to next address in group.booleanisAtBeginning()booleanisValid()voidreset()booleanseekTo(java.net.SocketAddress needle)Returns false if the needle was not found and the current index was left unchanged.intsize()voidupdateGroups(java.util.List<EquivalentAddressGroup> newGroups)Update to new groups, resetting the current index.
-
-
-
Field Detail
-
addressGroups
private java.util.List<EquivalentAddressGroup> addressGroups
-
size
private int size
-
groupIndex
private int groupIndex
-
addressIndex
private int addressIndex
-
-
Constructor Detail
-
Index
public Index(java.util.List<EquivalentAddressGroup> groups)
-
-
Method Detail
-
isValid
public boolean isValid()
-
isAtBeginning
public boolean isAtBeginning()
-
increment
public boolean increment()
Move to next address in group. If last address in group move to first address of next group.- Returns:
- false if went off end of the list, otherwise true
-
reset
public void reset()
-
getCurrentAddress
public java.net.SocketAddress getCurrentAddress()
-
getCurrentEagAttributes
public Attributes getCurrentEagAttributes()
-
getCurrentEagAsList
public java.util.List<EquivalentAddressGroup> getCurrentEagAsList()
-
updateGroups
public void updateGroups(java.util.List<EquivalentAddressGroup> newGroups)
Update to new groups, resetting the current index.
-
seekTo
public boolean seekTo(java.net.SocketAddress needle)
Returns false if the needle was not found and the current index was left unchanged.
-
size
public int size()
-
-