
io.rebloom.client.InsertOptions Maven / Gradle / Ivy
package io.rebloom.client;
import redis.clients.jedis.Protocol;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import static io.rebloom.client.Keywords.*;
public class InsertOptions {
private final List options = new ArrayList<>();
public static InsertOptions insertOptions() {
return new InsertOptions();
}
/**
* If specified, should be followed by the desired capacity for the filter to be created
*/
public InsertOptions capacity(final long capacity) {
options.add(CAPACITY.getRaw());
options.add(Protocol.toByteArray(capacity));
return this;
}
/**
* If specified, should be followed by the the error ratio of the newly created filter if it does not yet exist
*/
public InsertOptions error(final double errorRate) {
options.add(ERROR.getRaw());
options.add(Protocol.toByteArray(errorRate));
return this;
}
/**
* If specified, indicates that the filter should not be created if it does not already exist
* It is an error to specify NOCREATE together with either CAPACITY or ERROR .
*/
public InsertOptions nocreate() {
options.add(NOCREATE.getRaw());
return this;
}
public Collection getOptions() {
return Collections.unmodifiableCollection(options);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy