keith-turner commented on a change in pull request #1905:
URL: https://github.com/apache/accumulo/pull/1905#discussion_r570506983
##########
File path:
core/src/main/java/org/apache/accumulo/core/spi/fs/VolumeChooserEnvironment.java
##########
@@ -0,0 +1,29 @@
+package org.apache.accumulo.core.spi.fs;
+
+import org.apache.accumulo.core.data.TableId;
+import org.apache.accumulo.core.spi.common.ServiceEnvironment;
+import org.apache.hadoop.io.Text;
+
+/**
+ * @since 2.1.0
+ */
+public interface VolumeChooserEnvironment {
+ /**
+ * A scope the volume chooser environment; a TABLE scope should be
accompanied by a tableId.
+ *
+ * @since 2.1.0
+ */
+ public static enum Scope {
+ DEFAULT, TABLE, INIT, LOGGER
+ }
+
+ public Text getEndRow();
+
+ public boolean hasTableId();
+
+ public TableId getTableId();
Review comment:
I made that change in 34bd97f.
##########
File path: core/src/main/java/org/apache/accumulo/core/spi/fs/VolumeChooser.java
##########
@@ -0,0 +1,65 @@
+package org.apache.accumulo.core.spi.fs;
+
+import java.util.Set;
+
+import org.apache.accumulo.core.conf.Property;
+
+/**
+ * Helper used to select from a set of Volume URIs. N.B. implementations must
be threadsafe.
+ * VolumeChooser.equals will be used for internal caching.
+ *
+ * <p>
+ * Implementations may wish to store configuration in Accumulo's system
configuration using the
+ * {@link Property#GENERAL_ARBITRARY_PROP_PREFIX}. They may also benefit from
using per-table
+ * configuration using {@link Property#TABLE_ARBITRARY_PROP_PREFIX}.
+ *
+ * @since 2.1.0
+ */
+public interface VolumeChooser {
+
+ /**
+ * Choose a volume from the provided options.
+ *
+ * @param env
+ * the server environment provided by the calling framework
+ * @param options
+ * the list of volumes to choose from
+ * @return one of the options
+ * @throws VolumeChooserException
+ * if there is an error choosing (this is a RuntimeException);
this does not preclude
+ * other RuntimeExceptions from occurring
+ */
+ String choose(VolumeChooserEnvironment env, Set<String> options) throws
VolumeChooserException;
+
+ /**
+ * Return the subset of volumes that could possibly be chosen by this
chooser across all
+ * invocations of {@link #choose(VolumeChooserEnvironment, Set)}.
+ *
+ * @param env
+ * the server environment provided by the calling framework
+ * @param options
+ * the subset of volumes to choose from
+ * @return array of valid options
+ * @throws VolumeChooserException
+ * if there is an error choosing (this is a RuntimeException);
this does not preclude
+ * other RuntimeExceptions from occurring
+ *
+ */
+ Set<String> choosable(VolumeChooserEnvironment env, Set<String> options)
+ throws VolumeChooserException;
+
+ class VolumeChooserException extends RuntimeException {
Review comment:
Maybe it would be best to get rid of it. It does not serve any well
defined purpose in the code over run time exception.
##########
File path: core/src/main/java/org/apache/accumulo/core/spi/fs/VolumeChooser.java
##########
@@ -0,0 +1,65 @@
+package org.apache.accumulo.core.spi.fs;
+
+import java.util.Set;
+
+import org.apache.accumulo.core.conf.Property;
+
+/**
+ * Helper used to select from a set of Volume URIs. N.B. implementations must
be threadsafe.
+ * VolumeChooser.equals will be used for internal caching.
+ *
+ * <p>
+ * Implementations may wish to store configuration in Accumulo's system
configuration using the
+ * {@link Property#GENERAL_ARBITRARY_PROP_PREFIX}. They may also benefit from
using per-table
+ * configuration using {@link Property#TABLE_ARBITRARY_PROP_PREFIX}.
+ *
+ * @since 2.1.0
+ */
+public interface VolumeChooser {
+
+ /**
+ * Choose a volume from the provided options.
+ *
+ * @param env
+ * the server environment provided by the calling framework
+ * @param options
+ * the list of volumes to choose from
+ * @return one of the options
+ * @throws VolumeChooserException
+ * if there is an error choosing (this is a RuntimeException);
this does not preclude
+ * other RuntimeExceptions from occurring
+ */
+ String choose(VolumeChooserEnvironment env, Set<String> options) throws
VolumeChooserException;
+
+ /**
+ * Return the subset of volumes that could possibly be chosen by this
chooser across all
+ * invocations of {@link #choose(VolumeChooserEnvironment, Set)}.
+ *
+ * @param env
+ * the server environment provided by the calling framework
+ * @param options
+ * the subset of volumes to choose from
+ * @return array of valid options
+ * @throws VolumeChooserException
+ * if there is an error choosing (this is a RuntimeException);
this does not preclude
+ * other RuntimeExceptions from occurring
+ *
+ */
+ Set<String> choosable(VolumeChooserEnvironment env, Set<String> options)
+ throws VolumeChooserException;
Review comment:
It is a good time to improve it, I can take a pass at it but I will need
to do some research to figure out the specifics. It was added in #1413 I think.
##########
File path: core/src/main/java/org/apache/accumulo/core/spi/fs/VolumeChooser.java
##########
@@ -0,0 +1,65 @@
+package org.apache.accumulo.core.spi.fs;
+
+import java.util.Set;
+
+import org.apache.accumulo.core.conf.Property;
+
+/**
+ * Helper used to select from a set of Volume URIs. N.B. implementations must
be threadsafe.
+ * VolumeChooser.equals will be used for internal caching.
+ *
+ * <p>
+ * Implementations may wish to store configuration in Accumulo's system
configuration using the
+ * {@link Property#GENERAL_ARBITRARY_PROP_PREFIX}. They may also benefit from
using per-table
+ * configuration using {@link Property#TABLE_ARBITRARY_PROP_PREFIX}.
+ *
+ * @since 2.1.0
+ */
+public interface VolumeChooser {
+
+ /**
+ * Choose a volume from the provided options.
+ *
+ * @param env
+ * the server environment provided by the calling framework
+ * @param options
+ * the list of volumes to choose from
+ * @return one of the options
+ * @throws VolumeChooserException
+ * if there is an error choosing (this is a RuntimeException);
this does not preclude
+ * other RuntimeExceptions from occurring
+ */
+ String choose(VolumeChooserEnvironment env, Set<String> options) throws
VolumeChooserException;
+
+ /**
+ * Return the subset of volumes that could possibly be chosen by this
chooser across all
+ * invocations of {@link #choose(VolumeChooserEnvironment, Set)}.
+ *
+ * @param env
+ * the server environment provided by the calling framework
+ * @param options
+ * the subset of volumes to choose from
+ * @return array of valid options
+ * @throws VolumeChooserException
+ * if there is an error choosing (this is a RuntimeException);
this does not preclude
+ * other RuntimeExceptions from occurring
+ *
+ */
+ Set<String> choosable(VolumeChooserEnvironment env, Set<String> options)
+ throws VolumeChooserException;
+
+ class VolumeChooserException extends RuntimeException {
Review comment:
Its gone
##########
File path: core/src/main/java/org/apache/accumulo/core/spi/fs/VolumeChooser.java
##########
@@ -0,0 +1,65 @@
+package org.apache.accumulo.core.spi.fs;
+
+import java.util.Set;
+
+import org.apache.accumulo.core.conf.Property;
+
+/**
+ * Helper used to select from a set of Volume URIs. N.B. implementations must
be threadsafe.
+ * VolumeChooser.equals will be used for internal caching.
+ *
+ * <p>
+ * Implementations may wish to store configuration in Accumulo's system
configuration using the
+ * {@link Property#GENERAL_ARBITRARY_PROP_PREFIX}. They may also benefit from
using per-table
+ * configuration using {@link Property#TABLE_ARBITRARY_PROP_PREFIX}.
+ *
+ * @since 2.1.0
+ */
+public interface VolumeChooser {
+
+ /**
+ * Choose a volume from the provided options.
+ *
+ * @param env
+ * the server environment provided by the calling framework
+ * @param options
+ * the list of volumes to choose from
+ * @return one of the options
+ * @throws VolumeChooserException
+ * if there is an error choosing (this is a RuntimeException);
this does not preclude
+ * other RuntimeExceptions from occurring
+ */
+ String choose(VolumeChooserEnvironment env, Set<String> options) throws
VolumeChooserException;
+
+ /**
+ * Return the subset of volumes that could possibly be chosen by this
chooser across all
+ * invocations of {@link #choose(VolumeChooserEnvironment, Set)}.
+ *
+ * @param env
+ * the server environment provided by the calling framework
+ * @param options
+ * the subset of volumes to choose from
+ * @return array of valid options
+ * @throws VolumeChooserException
+ * if there is an error choosing (this is a RuntimeException);
this does not preclude
+ * other RuntimeExceptions from occurring
+ *
+ */
+ Set<String> choosable(VolumeChooserEnvironment env, Set<String> options)
+ throws VolumeChooserException;
Review comment:
There is only one use of this functionality in the code. I updated the
javadocs in 8e9c7e0e6526cef89dd9161360de118cb702fbf7
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]