Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejava
public interface ConfigProvider extends Configurable, Closeable {
     
    // Configure this class with the initialization parameters
    void configure(Map<String, ?> configs);
 
    // Lookup up the data at the given path.
    Map<String, String> get(String path);

    // Lookup up the data with the given keys at the given path.
    Map<String, String> get(String path, Set<String> keys);
 
    // The ConfigProvider is responsible for making this callback whenever the key changes.
    // Some ConfigProviders may want to have a background thread with a configurable update interval.
    void subscribe(String path, Set<String> keys, ConfigChangeCallback callback);

    // Inverse of subscribe
    void unsubscribe(String path, Set<String> key);
 
    // Close all subscriptions and clean up all resources
    void close();
}

public interface ConfigChangeCallback {
    // A delayMs of 0 indicates an immediate change;
    // a positive delayMs indicates a future change is anticipated
    void onChange(String path, Map<String, String> values, int delayMs);
}
 

...