com.basho.riak.client.api.commands.mapreduce.BucketMapReduce Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of riak-client Show documentation
Show all versions of riak-client Show documentation
HttpClient-based client for Riak
The newest version!
package com.basho.riak.client.api.commands.mapreduce;
import com.basho.riak.client.core.query.Namespace;
import com.basho.riak.client.api.commands.mapreduce.filters.KeyFilter;
import java.util.ArrayList;
import java.util.List;
/**
* Command used to perform a Map Reduce operation over a bucket in Riak.
* @author Dave Rusek
* @since 2.0
*/
public class BucketMapReduce extends MapReduce
{
protected BucketMapReduce(BucketInput input, Builder builder)
{
super(input, builder);
}
/**
* Builder for a BucketMapReduce command.
*/
public static class Builder extends MapReduce.Builder
{
private Namespace namespace;
private final List filters = new ArrayList<>();
@Override
protected Builder self()
{
return this;
}
public Builder withNamespace(Namespace namespace)
{
this.namespace = namespace;
return this;
}
public Builder withKeyFilter(KeyFilter filter)
{
filters.add(filter);
return this;
}
public BucketMapReduce build()
{
if (namespace == null)
{
throw new IllegalStateException("A Namespace must be specified");
}
return new BucketMapReduce(new BucketInput(namespace, filters), this);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy