
com.microsoft.azure.kusto.ingest.resources.RankedStorageAccountSet Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kusto-ingest Show documentation
Show all versions of kusto-ingest Show documentation
Kusto client library for ingesting data
package com.microsoft.azure.kusto.ingest.resources;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.*;
public class RankedStorageAccountSet {
private final Map accounts;
public RankedStorageAccountSet() {
this.accounts = new HashMap<>();
}
public void addResultToAccount(String accountName, boolean success) {
RankedStorageAccount account = accounts.get(accountName);
if (account != null) {
account.addResult(success);
} else {
throw new IllegalArgumentException("Account " + accountName + " does not exist");
}
}
public void addAccount(String accountName) {
if (!accounts.containsKey(accountName)) {
accounts.put(accountName, new RankedStorageAccount(accountName));
} else {
throw new IllegalArgumentException("Account " + accountName + " already exists");
}
}
public void addAccount(RankedStorageAccount account) {
if (!accounts.containsKey(account.getAccountName())) {
accounts.put(account.getAccountName(), account);
} else {
throw new IllegalArgumentException("Account " + account.getAccountName() + " already exists");
}
}
@Nullable
public RankedStorageAccount getAccount(String accountName) {
return accounts.get(accountName);
}
@NotNull
public List getRankedShuffledAccounts() {
List accounts = new ArrayList<>(this.accounts.values());
// shuffle accounts
Collections.shuffle(accounts);
return accounts;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy