All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.nosqlbench.driver.pulsar.PulsarSpaceCache Maven / Gradle / Ivy

Go to download

A Pulsar driver for nosqlbench. This provides the ability to inject synthetic data into a pulsar system.

There is a newer version: 4.15.102
Show newest version
package io.nosqlbench.driver.pulsar;

import java.util.concurrent.ConcurrentHashMap;

/**
 * To enable flexibility in testing methods, each object graph which is used within
 * the pulsar API is kept within a single umbrella called the PulsarSpace.
 * This allows for clients, producers, and consumers to remain connected and
 * cached in a useful way.
 */
public class PulsarSpaceCache {

    // TODO: Implement cache limits
    // TODO: Implement variant cache eviction behaviors (halt, warn, LRU)

    private final PulsarActivity activity;
    private final ConcurrentHashMap clientScopes = new ConcurrentHashMap<>();

    public PulsarSpaceCache(PulsarActivity pulsarActivity) {
        this.activity = pulsarActivity;
    }

    public Iterable getAssociatedPulsarSpace() {
        return clientScopes.values();
    }

    public PulsarActivity getAssociatedPulsarActivity() {
        return activity;
    }

    public PulsarSpace getPulsarSpace(String name) {
        return clientScopes.computeIfAbsent(name, spaceName -> new PulsarSpace(spaceName, activity));
    }

    public PulsarActivity getActivity() { return activity; }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy