class CassandraLoadBalancerStore implements LoadBalancerStore {

    @Override
    public List<JobLoadBalancer> getAssociationsPage(int offset, int limit) {
        // Create a sorted copy of the current keys to iterate. Keys added/removed after
        // the copy is created may lead to staleness in the data being iterated.
        // Use native string sorting to determine order.
        return jobToAssociatedLoadBalancersMap.keySet().stream()
                .flatMap(jobId -> {
                    SortedSet<JobLoadBalancer> jobLoadBalancerSortedSet = jobToAssociatedLoadBalancersMap.getOrDefault(jobId, Collections.emptySortedSet());
                    return jobLoadBalancerSortedSet.stream();
                })
                .sorted()
                .skip(offset)
                .limit(limit)
                .collect(Collectors.toList());
    }

    @Inject public  CassandraLoadBalancerStore(CassandraStoreConfiguration configuration,
                                      @Named(LOAD_BALANCER_SANITIZER) EntitySanitizer entitySanitizer,
                                      @Named(LOAD_BALANCER_CASSANDRA_SESSION) Session session);

}