public String getToken() { if (StorageService.instance.isClientMode()) return CassandraUtils.fakeToken; return StorageService.instance.getTokenMetadata().getToken(FBUtilities.getLocalAddress()).toString(); }
/** * @return the Topology map of nodes to DCs + Racks * * This is only allowed when a copy has been made of TokenMetadata, to avoid concurrent modifications * when Topology methods are subsequently used by the caller. */ public Topology getTopology() { assert this != StorageService.instance.getTokenMetadata(); return topology; }
public Map<String, String> getEndpointToHostId() { Map<String, String> mapOut = new HashMap<>(); for (Map.Entry<InetAddress, UUID> entry : getTokenMetadata().getEndpointToHostIdMapForReading().entrySet()) mapOut.put(entry.getKey().getHostAddress(), entry.getValue().toString()); return mapOut; }
public Map<String, String> getHostIdToEndpoint() { Map<String, String> mapOut = new HashMap<>(); for (Map.Entry<InetAddress, UUID> entry : getTokenMetadata().getEndpointToHostIdMapForReading().entrySet()) mapOut.put(entry.getValue().toString(), entry.getKey().getHostAddress()); return mapOut; }
public Map<String, String> getEndpointToHostId() { Map<String, String> mapOut = new HashMap<>(); for (Map.Entry<InetAddress, UUID> entry : getTokenMetadata().getEndpointToHostIdMapForReading().entrySet()) mapOut.put(entry.getKey().getHostAddress(), entry.getValue().toString()); return mapOut; }
public void updateTopology(InetAddress endpoint) { if (getTokenMetadata().isMember(endpoint)) { getTokenMetadata().updateTopology(endpoint); } }
public static void calculatePendingRanges(AbstractReplicationStrategy strategy, String keyspaceName) { StorageService.instance.getTokenMetadata().calculatePendingRanges(strategy, keyspaceName); } }
private List<String> getTokens(InetAddress endpoint) { List<String> strTokens = new ArrayList<>(); for (Token tok : getTokenMetadata().getTokens(endpoint)) strTokens.add(tok.toString()); return strTokens; }
private List<String> getTokens(InetAddress endpoint) { List<String> strTokens = new ArrayList<>(); for (Token tok : getTokenMetadata().getTokens(endpoint)) strTokens.add(tok.toString()); return strTokens; }
public static void calculatePendingRanges(AbstractReplicationStrategy strategy, String keyspaceName) { StorageService.instance.getTokenMetadata().calculatePendingRanges(strategy, keyspaceName); } }
public Map<String, String> getHostIdToEndpoint() { Map<String, String> mapOut = new HashMap<>(); for (Map.Entry<InetAddress, UUID> entry : getTokenMetadata().getEndpointToHostIdMapForReading().entrySet()) mapOut.put(entry.getValue().toString(), entry.getKey().getHostAddress()); return mapOut; }
public boolean isGossipOnlyMember(InetAddress endpoint) { EndpointState epState = endpointStateMap.get(endpoint); if (epState == null) { return false; } return !isDeadState(epState) && !StorageService.instance.getTokenMetadata().isMember(endpoint); }
public boolean isGossipOnlyMember(InetAddress endpoint) { EndpointState epState = endpointStateMap.get(endpoint); if (epState == null) { return false; } return !isDeadState(epState) && !StorageService.instance.getTokenMetadata().isMember(endpoint); }
public void validate(String name) { // Attempt to instantiate the ARS, which will throw a ConfigurationException if the options aren't valid. TokenMetadata tmd = StorageService.instance.getTokenMetadata(); IEndpointSnitch eps = DatabaseDescriptor.getEndpointSnitch(); AbstractReplicationStrategy.validateReplicationStrategy(name, klass, tmd, eps, options); }
public void validate(String name) { // Attempt to instantiate the ARS, which will throw a ConfigurationException if the options aren't valid. TokenMetadata tmd = StorageService.instance.getTokenMetadata(); IEndpointSnitch eps = DatabaseDescriptor.getEndpointSnitch(); AbstractReplicationStrategy.validateReplicationStrategy(name, klass, tmd, eps, options); }
private void createReplicationStrategy(KSMetaData ksm) { replicationStrategy = AbstractReplicationStrategy.createReplicationStrategy(ksm.name, ksm.strategyClass, StorageService.instance.getTokenMetadata(), DatabaseDescriptor.getEndpointSnitch(), ksm.strategyOptions); }
/** * check if the given disk boundaries are out of date due not being set or to having too old diskVersion/ringVersion */ public boolean isOutOfDate() { if (isInvalid) return true; int currentDiskVersion = BlacklistedDirectories.getDirectoriesVersion(); long currentRingVersion = StorageService.instance.getTokenMetadata().getRingVersion(); return currentDiskVersion != directoriesVersion || (ringVersion != -1 && currentRingVersion != ringVersion); }
/** * check if the given disk boundaries are out of date due not being set or to having too old diskVersion/ringVersion */ public boolean isOutOfDate() { if (isInvalid) return true; int currentDiskVersion = BlacklistedDirectories.getDirectoriesVersion(); long currentRingVersion = StorageService.instance.getTokenMetadata().getRingVersion(); return currentDiskVersion != directoriesVersion || (ringVersion != -1 && currentRingVersion != ringVersion); }
public boolean appliesLocally(Mutation mutation) { String keyspaceName = mutation.getKeyspaceName(); Token token = mutation.key().getToken(); InetAddress local = FBUtilities.getBroadcastAddress(); return StorageService.instance.getNaturalEndpoints(keyspaceName, token).contains(local) || StorageService.instance.getTokenMetadata().pendingEndpointsFor(token, keyspaceName).contains(local); }
public boolean appliesLocally(Mutation mutation) { String keyspaceName = mutation.getKeyspaceName(); Token token = mutation.key().getToken(); InetAddress local = FBUtilities.getBroadcastAddress(); return StorageService.instance.getNaturalEndpoints(keyspaceName, token).contains(local) || StorageService.instance.getTokenMetadata().pendingEndpointsFor(token, keyspaceName).contains(local); }