repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
partition
stringclasses
1 value
voldemort/voldemort
src/java/voldemort/utils/ReflectUtils.java
ReflectUtils.callConstructor
public static <T> T callConstructor(Class<T> klass) { return callConstructor(klass, new Class<?>[0], new Object[0]); }
java
public static <T> T callConstructor(Class<T> klass) { return callConstructor(klass, new Class<?>[0], new Object[0]); }
[ "public", "static", "<", "T", ">", "T", "callConstructor", "(", "Class", "<", "T", ">", "klass", ")", "{", "return", "callConstructor", "(", "klass", ",", "new", "Class", "<", "?", ">", "[", "0", "]", ",", "new", "Object", "[", "0", "]", ")", ";"...
Call the no-arg constructor for the given class @param <T> The type of the thing to construct @param klass The class @return The constructed thing
[ "Call", "the", "no", "-", "arg", "constructor", "for", "the", "given", "class" ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/utils/ReflectUtils.java#L85-L87
train
voldemort/voldemort
src/java/voldemort/utils/ReflectUtils.java
ReflectUtils.callConstructor
public static <T> T callConstructor(Class<T> klass, Object[] args) { Class<?>[] klasses = new Class[args.length]; for(int i = 0; i < args.length; i++) klasses[i] = args[i].getClass(); return callConstructor(klass, klasses, args); }
java
public static <T> T callConstructor(Class<T> klass, Object[] args) { Class<?>[] klasses = new Class[args.length]; for(int i = 0; i < args.length; i++) klasses[i] = args[i].getClass(); return callConstructor(klass, klasses, args); }
[ "public", "static", "<", "T", ">", "T", "callConstructor", "(", "Class", "<", "T", ">", "klass", ",", "Object", "[", "]", "args", ")", "{", "Class", "<", "?", ">", "[", "]", "klasses", "=", "new", "Class", "[", "args", ".", "length", "]", ";", ...
Call the constructor for the given class, inferring the correct types for the arguments. This could be confusing if there are multiple constructors with the same number of arguments and the values themselves don't disambiguate. @param klass The class to construct @param args The arguments @return The constructed value
[ "Call", "the", "constructor", "for", "the", "given", "class", "inferring", "the", "correct", "types", "for", "the", "arguments", ".", "This", "could", "be", "confusing", "if", "there", "are", "multiple", "constructors", "with", "the", "same", "number", "of", ...
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/utils/ReflectUtils.java#L99-L104
train
voldemort/voldemort
src/java/voldemort/utils/ReflectUtils.java
ReflectUtils.callMethod
public static <T> Object callMethod(Object obj, Class<T> c, String name, Class<?>[] classes, Object[] args) { try { Method m = getMethod(c, ...
java
public static <T> Object callMethod(Object obj, Class<T> c, String name, Class<?>[] classes, Object[] args) { try { Method m = getMethod(c, ...
[ "public", "static", "<", "T", ">", "Object", "callMethod", "(", "Object", "obj", ",", "Class", "<", "T", ">", "c", ",", "String", "name", ",", "Class", "<", "?", ">", "[", "]", "classes", ",", "Object", "[", "]", "args", ")", "{", "try", "{", "...
Call the named method @param obj The object to call the method on @param c The class of the object @param name The name of the method @param args The method arguments @return The result of the method
[ "Call", "the", "named", "method" ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/utils/ReflectUtils.java#L137-L150
train
voldemort/voldemort
src/java/voldemort/utils/ReflectUtils.java
ReflectUtils.getMethod
public static <T> Method getMethod(Class<T> c, String name, Class<?>... argTypes) { try { return c.getMethod(name, argTypes); } catch(NoSuchMethodException e) { throw new IllegalArgumentException(e); } }
java
public static <T> Method getMethod(Class<T> c, String name, Class<?>... argTypes) { try { return c.getMethod(name, argTypes); } catch(NoSuchMethodException e) { throw new IllegalArgumentException(e); } }
[ "public", "static", "<", "T", ">", "Method", "getMethod", "(", "Class", "<", "T", ">", "c", ",", "String", "name", ",", "Class", "<", "?", ">", "...", "argTypes", ")", "{", "try", "{", "return", "c", ".", "getMethod", "(", "name", ",", "argTypes", ...
Get the named method from the class @param c The class to get the method from @param name The method name @param argTypes The argument types @return The method
[ "Get", "the", "named", "method", "from", "the", "class" ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/utils/ReflectUtils.java#L160-L166
train
voldemort/voldemort
src/java/voldemort/server/storage/prunejob/VersionedPutPruneJob.java
VersionedPutPruneJob.pruneNonReplicaEntries
public static List<Versioned<byte[]>> pruneNonReplicaEntries(List<Versioned<byte[]>> vals, List<Integer> keyReplicas, MutableBoolean didPrune) { List<Versioned<byte[]>> prunedVals = ...
java
public static List<Versioned<byte[]>> pruneNonReplicaEntries(List<Versioned<byte[]>> vals, List<Integer> keyReplicas, MutableBoolean didPrune) { List<Versioned<byte[]>> prunedVals = ...
[ "public", "static", "List", "<", "Versioned", "<", "byte", "[", "]", ">", ">", "pruneNonReplicaEntries", "(", "List", "<", "Versioned", "<", "byte", "[", "]", ">", ">", "vals", ",", "List", "<", "Integer", ">", "keyReplicas", ",", "MutableBoolean", "didP...
Remove all non replica clock entries from the list of versioned values provided @param vals list of versioned values to prune replicas from @param keyReplicas list of current replicas for the given key @param didPrune flag to mark if we did actually prune something @return pruned list
[ "Remove", "all", "non", "replica", "clock", "entries", "from", "the", "list", "of", "versioned", "values", "provided" ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/server/storage/prunejob/VersionedPutPruneJob.java#L181-L199
train
voldemort/voldemort
src/java/voldemort/serialization/ObjectSerializer.java
ObjectSerializer.toBytes
public byte[] toBytes(T object) { try { ByteArrayOutputStream stream = new ByteArrayOutputStream(); ObjectOutputStream out = new ObjectOutputStream(stream); out.writeObject(object); return stream.toByteArray(); } catch(IOException e) { throw ne...
java
public byte[] toBytes(T object) { try { ByteArrayOutputStream stream = new ByteArrayOutputStream(); ObjectOutputStream out = new ObjectOutputStream(stream); out.writeObject(object); return stream.toByteArray(); } catch(IOException e) { throw ne...
[ "public", "byte", "[", "]", "toBytes", "(", "T", "object", ")", "{", "try", "{", "ByteArrayOutputStream", "stream", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "ObjectOutputStream", "out", "=", "new", "ObjectOutputStream", "(", "stream", ")", ";", "o...
Transform the given object into an array of bytes @param object The object to be serialized @return The bytes created from serializing the object
[ "Transform", "the", "given", "object", "into", "an", "array", "of", "bytes" ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/serialization/ObjectSerializer.java#L40-L49
train
voldemort/voldemort
src/java/voldemort/serialization/ObjectSerializer.java
ObjectSerializer.toObject
@SuppressWarnings("unchecked") public T toObject(byte[] bytes) { try { return (T) new ObjectInputStream(new ByteArrayInputStream(bytes)).readObject(); } catch(IOException e) { throw new SerializationException(e); } catch(ClassNotFoundException c) { throw n...
java
@SuppressWarnings("unchecked") public T toObject(byte[] bytes) { try { return (T) new ObjectInputStream(new ByteArrayInputStream(bytes)).readObject(); } catch(IOException e) { throw new SerializationException(e); } catch(ClassNotFoundException c) { throw n...
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "T", "toObject", "(", "byte", "[", "]", "bytes", ")", "{", "try", "{", "return", "(", "T", ")", "new", "ObjectInputStream", "(", "new", "ByteArrayInputStream", "(", "bytes", ")", ")", ".", "re...
Transform the given bytes into an object. @param bytes The bytes to construct the object from @return The object constructed
[ "Transform", "the", "given", "bytes", "into", "an", "object", "." ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/serialization/ObjectSerializer.java#L57-L66
train
voldemort/voldemort
src/java/voldemort/server/protocol/vold/VoldemortNativeRequestHandler.java
VoldemortNativeRequestHandler.isCompleteRequest
@Override public boolean isCompleteRequest(final ByteBuffer buffer) throws VoldemortException { DataInputStream inputStream = new DataInputStream(new ByteBufferBackedInputStream(buffer)); try { byte opCode = inputStream.readByte(); // Store Name inputStream.read...
java
@Override public boolean isCompleteRequest(final ByteBuffer buffer) throws VoldemortException { DataInputStream inputStream = new DataInputStream(new ByteBufferBackedInputStream(buffer)); try { byte opCode = inputStream.readByte(); // Store Name inputStream.read...
[ "@", "Override", "public", "boolean", "isCompleteRequest", "(", "final", "ByteBuffer", "buffer", ")", "throws", "VoldemortException", "{", "DataInputStream", "inputStream", "=", "new", "DataInputStream", "(", "new", "ByteBufferBackedInputStream", "(", "buffer", ")", "...
This is pretty ugly. We end up mimicking the request logic here, so this needs to stay in sync with handleRequest.
[ "This", "is", "pretty", "ugly", ".", "We", "end", "up", "mimicking", "the", "request", "logic", "here", "so", "this", "needs", "to", "stay", "in", "sync", "with", "handleRequest", "." ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/server/protocol/vold/VoldemortNativeRequestHandler.java#L161-L216
train
voldemort/voldemort
src/java/voldemort/utils/WriteThroughCache.java
WriteThroughCache.put
@Override synchronized public V put(K key, V value) { V oldValue = this.get(key); try { super.put(key, value); writeBack(key, value); return oldValue; } catch(Exception e) { super.put(key, oldValue); writeBack(key, oldValue); ...
java
@Override synchronized public V put(K key, V value) { V oldValue = this.get(key); try { super.put(key, value); writeBack(key, value); return oldValue; } catch(Exception e) { super.put(key, oldValue); writeBack(key, oldValue); ...
[ "@", "Override", "synchronized", "public", "V", "put", "(", "K", "key", ",", "V", "value", ")", "{", "V", "oldValue", "=", "this", ".", "get", "(", "key", ")", ";", "try", "{", "super", ".", "put", "(", "key", ",", "value", ")", ";", "writeBack",...
Updates the value in HashMap and writeBack as Atomic step
[ "Updates", "the", "value", "in", "HashMap", "and", "writeBack", "as", "Atomic", "step" ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/utils/WriteThroughCache.java#L55-L68
train
voldemort/voldemort
src/java/voldemort/store/readonly/checksum/CheckSum.java
CheckSum.update
public void update(int number) { byte[] numberInBytes = new byte[ByteUtils.SIZE_OF_INT]; ByteUtils.writeInt(numberInBytes, number, 0); update(numberInBytes); }
java
public void update(int number) { byte[] numberInBytes = new byte[ByteUtils.SIZE_OF_INT]; ByteUtils.writeInt(numberInBytes, number, 0); update(numberInBytes); }
[ "public", "void", "update", "(", "int", "number", ")", "{", "byte", "[", "]", "numberInBytes", "=", "new", "byte", "[", "ByteUtils", ".", "SIZE_OF_INT", "]", ";", "ByteUtils", ".", "writeInt", "(", "numberInBytes", ",", "number", ",", "0", ")", ";", "u...
Update the underlying buffer using the integer @param number number to be stored in checksum buffer
[ "Update", "the", "underlying", "buffer", "using", "the", "integer" ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/store/readonly/checksum/CheckSum.java#L64-L68
train
voldemort/voldemort
src/java/voldemort/store/readonly/checksum/CheckSum.java
CheckSum.update
public void update(short number) { byte[] numberInBytes = new byte[ByteUtils.SIZE_OF_SHORT]; ByteUtils.writeShort(numberInBytes, number, 0); update(numberInBytes); }
java
public void update(short number) { byte[] numberInBytes = new byte[ByteUtils.SIZE_OF_SHORT]; ByteUtils.writeShort(numberInBytes, number, 0); update(numberInBytes); }
[ "public", "void", "update", "(", "short", "number", ")", "{", "byte", "[", "]", "numberInBytes", "=", "new", "byte", "[", "ByteUtils", ".", "SIZE_OF_SHORT", "]", ";", "ByteUtils", ".", "writeShort", "(", "numberInBytes", ",", "number", ",", "0", ")", ";"...
Update the underlying buffer using the short @param number number to be stored in checksum buffer
[ "Update", "the", "underlying", "buffer", "using", "the", "short" ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/store/readonly/checksum/CheckSum.java#L75-L79
train
voldemort/voldemort
src/java/voldemort/store/routed/action/AsyncPutSynchronizer.java
AsyncPutSynchronizer.tryDelegateSlop
public synchronized boolean tryDelegateSlop(Node node) { if(asyncCallbackShouldSendhint) { return false; } else { slopDestinations.put(node, true); return true; } }
java
public synchronized boolean tryDelegateSlop(Node node) { if(asyncCallbackShouldSendhint) { return false; } else { slopDestinations.put(node, true); return true; } }
[ "public", "synchronized", "boolean", "tryDelegateSlop", "(", "Node", "node", ")", "{", "if", "(", "asyncCallbackShouldSendhint", ")", "{", "return", "false", ";", "}", "else", "{", "slopDestinations", ".", "put", "(", "node", ",", "true", ")", ";", "return",...
Try to delegate the responsibility of sending slops to master @param node The node that slop should eventually be pushed to @return true if master accept the responsibility; false if master does not accept
[ "Try", "to", "delegate", "the", "responsibility", "of", "sending", "slops", "to", "master" ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/store/routed/action/AsyncPutSynchronizer.java#L64-L71
train
voldemort/voldemort
src/java/voldemort/store/routed/action/AsyncPutSynchronizer.java
AsyncPutSynchronizer.tryDelegateResponseHandling
public synchronized boolean tryDelegateResponseHandling(Response<ByteArray, Object> response) { if(responseHandlingCutoff) { return false; } else { responseQueue.offer(response); this.notifyAll(); return true; } }
java
public synchronized boolean tryDelegateResponseHandling(Response<ByteArray, Object> response) { if(responseHandlingCutoff) { return false; } else { responseQueue.offer(response); this.notifyAll(); return true; } }
[ "public", "synchronized", "boolean", "tryDelegateResponseHandling", "(", "Response", "<", "ByteArray", ",", "Object", ">", "response", ")", "{", "if", "(", "responseHandlingCutoff", ")", "{", "return", "false", ";", "}", "else", "{", "responseQueue", ".", "offer...
try to delegate the master to handle the response @param response @return true if the master accepted the response; false if the master didn't accept
[ "try", "to", "delegate", "the", "master", "to", "handle", "the", "response" ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/store/routed/action/AsyncPutSynchronizer.java#L87-L95
train
voldemort/voldemort
src/java/voldemort/store/routed/action/AsyncPutSynchronizer.java
AsyncPutSynchronizer.responseQueuePoll
public synchronized Response<ByteArray, Object> responseQueuePoll(long timeout, TimeUnit timeUnit) throws InterruptedException { long timeoutMs = timeUnit.toMillis(timeout); long timeoutWallClockMs = System.currentTimeMill...
java
public synchronized Response<ByteArray, Object> responseQueuePoll(long timeout, TimeUnit timeUnit) throws InterruptedException { long timeoutMs = timeUnit.toMillis(timeout); long timeoutWallClockMs = System.currentTimeMill...
[ "public", "synchronized", "Response", "<", "ByteArray", ",", "Object", ">", "responseQueuePoll", "(", "long", "timeout", ",", "TimeUnit", "timeUnit", ")", "throws", "InterruptedException", "{", "long", "timeoutMs", "=", "timeUnit", ".", "toMillis", "(", "timeout",...
poll the response queue for response @param timeout timeout amount @param timeUnit timeUnit of timeout @return same result of BlockQueue.poll(long, TimeUnit) @throws InterruptedException
[ "poll", "the", "response", "queue", "for", "response" ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/store/routed/action/AsyncPutSynchronizer.java#L105-L121
train
voldemort/voldemort
contrib/restclient/src/java/voldemort/restclient/RESTClientConfig.java
RESTClientConfig.setProperties
private void setProperties(Properties properties) { Props props = new Props(properties); if(props.containsKey(ClientConfig.ENABLE_JMX_PROPERTY)) { this.setEnableJmx(props.getBoolean(ClientConfig.ENABLE_JMX_PROPERTY)); } if(props.containsKey(ClientConfig.BOOTSTRAP_URLS_PROPER...
java
private void setProperties(Properties properties) { Props props = new Props(properties); if(props.containsKey(ClientConfig.ENABLE_JMX_PROPERTY)) { this.setEnableJmx(props.getBoolean(ClientConfig.ENABLE_JMX_PROPERTY)); } if(props.containsKey(ClientConfig.BOOTSTRAP_URLS_PROPER...
[ "private", "void", "setProperties", "(", "Properties", "properties", ")", "{", "Props", "props", "=", "new", "Props", "(", "properties", ")", ";", "if", "(", "props", ".", "containsKey", "(", "ClientConfig", ".", "ENABLE_JMX_PROPERTY", ")", ")", "{", "this",...
Set the values using the specified Properties object. @param properties Properties object containing specific property values for the RESTClient config Note: We're using the same property names as that in ClientConfig for backwards compatibility.
[ "Set", "the", "values", "using", "the", "specified", "Properties", "object", "." ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/contrib/restclient/src/java/voldemort/restclient/RESTClientConfig.java#L76-L128
train
voldemort/voldemort
src/java/voldemort/rest/coordinator/config/CoordinatorConfig.java
CoordinatorConfig.setProperties
private void setProperties(Properties properties) { Props props = new Props(properties); if(props.containsKey(BOOTSTRAP_URLS_PROPERTY)) { setBootstrapURLs(props.getList(BOOTSTRAP_URLS_PROPERTY)); } if(props.containsKey(FAT_CLIENTS_CONFIG_SOURCE)) { setFatClientCo...
java
private void setProperties(Properties properties) { Props props = new Props(properties); if(props.containsKey(BOOTSTRAP_URLS_PROPERTY)) { setBootstrapURLs(props.getList(BOOTSTRAP_URLS_PROPERTY)); } if(props.containsKey(FAT_CLIENTS_CONFIG_SOURCE)) { setFatClientCo...
[ "private", "void", "setProperties", "(", "Properties", "properties", ")", "{", "Props", "props", "=", "new", "Props", "(", "properties", ")", ";", "if", "(", "props", ".", "containsKey", "(", "BOOTSTRAP_URLS_PROPERTY", ")", ")", "{", "setBootstrapURLs", "(", ...
Set the values using the specified Properties object @param properties Properties object containing specific property values for the Coordinator config
[ "Set", "the", "values", "using", "the", "specified", "Properties", "object" ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/rest/coordinator/config/CoordinatorConfig.java#L115-L173
train
voldemort/voldemort
src/java/voldemort/rest/coordinator/config/CoordinatorConfig.java
CoordinatorConfig.setBootstrapURLs
public CoordinatorConfig setBootstrapURLs(List<String> bootstrapUrls) { this.bootstrapURLs = Utils.notNull(bootstrapUrls); if(this.bootstrapURLs.size() <= 0) throw new IllegalArgumentException("Must provide at least one bootstrap URL."); return this; }
java
public CoordinatorConfig setBootstrapURLs(List<String> bootstrapUrls) { this.bootstrapURLs = Utils.notNull(bootstrapUrls); if(this.bootstrapURLs.size() <= 0) throw new IllegalArgumentException("Must provide at least one bootstrap URL."); return this; }
[ "public", "CoordinatorConfig", "setBootstrapURLs", "(", "List", "<", "String", ">", "bootstrapUrls", ")", "{", "this", ".", "bootstrapURLs", "=", "Utils", ".", "notNull", "(", "bootstrapUrls", ")", ";", "if", "(", "this", ".", "bootstrapURLs", ".", "size", "...
Sets the bootstrap URLs used by the different Fat clients inside the Coordinator @param bootstrapUrls list of bootstrap URLs defining which cluster to connect to @return modified CoordinatorConfig
[ "Sets", "the", "bootstrap", "URLs", "used", "by", "the", "different", "Fat", "clients", "inside", "the", "Coordinator" ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/rest/coordinator/config/CoordinatorConfig.java#L189-L194
train
voldemort/voldemort
src/java/voldemort/store/slop/HintedHandoff.java
HintedHandoff.sendOneAsyncHint
private void sendOneAsyncHint(final ByteArray slopKey, final Versioned<byte[]> slopVersioned, final List<Node> nodesToTry) { Node nodeToHostHint = null; boolean foundNode = false; while(nodesToTry.size() > 0) { nodeT...
java
private void sendOneAsyncHint(final ByteArray slopKey, final Versioned<byte[]> slopVersioned, final List<Node> nodesToTry) { Node nodeToHostHint = null; boolean foundNode = false; while(nodesToTry.size() > 0) { nodeT...
[ "private", "void", "sendOneAsyncHint", "(", "final", "ByteArray", "slopKey", ",", "final", "Versioned", "<", "byte", "[", "]", ">", "slopVersioned", ",", "final", "List", "<", "Node", ">", "nodesToTry", ")", "{", "Node", "nodeToHostHint", "=", "null", ";", ...
A callback that handles requestComplete event from NIO selector manager Will try any possible nodes and pass itself as callback util all nodes are exhausted @param slopKey @param slopVersioned @param nodesToTry List of nodes to try to contact. Will become shorter after each callback
[ "A", "callback", "that", "handles", "requestComplete", "event", "from", "NIO", "selector", "manager", "Will", "try", "any", "possible", "nodes", "and", "pass", "itself", "as", "callback", "util", "all", "nodes", "are", "exhausted" ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/store/slop/HintedHandoff.java#L127-L194
train
voldemort/voldemort
src/java/voldemort/store/readonly/ExternalSorter.java
ExternalSorter.sorted
public Iterable<V> sorted(Iterator<V> input) { ExecutorService executor = new ThreadPoolExecutor(this.numThreads, this.numThreads, 1000L, ...
java
public Iterable<V> sorted(Iterator<V> input) { ExecutorService executor = new ThreadPoolExecutor(this.numThreads, this.numThreads, 1000L, ...
[ "public", "Iterable", "<", "V", ">", "sorted", "(", "Iterator", "<", "V", ">", "input", ")", "{", "ExecutorService", "executor", "=", "new", "ThreadPoolExecutor", "(", "this", ".", "numThreads", ",", "this", ".", "numThreads", ",", "1000L", ",", "TimeUnit"...
Produce an iterator over the input values in sorted order. Sorting will occur in the fixed space configured in the constructor, data will be dumped to disk as necessary. @param input An iterator over the input values @return An iterator over the values
[ "Produce", "an", "iterator", "over", "the", "input", "values", "in", "sorted", "order", ".", "Sorting", "will", "occur", "in", "the", "fixed", "space", "configured", "in", "the", "constructor", "data", "will", "be", "dumped", "to", "disk", "as", "necessary",...
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/store/readonly/ExternalSorter.java#L162-L227
train
voldemort/voldemort
src/java/voldemort/store/routed/action/PerformParallelPutRequests.java
PerformParallelPutRequests.processResponse
private void processResponse(Response<ByteArray, Object> response, Pipeline pipeline) { if(response == null) { logger.warn("RoutingTimedout on waiting for async ops; parallelResponseToWait: " + numNodesPendingResponse + "; preferred-1: " + (preferred - 1) ...
java
private void processResponse(Response<ByteArray, Object> response, Pipeline pipeline) { if(response == null) { logger.warn("RoutingTimedout on waiting for async ops; parallelResponseToWait: " + numNodesPendingResponse + "; preferred-1: " + (preferred - 1) ...
[ "private", "void", "processResponse", "(", "Response", "<", "ByteArray", ",", "Object", ">", "response", ",", "Pipeline", "pipeline", ")", "{", "if", "(", "response", "==", "null", ")", "{", "logger", ".", "warn", "(", "\"RoutingTimedout on waiting for async ops...
Process the response by reporting proper log and feeding failure detectors @param response @param pipeline
[ "Process", "the", "response", "by", "reporting", "proper", "log", "and", "feeding", "failure", "detectors" ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/store/routed/action/PerformParallelPutRequests.java#L381-L450
train
voldemort/voldemort
src/java/voldemort/store/routed/action/PerformParallelPutRequests.java
PerformParallelPutRequests.isZonesSatisfied
private boolean isZonesSatisfied() { boolean zonesSatisfied = false; if(pipelineData.getZonesRequired() == null) { zonesSatisfied = true; } else { int numZonesSatisfied = pipelineData.getZoneResponses().size(); if(numZonesSatisfied >= (pipelineData.getZonesReq...
java
private boolean isZonesSatisfied() { boolean zonesSatisfied = false; if(pipelineData.getZonesRequired() == null) { zonesSatisfied = true; } else { int numZonesSatisfied = pipelineData.getZoneResponses().size(); if(numZonesSatisfied >= (pipelineData.getZonesReq...
[ "private", "boolean", "isZonesSatisfied", "(", ")", "{", "boolean", "zonesSatisfied", "=", "false", ";", "if", "(", "pipelineData", ".", "getZonesRequired", "(", ")", "==", "null", ")", "{", "zonesSatisfied", "=", "true", ";", "}", "else", "{", "int", "num...
Check if zone count policy is satisfied @return whether zone is satisfied
[ "Check", "if", "zone", "count", "policy", "is", "satisfied" ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/store/routed/action/PerformParallelPutRequests.java#L466-L477
train
voldemort/voldemort
src/java/voldemort/client/ClientConfig.java
ClientConfig.setIdleConnectionTimeout
public ClientConfig setIdleConnectionTimeout(long idleConnectionTimeout, TimeUnit unit) { if (idleConnectionTimeout <= 0) { this.idleConnectionTimeoutMs = -1; } else { if(unit.toMinutes(idleConnectionTimeout) < 10) { throw new IllegalArgumentException("idleConnect...
java
public ClientConfig setIdleConnectionTimeout(long idleConnectionTimeout, TimeUnit unit) { if (idleConnectionTimeout <= 0) { this.idleConnectionTimeoutMs = -1; } else { if(unit.toMinutes(idleConnectionTimeout) < 10) { throw new IllegalArgumentException("idleConnect...
[ "public", "ClientConfig", "setIdleConnectionTimeout", "(", "long", "idleConnectionTimeout", ",", "TimeUnit", "unit", ")", "{", "if", "(", "idleConnectionTimeout", "<=", "0", ")", "{", "this", ".", "idleConnectionTimeoutMs", "=", "-", "1", ";", "}", "else", "{", ...
Set the timeout for idle connections. Voldemort client caches all connections to the Voldemort server. This setting allows the a connection to be dropped, if it is idle for more than this time. This could be useful in the following cases 1) Voldemort client is not directly connected to the server and is connected via ...
[ "Set", "the", "timeout", "for", "idle", "connections", ".", "Voldemort", "client", "caches", "all", "connections", "to", "the", "Voldemort", "server", ".", "This", "setting", "allows", "the", "a", "connection", "to", "be", "dropped", "if", "it", "is", "idle"...
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/client/ClientConfig.java#L617-L627
train
voldemort/voldemort
src/java/voldemort/client/ClientConfig.java
ClientConfig.setNodeBannagePeriod
@Deprecated public ClientConfig setNodeBannagePeriod(int nodeBannagePeriod, TimeUnit unit) { this.failureDetectorBannagePeriod = unit.toMillis(nodeBannagePeriod); return this; }
java
@Deprecated public ClientConfig setNodeBannagePeriod(int nodeBannagePeriod, TimeUnit unit) { this.failureDetectorBannagePeriod = unit.toMillis(nodeBannagePeriod); return this; }
[ "@", "Deprecated", "public", "ClientConfig", "setNodeBannagePeriod", "(", "int", "nodeBannagePeriod", ",", "TimeUnit", "unit", ")", "{", "this", ".", "failureDetectorBannagePeriod", "=", "unit", ".", "toMillis", "(", "nodeBannagePeriod", ")", ";", "return", "this", ...
The period of time to ban a node that gives an error on an operation. @param nodeBannagePeriod The period of time to ban the node @param unit The time unit of the given value @deprecated Use {@link #setFailureDetectorBannagePeriod(long)} instead
[ "The", "period", "of", "time", "to", "ban", "a", "node", "that", "gives", "an", "error", "on", "an", "operation", "." ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/client/ClientConfig.java#L721-L725
train
voldemort/voldemort
src/java/voldemort/client/ClientConfig.java
ClientConfig.setThreadIdleTime
@Deprecated public ClientConfig setThreadIdleTime(long threadIdleTime, TimeUnit unit) { this.threadIdleMs = unit.toMillis(threadIdleTime); return this; }
java
@Deprecated public ClientConfig setThreadIdleTime(long threadIdleTime, TimeUnit unit) { this.threadIdleMs = unit.toMillis(threadIdleTime); return this; }
[ "@", "Deprecated", "public", "ClientConfig", "setThreadIdleTime", "(", "long", "threadIdleTime", ",", "TimeUnit", "unit", ")", "{", "this", ".", "threadIdleMs", "=", "unit", ".", "toMillis", "(", "threadIdleTime", ")", ";", "return", "this", ";", "}" ]
The amount of time to keep an idle client thread alive @param threadIdleTime
[ "The", "amount", "of", "time", "to", "keep", "an", "idle", "client", "thread", "alive" ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/client/ClientConfig.java#L862-L866
train
voldemort/voldemort
src/java/voldemort/store/socket/clientrequest/ClientRequestExecutorPool.java
ClientRequestExecutorPool.close
@Override public void close(SocketDestination destination) { factory.setLastClosedTimestamp(destination); queuedPool.reset(destination); }
java
@Override public void close(SocketDestination destination) { factory.setLastClosedTimestamp(destination); queuedPool.reset(destination); }
[ "@", "Override", "public", "void", "close", "(", "SocketDestination", "destination", ")", "{", "factory", ".", "setLastClosedTimestamp", "(", "destination", ")", ";", "queuedPool", ".", "reset", "(", "destination", ")", ";", "}" ]
Reset the pool of resources for a specific destination. Idle resources will be destroyed. Checked out resources that are subsequently checked in will be destroyed. Newly created resources can be checked in to reestablish resources for the specific destination.
[ "Reset", "the", "pool", "of", "resources", "for", "a", "specific", "destination", ".", "Idle", "resources", "will", "be", "destroyed", ".", "Checked", "out", "resources", "that", "are", "subsequently", "checked", "in", "will", "be", "destroyed", ".", "Newly", ...
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/store/socket/clientrequest/ClientRequestExecutorPool.java#L269-L273
train
voldemort/voldemort
src/java/voldemort/store/socket/clientrequest/ClientRequestExecutorPool.java
ClientRequestExecutorPool.close
@Override public void close() { // unregister MBeans if(stats != null) { try { if(this.jmxEnabled) JmxUtils.unregisterMbean(getAggregateMetricName()); } catch(Exception e) {} stats.close(); } factory.close(); ...
java
@Override public void close() { // unregister MBeans if(stats != null) { try { if(this.jmxEnabled) JmxUtils.unregisterMbean(getAggregateMetricName()); } catch(Exception e) {} stats.close(); } factory.close(); ...
[ "@", "Override", "public", "void", "close", "(", ")", "{", "// unregister MBeans", "if", "(", "stats", "!=", "null", ")", "{", "try", "{", "if", "(", "this", ".", "jmxEnabled", ")", "JmxUtils", ".", "unregisterMbean", "(", "getAggregateMetricName", "(", ")...
Permanently close the ClientRequestExecutor pool. Resources subsequently checked in will be destroyed.
[ "Permanently", "close", "the", "ClientRequestExecutor", "pool", ".", "Resources", "subsequently", "checked", "in", "will", "be", "destroyed", "." ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/store/socket/clientrequest/ClientRequestExecutorPool.java#L279-L291
train
voldemort/voldemort
contrib/hadoop-store-builder/src/java/voldemort/store/readonly/mr/HadoopStoreBuilderUtils.java
HadoopStoreBuilderUtils.readFileContents
public static String readFileContents(FileSystem fs, Path path, int bufferSize) throws IOException { if(bufferSize <= 0) return new String(); FSDataInputStream input = fs.open(path); byte[] buffer = new byte[bufferSize]; ByteArrayOutputStream stream = new ByteAr...
java
public static String readFileContents(FileSystem fs, Path path, int bufferSize) throws IOException { if(bufferSize <= 0) return new String(); FSDataInputStream input = fs.open(path); byte[] buffer = new byte[bufferSize]; ByteArrayOutputStream stream = new ByteAr...
[ "public", "static", "String", "readFileContents", "(", "FileSystem", "fs", ",", "Path", "path", ",", "int", "bufferSize", ")", "throws", "IOException", "{", "if", "(", "bufferSize", "<=", "0", ")", "return", "new", "String", "(", ")", ";", "FSDataInputStream...
Given a filesystem, path and buffer-size, read the file contents and presents it as a string @param fs Underlying filesystem @param path The file to read @param bufferSize The buffer size to use for reading @return The contents of the file as a string @throws IOException
[ "Given", "a", "filesystem", "path", "and", "buffer", "-", "size", "read", "the", "file", "contents", "and", "presents", "it", "as", "a", "string" ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/contrib/hadoop-store-builder/src/java/voldemort/store/readonly/mr/HadoopStoreBuilderUtils.java#L52-L73
train
voldemort/voldemort
contrib/hadoop-store-builder/src/java/voldemort/store/readonly/mr/HadoopStoreBuilderUtils.java
HadoopStoreBuilderUtils.getDataChunkFiles
public static FileStatus[] getDataChunkFiles(FileSystem fs, Path path, final int partitionId, final int replicaType) throws IOException { return fs.listStatus(path, ...
java
public static FileStatus[] getDataChunkFiles(FileSystem fs, Path path, final int partitionId, final int replicaType) throws IOException { return fs.listStatus(path, ...
[ "public", "static", "FileStatus", "[", "]", "getDataChunkFiles", "(", "FileSystem", "fs", ",", "Path", "path", ",", "final", "int", "partitionId", ",", "final", "int", "replicaType", ")", "throws", "IOException", "{", "return", "fs", ".", "listStatus", "(", ...
Given a filesystem and path to a node, gets all the files which belong to a partition and replica type Works only for {@link ReadOnlyStorageFormat.READONLY_V2} @param fs Underlying filesystem @param path The node directory path @param partitionId The partition id for which we get the files @param replicaType The repl...
[ "Given", "a", "filesystem", "and", "path", "to", "a", "node", "gets", "all", "the", "files", "which", "belong", "to", "a", "partition", "and", "replica", "type" ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/contrib/hadoop-store-builder/src/java/voldemort/store/readonly/mr/HadoopStoreBuilderUtils.java#L88-L103
train
voldemort/voldemort
src/java/voldemort/store/routed/action/PerformSerialRequests.java
PerformSerialRequests.isSatisfied
private boolean isSatisfied() { if(pipelineData.getZonesRequired() != null) { return ((pipelineData.getSuccesses() >= required) && (pipelineData.getZoneResponses() .size() >= (pipelineData.getZonesRequired() + 1))); ...
java
private boolean isSatisfied() { if(pipelineData.getZonesRequired() != null) { return ((pipelineData.getSuccesses() >= required) && (pipelineData.getZoneResponses() .size() >= (pipelineData.getZonesRequired() + 1))); ...
[ "private", "boolean", "isSatisfied", "(", ")", "{", "if", "(", "pipelineData", ".", "getZonesRequired", "(", ")", "!=", "null", ")", "{", "return", "(", "(", "pipelineData", ".", "getSuccesses", "(", ")", ">=", "required", ")", "&&", "(", "pipelineData", ...
Checks whether every property except 'preferred' is satisfied @return
[ "Checks", "whether", "every", "property", "except", "preferred", "is", "satisfied" ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/store/routed/action/PerformSerialRequests.java#L74-L81
train
voldemort/voldemort
src/java/voldemort/client/rebalance/RebalanceBatchPlan.java
RebalanceBatchPlan.getCrossZonePartitionStoreMoves
public int getCrossZonePartitionStoreMoves() { int xzonePartitionStoreMoves = 0; for (RebalanceTaskInfo info : batchPlan) { Node donorNode = finalCluster.getNodeById(info.getDonorId()); Node stealerNode = finalCluster.getNodeById(info.getStealerId()); if(donorNode.ge...
java
public int getCrossZonePartitionStoreMoves() { int xzonePartitionStoreMoves = 0; for (RebalanceTaskInfo info : batchPlan) { Node donorNode = finalCluster.getNodeById(info.getDonorId()); Node stealerNode = finalCluster.getNodeById(info.getStealerId()); if(donorNode.ge...
[ "public", "int", "getCrossZonePartitionStoreMoves", "(", ")", "{", "int", "xzonePartitionStoreMoves", "=", "0", ";", "for", "(", "RebalanceTaskInfo", "info", ":", "batchPlan", ")", "{", "Node", "donorNode", "=", "finalCluster", ".", "getNodeById", "(", "info", "...
Determines total number of partition-stores moved across zones. @return number of cross zone partition-store moves
[ "Determines", "total", "number", "of", "partition", "-", "stores", "moved", "across", "zones", "." ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/client/rebalance/RebalanceBatchPlan.java#L150-L162
train
voldemort/voldemort
src/java/voldemort/client/rebalance/RebalanceBatchPlan.java
RebalanceBatchPlan.getDonorId
protected int getDonorId(StoreRoutingPlan currentSRP, StoreRoutingPlan finalSRP, int stealerZoneId, int stealerNodeId, int stealerPartitionId) { int stealerZoneNAry = finalSRP.getZoneNaryForNodesP...
java
protected int getDonorId(StoreRoutingPlan currentSRP, StoreRoutingPlan finalSRP, int stealerZoneId, int stealerNodeId, int stealerPartitionId) { int stealerZoneNAry = finalSRP.getZoneNaryForNodesP...
[ "protected", "int", "getDonorId", "(", "StoreRoutingPlan", "currentSRP", ",", "StoreRoutingPlan", "finalSRP", ",", "int", "stealerZoneId", ",", "int", "stealerNodeId", ",", "int", "stealerPartitionId", ")", "{", "int", "stealerZoneNAry", "=", "finalSRP", ".", "getZo...
Decide which donor node to steal from. This is a policy implementation. I.e., in the future, additional policies could be considered. At that time, this method should be overridden in a sub-class, or a policy object ought to implement this algorithm. Current policy: 1) If possible, a stealer node that is the zone n-a...
[ "Decide", "which", "donor", "node", "to", "steal", "from", ".", "This", "is", "a", "policy", "implementation", ".", "I", ".", "e", ".", "in", "the", "future", "additional", "policies", "could", "be", "considered", ".", "At", "that", "time", "this", "meth...
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/client/rebalance/RebalanceBatchPlan.java#L351-L372
train
voldemort/voldemort
src/java/voldemort/rest/RestErrorHandler.java
RestErrorHandler.handleExceptions
protected void handleExceptions(MessageEvent messageEvent, Exception exception) { logger.error("Unknown exception. Internal Server Error.", exception); writeErrorResponse(messageEvent, HttpResponseStatus.INTERNAL_SERVER_ERROR, "Internal Server Error"...
java
protected void handleExceptions(MessageEvent messageEvent, Exception exception) { logger.error("Unknown exception. Internal Server Error.", exception); writeErrorResponse(messageEvent, HttpResponseStatus.INTERNAL_SERVER_ERROR, "Internal Server Error"...
[ "protected", "void", "handleExceptions", "(", "MessageEvent", "messageEvent", ",", "Exception", "exception", ")", "{", "logger", ".", "error", "(", "\"Unknown exception. Internal Server Error.\"", ",", "exception", ")", ";", "writeErrorResponse", "(", "messageEvent", ",...
Exceptions specific to each operation is handled in the corresponding subclass. At this point we don't know the reason behind this exception. @param exception
[ "Exceptions", "specific", "to", "each", "operation", "is", "handled", "in", "the", "corresponding", "subclass", ".", "At", "this", "point", "we", "don", "t", "know", "the", "reason", "behind", "this", "exception", "." ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/rest/RestErrorHandler.java#L25-L30
train
voldemort/voldemort
src/java/voldemort/rest/RestErrorHandler.java
RestErrorHandler.writeErrorResponse
public static void writeErrorResponse(MessageEvent messageEvent, HttpResponseStatus status, String message) { // Create the Response object HttpResponse response = new DefaultHttpResponse(HTTP_1_1, status); resp...
java
public static void writeErrorResponse(MessageEvent messageEvent, HttpResponseStatus status, String message) { // Create the Response object HttpResponse response = new DefaultHttpResponse(HTTP_1_1, status); resp...
[ "public", "static", "void", "writeErrorResponse", "(", "MessageEvent", "messageEvent", ",", "HttpResponseStatus", "status", ",", "String", "message", ")", "{", "// Create the Response object", "HttpResponse", "response", "=", "new", "DefaultHttpResponse", "(", "HTTP_1_1",...
Writes all error responses to the client. TODO REST-Server 1. collect error stats @param messageEvent - for retrieving the channel details @param status - error code @param message - error message
[ "Writes", "all", "error", "responses", "to", "the", "client", "." ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/rest/RestErrorHandler.java#L41-L54
train
voldemort/voldemort
src/java/voldemort/rest/RestPutRequestValidator.java
RestPutRequestValidator.parseAndValidateRequest
@Override public boolean parseAndValidateRequest() { boolean result = false; if(!super.parseAndValidateRequest() || !hasVectorClock(this.isVectorClockOptional) || !hasContentLength() || !hasContentType()) { result = false; } else { result = true; } ...
java
@Override public boolean parseAndValidateRequest() { boolean result = false; if(!super.parseAndValidateRequest() || !hasVectorClock(this.isVectorClockOptional) || !hasContentLength() || !hasContentType()) { result = false; } else { result = true; } ...
[ "@", "Override", "public", "boolean", "parseAndValidateRequest", "(", ")", "{", "boolean", "result", "=", "false", ";", "if", "(", "!", "super", ".", "parseAndValidateRequest", "(", ")", "||", "!", "hasVectorClock", "(", "this", ".", "isVectorClockOptional", "...
Validations specific to PUT
[ "Validations", "specific", "to", "PUT" ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/rest/RestPutRequestValidator.java#L78-L89
train
voldemort/voldemort
src/java/voldemort/rest/RestPutRequestValidator.java
RestPutRequestValidator.hasContentLength
protected boolean hasContentLength() { boolean result = false; String contentLength = this.request.getHeader(RestMessageHeaders.CONTENT_LENGTH); if(contentLength != null) { try { Long.parseLong(contentLength); result = true; } catch(NumberF...
java
protected boolean hasContentLength() { boolean result = false; String contentLength = this.request.getHeader(RestMessageHeaders.CONTENT_LENGTH); if(contentLength != null) { try { Long.parseLong(contentLength); result = true; } catch(NumberF...
[ "protected", "boolean", "hasContentLength", "(", ")", "{", "boolean", "result", "=", "false", ";", "String", "contentLength", "=", "this", ".", "request", ".", "getHeader", "(", "RestMessageHeaders", ".", "CONTENT_LENGTH", ")", ";", "if", "(", "contentLength", ...
Retrieves and validates the content length from the REST request. @return true if has content length
[ "Retrieves", "and", "validates", "the", "content", "length", "from", "the", "REST", "request", "." ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/rest/RestPutRequestValidator.java#L96-L121
train
voldemort/voldemort
src/java/voldemort/rest/RestPutRequestValidator.java
RestPutRequestValidator.hasContentType
protected boolean hasContentType() { boolean result = false; if(this.request.getHeader(RestMessageHeaders.CONTENT_TYPE) != null) { result = true; } else { logger.error("Error when validating put request. Missing Content-Type header."); RestErrorHandler.writeE...
java
protected boolean hasContentType() { boolean result = false; if(this.request.getHeader(RestMessageHeaders.CONTENT_TYPE) != null) { result = true; } else { logger.error("Error when validating put request. Missing Content-Type header."); RestErrorHandler.writeE...
[ "protected", "boolean", "hasContentType", "(", ")", "{", "boolean", "result", "=", "false", ";", "if", "(", "this", ".", "request", ".", "getHeader", "(", "RestMessageHeaders", ".", "CONTENT_TYPE", ")", "!=", "null", ")", "{", "result", "=", "true", ";", ...
Retrieves and validates the content type from the REST requests @return true if has content type.
[ "Retrieves", "and", "validates", "the", "content", "type", "from", "the", "REST", "requests" ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/rest/RestPutRequestValidator.java#L128-L140
train
voldemort/voldemort
src/java/voldemort/rest/RestPutRequestValidator.java
RestPutRequestValidator.parseValue
private void parseValue() { ChannelBuffer content = this.request.getContent(); this.parsedValue = new byte[content.capacity()]; content.readBytes(parsedValue); }
java
private void parseValue() { ChannelBuffer content = this.request.getContent(); this.parsedValue = new byte[content.capacity()]; content.readBytes(parsedValue); }
[ "private", "void", "parseValue", "(", ")", "{", "ChannelBuffer", "content", "=", "this", ".", "request", ".", "getContent", "(", ")", ";", "this", ".", "parsedValue", "=", "new", "byte", "[", "content", ".", "capacity", "(", ")", "]", ";", "content", "...
Retrieve the value from the REST request body. TODO: REST-Server value cannot be null ( null/empty string ?)
[ "Retrieve", "the", "value", "from", "the", "REST", "request", "body", "." ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/rest/RestPutRequestValidator.java#L147-L151
train
voldemort/voldemort
contrib/hadoop-store-builder/src/java/voldemort/store/readonly/swapper/HdfsFailedFetchLock.java
HdfsFailedFetchLock.handleIOException
private void handleIOException(IOException e, String action, int attempt) throws VoldemortException, InterruptedException { if ( // any of the following happens, we need to bubble up // FileSystem instance got closed, somehow e.getMessage().contains("Filesystem closed...
java
private void handleIOException(IOException e, String action, int attempt) throws VoldemortException, InterruptedException { if ( // any of the following happens, we need to bubble up // FileSystem instance got closed, somehow e.getMessage().contains("Filesystem closed...
[ "private", "void", "handleIOException", "(", "IOException", "e", ",", "String", "action", ",", "int", "attempt", ")", "throws", "VoldemortException", ",", "InterruptedException", "{", "if", "(", "// any of the following happens, we need to bubble up", "// FileSystem instanc...
This function is intended to detect the subset of IOException which are not considered recoverable, in which case we want to bubble up the exception, instead of retrying. @throws VoldemortException
[ "This", "function", "is", "intended", "to", "detect", "the", "subset", "of", "IOException", "which", "are", "not", "considered", "recoverable", "in", "which", "case", "we", "want", "to", "bubble", "up", "the", "exception", "instead", "of", "retrying", "." ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/contrib/hadoop-store-builder/src/java/voldemort/store/readonly/swapper/HdfsFailedFetchLock.java#L186-L198
train
voldemort/voldemort
src/java/voldemort/cluster/failuredetector/AbstractFailureDetector.java
AbstractFailureDetector.setAvailable
private boolean setAvailable(NodeStatus nodeStatus, boolean isAvailable) { synchronized(nodeStatus) { boolean previous = nodeStatus.isAvailable(); nodeStatus.setAvailable(isAvailable); nodeStatus.setLastChecked(getConfig().getTime().getMilliseconds()); return pr...
java
private boolean setAvailable(NodeStatus nodeStatus, boolean isAvailable) { synchronized(nodeStatus) { boolean previous = nodeStatus.isAvailable(); nodeStatus.setAvailable(isAvailable); nodeStatus.setLastChecked(getConfig().getTime().getMilliseconds()); return pr...
[ "private", "boolean", "setAvailable", "(", "NodeStatus", "nodeStatus", ",", "boolean", "isAvailable", ")", "{", "synchronized", "(", "nodeStatus", ")", "{", "boolean", "previous", "=", "nodeStatus", ".", "isAvailable", "(", ")", ";", "nodeStatus", ".", "setAvail...
We need to distinguish the case where we're newly available and the case where we're already available. So we check the node status before we update it and return it to the caller. @param isAvailable True to set to available, false to make unavailable @return Previous value of isAvailable
[ "We", "need", "to", "distinguish", "the", "case", "where", "we", "re", "newly", "available", "and", "the", "case", "where", "we", "re", "already", "available", ".", "So", "we", "check", "the", "node", "status", "before", "we", "update", "it", "and", "ret...
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/cluster/failuredetector/AbstractFailureDetector.java#L273-L282
train
voldemort/voldemort
src/java/voldemort/tools/admin/AdminParserUtils.java
AdminParserUtils.acceptsDir
public static void acceptsDir(OptionParser parser) { parser.acceptsAll(Arrays.asList(OPT_D, OPT_DIR), "directory path for input/output") .withRequiredArg() .describedAs("dir-path") .ofType(String.class); }
java
public static void acceptsDir(OptionParser parser) { parser.acceptsAll(Arrays.asList(OPT_D, OPT_DIR), "directory path for input/output") .withRequiredArg() .describedAs("dir-path") .ofType(String.class); }
[ "public", "static", "void", "acceptsDir", "(", "OptionParser", "parser", ")", "{", "parser", ".", "acceptsAll", "(", "Arrays", ".", "asList", "(", "OPT_D", ",", "OPT_DIR", ")", ",", "\"directory path for input/output\"", ")", ".", "withRequiredArg", "(", ")", ...
Adds OPT_D | OPT_DIR option to OptionParser, with one argument. @param parser OptionParser to be modified @param required Tells if this option is required or optional
[ "Adds", "OPT_D", "|", "OPT_DIR", "option", "to", "OptionParser", "with", "one", "argument", "." ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/tools/admin/AdminParserUtils.java#L148-L153
train
voldemort/voldemort
src/java/voldemort/tools/admin/AdminParserUtils.java
AdminParserUtils.acceptsFile
public static void acceptsFile(OptionParser parser) { parser.acceptsAll(Arrays.asList(OPT_F, OPT_FILE), "file path for input/output") .withRequiredArg() .describedAs("file-path") .ofType(String.class); }
java
public static void acceptsFile(OptionParser parser) { parser.acceptsAll(Arrays.asList(OPT_F, OPT_FILE), "file path for input/output") .withRequiredArg() .describedAs("file-path") .ofType(String.class); }
[ "public", "static", "void", "acceptsFile", "(", "OptionParser", "parser", ")", "{", "parser", ".", "acceptsAll", "(", "Arrays", ".", "asList", "(", "OPT_F", ",", "OPT_FILE", ")", ",", "\"file path for input/output\"", ")", ".", "withRequiredArg", "(", ")", "."...
Adds OPT_F | OPT_FILE option to OptionParser, with one argument. @param parser OptionParser to be modified @param required Tells if this option is required or optional
[ "Adds", "OPT_F", "|", "OPT_FILE", "option", "to", "OptionParser", "with", "one", "argument", "." ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/tools/admin/AdminParserUtils.java#L161-L166
train
voldemort/voldemort
src/java/voldemort/tools/admin/AdminParserUtils.java
AdminParserUtils.acceptsFormat
public static void acceptsFormat(OptionParser parser) { parser.accepts(OPT_FORMAT, "format of key or entry, could be hex, json or binary") .withRequiredArg() .describedAs("hex | json | binary") .ofType(String.class); }
java
public static void acceptsFormat(OptionParser parser) { parser.accepts(OPT_FORMAT, "format of key or entry, could be hex, json or binary") .withRequiredArg() .describedAs("hex | json | binary") .ofType(String.class); }
[ "public", "static", "void", "acceptsFormat", "(", "OptionParser", "parser", ")", "{", "parser", ".", "accepts", "(", "OPT_FORMAT", ",", "\"format of key or entry, could be hex, json or binary\"", ")", ".", "withRequiredArg", "(", ")", ".", "describedAs", "(", "\"hex |...
Adds OPT_FORMAT option to OptionParser, with one argument. @param parser OptionParser to be modified @param required Tells if this option is required or optional
[ "Adds", "OPT_FORMAT", "option", "to", "OptionParser", "with", "one", "argument", "." ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/tools/admin/AdminParserUtils.java#L174-L179
train
voldemort/voldemort
src/java/voldemort/tools/admin/AdminParserUtils.java
AdminParserUtils.acceptsNodeSingle
public static void acceptsNodeSingle(OptionParser parser) { parser.acceptsAll(Arrays.asList(OPT_N, OPT_NODE), "node id") .withRequiredArg() .describedAs("node-id") .ofType(Integer.class); }
java
public static void acceptsNodeSingle(OptionParser parser) { parser.acceptsAll(Arrays.asList(OPT_N, OPT_NODE), "node id") .withRequiredArg() .describedAs("node-id") .ofType(Integer.class); }
[ "public", "static", "void", "acceptsNodeSingle", "(", "OptionParser", "parser", ")", "{", "parser", ".", "acceptsAll", "(", "Arrays", ".", "asList", "(", "OPT_N", ",", "OPT_NODE", ")", ",", "\"node id\"", ")", ".", "withRequiredArg", "(", ")", ".", "describe...
Adds OPT_N | OPT_NODE option to OptionParser, with one argument. @param parser OptionParser to be modified @param required Tells if this option is required or optional
[ "Adds", "OPT_N", "|", "OPT_NODE", "option", "to", "OptionParser", "with", "one", "argument", "." ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/tools/admin/AdminParserUtils.java#L187-L192
train
voldemort/voldemort
src/java/voldemort/tools/admin/AdminParserUtils.java
AdminParserUtils.acceptsUrl
public static void acceptsUrl(OptionParser parser) { parser.acceptsAll(Arrays.asList(OPT_U, OPT_URL), "bootstrap url") .withRequiredArg() .describedAs("url") .ofType(String.class); }
java
public static void acceptsUrl(OptionParser parser) { parser.acceptsAll(Arrays.asList(OPT_U, OPT_URL), "bootstrap url") .withRequiredArg() .describedAs("url") .ofType(String.class); }
[ "public", "static", "void", "acceptsUrl", "(", "OptionParser", "parser", ")", "{", "parser", ".", "acceptsAll", "(", "Arrays", ".", "asList", "(", "OPT_U", ",", "OPT_URL", ")", ",", "\"bootstrap url\"", ")", ".", "withRequiredArg", "(", ")", ".", "describedA...
Adds OPT_U | OPT_URL option to OptionParser, with one argument. @param parser OptionParser to be modified @param required Tells if this option is required or optional
[ "Adds", "OPT_U", "|", "OPT_URL", "option", "to", "OptionParser", "with", "one", "argument", "." ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/tools/admin/AdminParserUtils.java#L213-L218
train
voldemort/voldemort
src/java/voldemort/tools/admin/AdminParserUtils.java
AdminParserUtils.acceptsZone
public static void acceptsZone(OptionParser parser) { parser.acceptsAll(Arrays.asList(OPT_Z, OPT_ZONE), "zone id") .withRequiredArg() .describedAs("zone-id") .ofType(Integer.class); }
java
public static void acceptsZone(OptionParser parser) { parser.acceptsAll(Arrays.asList(OPT_Z, OPT_ZONE), "zone id") .withRequiredArg() .describedAs("zone-id") .ofType(Integer.class); }
[ "public", "static", "void", "acceptsZone", "(", "OptionParser", "parser", ")", "{", "parser", ".", "acceptsAll", "(", "Arrays", ".", "asList", "(", "OPT_Z", ",", "OPT_ZONE", ")", ",", "\"zone id\"", ")", ".", "withRequiredArg", "(", ")", ".", "describedAs", ...
Adds OPT_Z | OPT_ZONE option to OptionParser, with one argument. @param parser OptionParser to be modified @param required Tells if this option is required or optional
[ "Adds", "OPT_Z", "|", "OPT_ZONE", "option", "to", "OptionParser", "with", "one", "argument", "." ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/tools/admin/AdminParserUtils.java#L226-L231
train
voldemort/voldemort
src/java/voldemort/tools/admin/AdminParserUtils.java
AdminParserUtils.acceptsHex
public static void acceptsHex(OptionParser parser) { parser.acceptsAll(Arrays.asList(OPT_X, OPT_HEX), "fetch key/entry by key value of hex type") .withRequiredArg() .describedAs("key-list") .withValuesSeparatedBy(',') .ofType(String.class); }
java
public static void acceptsHex(OptionParser parser) { parser.acceptsAll(Arrays.asList(OPT_X, OPT_HEX), "fetch key/entry by key value of hex type") .withRequiredArg() .describedAs("key-list") .withValuesSeparatedBy(',') .ofType(String.class); }
[ "public", "static", "void", "acceptsHex", "(", "OptionParser", "parser", ")", "{", "parser", ".", "acceptsAll", "(", "Arrays", ".", "asList", "(", "OPT_X", ",", "OPT_HEX", ")", ",", "\"fetch key/entry by key value of hex type\"", ")", ".", "withRequiredArg", "(", ...
Adds OPT_X | OPT_HEX option to OptionParser, with multiple arguments. @param parser OptionParser to be modified @param required Tells if this option is required or optional
[ "Adds", "OPT_X", "|", "OPT_HEX", "option", "to", "OptionParser", "with", "multiple", "arguments", "." ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/tools/admin/AdminParserUtils.java#L239-L245
train
voldemort/voldemort
src/java/voldemort/tools/admin/AdminParserUtils.java
AdminParserUtils.acceptsJson
public static void acceptsJson(OptionParser parser) { parser.acceptsAll(Arrays.asList(OPT_J, OPT_JSON), "fetch key/entry by key value of json type") .withRequiredArg() .describedAs("key-list") .withValuesSeparatedBy(',') .ofType(S...
java
public static void acceptsJson(OptionParser parser) { parser.acceptsAll(Arrays.asList(OPT_J, OPT_JSON), "fetch key/entry by key value of json type") .withRequiredArg() .describedAs("key-list") .withValuesSeparatedBy(',') .ofType(S...
[ "public", "static", "void", "acceptsJson", "(", "OptionParser", "parser", ")", "{", "parser", ".", "acceptsAll", "(", "Arrays", ".", "asList", "(", "OPT_J", ",", "OPT_JSON", ")", ",", "\"fetch key/entry by key value of json type\"", ")", ".", "withRequiredArg", "(...
Adds OPT_J | OPT_JSON option to OptionParser, with multiple arguments. @param parser OptionParser to be modified @param required Tells if this option is required or optional
[ "Adds", "OPT_J", "|", "OPT_JSON", "option", "to", "OptionParser", "with", "multiple", "arguments", "." ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/tools/admin/AdminParserUtils.java#L253-L260
train
voldemort/voldemort
src/java/voldemort/tools/admin/AdminParserUtils.java
AdminParserUtils.acceptsNodeMultiple
public static void acceptsNodeMultiple(OptionParser parser) { parser.acceptsAll(Arrays.asList(OPT_N, OPT_NODE), "node id list") .withRequiredArg() .describedAs("node-id-list") .withValuesSeparatedBy(',') .ofType(Integer.class); }
java
public static void acceptsNodeMultiple(OptionParser parser) { parser.acceptsAll(Arrays.asList(OPT_N, OPT_NODE), "node id list") .withRequiredArg() .describedAs("node-id-list") .withValuesSeparatedBy(',') .ofType(Integer.class); }
[ "public", "static", "void", "acceptsNodeMultiple", "(", "OptionParser", "parser", ")", "{", "parser", ".", "acceptsAll", "(", "Arrays", ".", "asList", "(", "OPT_N", ",", "OPT_NODE", ")", ",", "\"node id list\"", ")", ".", "withRequiredArg", "(", ")", ".", "d...
Adds OPT_N | OPT_NODE option to OptionParser, with multiple arguments. @param parser OptionParser to be modified @param required Tells if this option is required or optional
[ "Adds", "OPT_N", "|", "OPT_NODE", "option", "to", "OptionParser", "with", "multiple", "arguments", "." ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/tools/admin/AdminParserUtils.java#L268-L274
train
voldemort/voldemort
src/java/voldemort/tools/admin/AdminParserUtils.java
AdminParserUtils.acceptsPartition
public static void acceptsPartition(OptionParser parser) { parser.acceptsAll(Arrays.asList(OPT_P, OPT_PARTITION), "partition id list") .withRequiredArg() .describedAs("partition-id-list") .withValuesSeparatedBy(',') .ofType(Integer.class); }
java
public static void acceptsPartition(OptionParser parser) { parser.acceptsAll(Arrays.asList(OPT_P, OPT_PARTITION), "partition id list") .withRequiredArg() .describedAs("partition-id-list") .withValuesSeparatedBy(',') .ofType(Integer.class); }
[ "public", "static", "void", "acceptsPartition", "(", "OptionParser", "parser", ")", "{", "parser", ".", "acceptsAll", "(", "Arrays", ".", "asList", "(", "OPT_P", ",", "OPT_PARTITION", ")", ",", "\"partition id list\"", ")", ".", "withRequiredArg", "(", ")", "....
Adds OPT_P | OPT_PARTITION option to OptionParser, with multiple arguments. @param parser OptionParser to be modified @param required Tells if this option is required or optional
[ "Adds", "OPT_P", "|", "OPT_PARTITION", "option", "to", "OptionParser", "with", "multiple", "arguments", "." ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/tools/admin/AdminParserUtils.java#L283-L289
train
voldemort/voldemort
src/java/voldemort/tools/admin/AdminParserUtils.java
AdminParserUtils.checkRequired
public static void checkRequired(OptionSet options, String opt) throws VoldemortException { List<String> opts = Lists.newArrayList(); opts.add(opt); checkRequired(options, opts); }
java
public static void checkRequired(OptionSet options, String opt) throws VoldemortException { List<String> opts = Lists.newArrayList(); opts.add(opt); checkRequired(options, opts); }
[ "public", "static", "void", "checkRequired", "(", "OptionSet", "options", ",", "String", "opt", ")", "throws", "VoldemortException", "{", "List", "<", "String", ">", "opts", "=", "Lists", ".", "newArrayList", "(", ")", ";", "opts", ".", "add", "(", "opt", ...
Checks if the required option exists. @param options OptionSet to checked @param opt Required option to check @throws VoldemortException
[ "Checks", "if", "the", "required", "option", "exists", "." ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/tools/admin/AdminParserUtils.java#L312-L316
train
voldemort/voldemort
src/java/voldemort/tools/admin/AdminParserUtils.java
AdminParserUtils.checkRequired
public static void checkRequired(OptionSet options, String opt1, String opt2) throws VoldemortException { List<String> opts = Lists.newArrayList(); opts.add(opt1); opts.add(opt2); checkRequired(options, opts); }
java
public static void checkRequired(OptionSet options, String opt1, String opt2) throws VoldemortException { List<String> opts = Lists.newArrayList(); opts.add(opt1); opts.add(opt2); checkRequired(options, opts); }
[ "public", "static", "void", "checkRequired", "(", "OptionSet", "options", ",", "String", "opt1", ",", "String", "opt2", ")", "throws", "VoldemortException", "{", "List", "<", "String", ">", "opts", "=", "Lists", ".", "newArrayList", "(", ")", ";", "opts", ...
Checks if there's exactly one option that exists among all possible opts. @param options OptionSet to checked @param opt1 Possible required option to check @param opt2 Possible required option to check @throws VoldemortException
[ "Checks", "if", "there", "s", "exactly", "one", "option", "that", "exists", "among", "all", "possible", "opts", "." ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/tools/admin/AdminParserUtils.java#L326-L332
train
voldemort/voldemort
src/java/voldemort/tools/admin/AdminParserUtils.java
AdminParserUtils.checkRequired
public static void checkRequired(OptionSet options, List<String> opts) throws VoldemortException { List<String> optCopy = Lists.newArrayList(); for(String opt: opts) { if(options.has(opt)) { optCopy.add(opt); } } if(optCopy.size() < 1) ...
java
public static void checkRequired(OptionSet options, List<String> opts) throws VoldemortException { List<String> optCopy = Lists.newArrayList(); for(String opt: opts) { if(options.has(opt)) { optCopy.add(opt); } } if(optCopy.size() < 1) ...
[ "public", "static", "void", "checkRequired", "(", "OptionSet", "options", ",", "List", "<", "String", ">", "opts", ")", "throws", "VoldemortException", "{", "List", "<", "String", ">", "optCopy", "=", "Lists", ".", "newArrayList", "(", ")", ";", "for", "("...
Checks if there's exactly one option that exists among all opts. @param options OptionSet to checked @param opts List of options to be checked @throws VoldemortException
[ "Checks", "if", "there", "s", "exactly", "one", "option", "that", "exists", "among", "all", "opts", "." ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/tools/admin/AdminParserUtils.java#L359-L381
train
voldemort/voldemort
src/java/voldemort/rest/coordinator/RestCoordinatorRequestHandler.java
RestCoordinatorRequestHandler.registerRequest
@Override protected void registerRequest(RestRequestValidator requestValidator, ChannelHandlerContext ctx, MessageEvent messageEvent) { // At this point we know the request is valid and we have a // error handler. So we construct...
java
@Override protected void registerRequest(RestRequestValidator requestValidator, ChannelHandlerContext ctx, MessageEvent messageEvent) { // At this point we know the request is valid and we have a // error handler. So we construct...
[ "@", "Override", "protected", "void", "registerRequest", "(", "RestRequestValidator", "requestValidator", ",", "ChannelHandlerContext", "ctx", ",", "MessageEvent", "messageEvent", ")", "{", "// At this point we know the request is valid and we have a", "// error handler. So we cons...
Constructs a valid request and passes it on to the next handler. It also creates the 'StoreClient' object corresponding to the store name specified in the REST request. @param requestValidator The Validator object used to construct the request object @param ctx Context of the Netty channel @param messageEvent Message ...
[ "Constructs", "a", "valid", "request", "and", "passes", "it", "on", "to", "the", "next", "handler", ".", "It", "also", "creates", "the", "StoreClient", "object", "corresponding", "to", "the", "store", "name", "specified", "in", "the", "REST", "request", "." ...
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/rest/coordinator/RestCoordinatorRequestHandler.java#L39-L72
train
voldemort/voldemort
src/java/voldemort/rest/RestDeleteErrorHandler.java
RestDeleteErrorHandler.handleExceptions
@Override public void handleExceptions(MessageEvent messageEvent, Exception exception) { if(exception instanceof InvalidMetadataException) { logger.error("Exception when deleting. The requested key does not exist in this partition", exception); writeErrorRes...
java
@Override public void handleExceptions(MessageEvent messageEvent, Exception exception) { if(exception instanceof InvalidMetadataException) { logger.error("Exception when deleting. The requested key does not exist in this partition", exception); writeErrorRes...
[ "@", "Override", "public", "void", "handleExceptions", "(", "MessageEvent", "messageEvent", ",", "Exception", "exception", ")", "{", "if", "(", "exception", "instanceof", "InvalidMetadataException", ")", "{", "logger", ".", "error", "(", "\"Exception when deleting. Th...
Handle exceptions thrown by the storage. Exceptions specific to DELETE go here. Pass other exceptions to the parent class. TODO REST-Server Add a new exception for this condition - server busy with pending requests. queue is full
[ "Handle", "exceptions", "thrown", "by", "the", "storage", ".", "Exceptions", "specific", "to", "DELETE", "go", "here", ".", "Pass", "other", "exceptions", "to", "the", "parent", "class", "." ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/rest/RestDeleteErrorHandler.java#L22-L55
train
voldemort/voldemort
src/java/voldemort/store/stats/StoreStats.java
StoreStats.recordPutTimeAndSize
public void recordPutTimeAndSize(long timeNS, long valueSize, long keySize) { recordTime(Tracked.PUT, timeNS, 0, valueSize, keySize, 0); }
java
public void recordPutTimeAndSize(long timeNS, long valueSize, long keySize) { recordTime(Tracked.PUT, timeNS, 0, valueSize, keySize, 0); }
[ "public", "void", "recordPutTimeAndSize", "(", "long", "timeNS", ",", "long", "valueSize", ",", "long", "keySize", ")", "{", "recordTime", "(", "Tracked", ".", "PUT", ",", "timeNS", ",", "0", ",", "valueSize", ",", "keySize", ",", "0", ")", ";", "}" ]
Record the duration of a put operation, along with the size of the values returned.
[ "Record", "the", "duration", "of", "a", "put", "operation", "along", "with", "the", "size", "of", "the", "values", "returned", "." ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/store/stats/StoreStats.java#L104-L106
train
voldemort/voldemort
src/java/voldemort/store/stats/StoreStats.java
StoreStats.recordGetAllTime
public void recordGetAllTime(long timeNS, int requested, int returned, long totalValueBytes, long totalKeyBytes) { recordTime(Tracked.GET_ALL, timeNS, ...
java
public void recordGetAllTime(long timeNS, int requested, int returned, long totalValueBytes, long totalKeyBytes) { recordTime(Tracked.GET_ALL, timeNS, ...
[ "public", "void", "recordGetAllTime", "(", "long", "timeNS", ",", "int", "requested", ",", "int", "returned", ",", "long", "totalValueBytes", ",", "long", "totalKeyBytes", ")", "{", "recordTime", "(", "Tracked", ".", "GET_ALL", ",", "timeNS", ",", "requested",...
Record the duration of a get_all operation, along with how many values were requested, how may were actually returned and the size of the values returned.
[ "Record", "the", "duration", "of", "a", "get_all", "operation", "along", "with", "how", "many", "values", "were", "requested", "how", "may", "were", "actually", "returned", "and", "the", "size", "of", "the", "values", "returned", "." ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/store/stats/StoreStats.java#L130-L141
train
voldemort/voldemort
src/java/voldemort/store/stats/StoreStats.java
StoreStats.recordTime
private void recordTime(Tracked op, long timeNS, long numEmptyResponses, long valueSize, long keySize, long getAllAggregateRequests) { counters.get(op).addRequest(timeNS, ...
java
private void recordTime(Tracked op, long timeNS, long numEmptyResponses, long valueSize, long keySize, long getAllAggregateRequests) { counters.get(op).addRequest(timeNS, ...
[ "private", "void", "recordTime", "(", "Tracked", "op", ",", "long", "timeNS", ",", "long", "numEmptyResponses", ",", "long", "valueSize", ",", "long", "keySize", ",", "long", "getAllAggregateRequests", ")", "{", "counters", ".", "get", "(", "op", ")", ".", ...
Method to service public recording APIs @param op Operation being tracked @param timeNS Duration of operation @param numEmptyResponses Number of empty responses being sent back, i.e.: requested keys for which there were no values (GET and GET_ALL only) @param valueSize Size in bytes of the value @param keySize Size in...
[ "Method", "to", "service", "public", "recording", "APIs" ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/store/stats/StoreStats.java#L154-L169
train
voldemort/voldemort
contrib/hadoop-store-builder/src/java/voldemort/store/readonly/mr/utils/VoldemortUtils.java
VoldemortUtils.getCommaSeparatedStringValues
public static List<String> getCommaSeparatedStringValues(String paramValue, String type) { List<String> commaSeparatedProps = Lists.newArrayList(); for(String url: Utils.COMMA_SEP.split(paramValue.trim())) if(url.trim().length() > 0) commaSeparatedProps.add(url); if(...
java
public static List<String> getCommaSeparatedStringValues(String paramValue, String type) { List<String> commaSeparatedProps = Lists.newArrayList(); for(String url: Utils.COMMA_SEP.split(paramValue.trim())) if(url.trim().length() > 0) commaSeparatedProps.add(url); if(...
[ "public", "static", "List", "<", "String", ">", "getCommaSeparatedStringValues", "(", "String", "paramValue", ",", "String", "type", ")", "{", "List", "<", "String", ">", "commaSeparatedProps", "=", "Lists", ".", "newArrayList", "(", ")", ";", "for", "(", "S...
Given the comma separated list of properties as a string, splits it multiple strings @param paramValue Concatenated string @param type Type of parameter ( to throw exception ) @return List of string properties
[ "Given", "the", "comma", "separated", "list", "of", "properties", "as", "a", "string", "splits", "it", "multiple", "strings" ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/contrib/hadoop-store-builder/src/java/voldemort/store/readonly/mr/utils/VoldemortUtils.java#L47-L57
train
voldemort/voldemort
src/java/voldemort/rest/coordinator/CoordinatorProxyService.java
CoordinatorProxyService.initializeFatClient
private synchronized void initializeFatClient(String storeName, Properties storeClientProps) { // updates the coordinator metadata with recent stores and cluster xml updateCoordinatorMetadataWithLatestState(); logger.info("Creating a Fat client for store: " + storeName); SocketStoreClie...
java
private synchronized void initializeFatClient(String storeName, Properties storeClientProps) { // updates the coordinator metadata with recent stores and cluster xml updateCoordinatorMetadataWithLatestState(); logger.info("Creating a Fat client for store: " + storeName); SocketStoreClie...
[ "private", "synchronized", "void", "initializeFatClient", "(", "String", "storeName", ",", "Properties", "storeClientProps", ")", "{", "// updates the coordinator metadata with recent stores and cluster xml", "updateCoordinatorMetadataWithLatestState", "(", ")", ";", "logger", "....
Initialize the fat client for the given store. 1. Updates the coordinatorMetadata 2.Gets the new store configs from the config file 3.Creates a new @SocketStoreClientFactory 4. Subsequently caches the @StoreClient obtained from the factory. This is synchronized because if Coordinator Admin is already doing some chan...
[ "Initialize", "the", "fat", "client", "for", "the", "given", "store", "." ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/rest/coordinator/CoordinatorProxyService.java#L104-L122
train
voldemort/voldemort
src/java/voldemort/client/rebalance/RebalanceBatchPlanProgressBar.java
RebalanceBatchPlanProgressBar.completeTask
synchronized public void completeTask(int taskId, int partitionStoresMigrated) { tasksInFlight.remove(taskId); numTasksCompleted++; numPartitionStoresMigrated += partitionStoresMigrated; updateProgressBar(); }
java
synchronized public void completeTask(int taskId, int partitionStoresMigrated) { tasksInFlight.remove(taskId); numTasksCompleted++; numPartitionStoresMigrated += partitionStoresMigrated; updateProgressBar(); }
[ "synchronized", "public", "void", "completeTask", "(", "int", "taskId", ",", "int", "partitionStoresMigrated", ")", "{", "tasksInFlight", ".", "remove", "(", "taskId", ")", ";", "numTasksCompleted", "++", ";", "numPartitionStoresMigrated", "+=", "partitionStoresMigrat...
Called whenever a rebalance task completes. This means one task is done and some number of partition stores have been migrated. @param taskId @param partitionStoresMigrated Number of partition stores moved by this completed task.
[ "Called", "whenever", "a", "rebalance", "task", "completes", ".", "This", "means", "one", "task", "is", "done", "and", "some", "number", "of", "partition", "stores", "have", "been", "migrated", "." ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/client/rebalance/RebalanceBatchPlanProgressBar.java#L82-L89
train
voldemort/voldemort
src/java/voldemort/client/rebalance/RebalanceBatchPlanProgressBar.java
RebalanceBatchPlanProgressBar.getPrettyProgressBar
synchronized public String getPrettyProgressBar() { StringBuilder sb = new StringBuilder(); double taskRate = numTasksCompleted / (double) totalTaskCount; double partitionStoreRate = numPartitionStoresMigrated / (double) totalPartitionStoreCount; long deltaTimeMs = System.currentTimeMi...
java
synchronized public String getPrettyProgressBar() { StringBuilder sb = new StringBuilder(); double taskRate = numTasksCompleted / (double) totalTaskCount; double partitionStoreRate = numPartitionStoresMigrated / (double) totalPartitionStoreCount; long deltaTimeMs = System.currentTimeMi...
[ "synchronized", "public", "String", "getPrettyProgressBar", "(", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "double", "taskRate", "=", "numTasksCompleted", "/", "(", "double", ")", "totalTaskCount", ";", "double", "partitionStoreR...
Construct a pretty string documenting progress for this batch plan thus far. @return pretty string documenting progress
[ "Construct", "a", "pretty", "string", "documenting", "progress", "for", "this", "batch", "plan", "thus", "far", "." ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/client/rebalance/RebalanceBatchPlanProgressBar.java#L97-L145
train
voldemort/voldemort
src/java/voldemort/server/protocol/admin/FetchStreamRequestHandler.java
FetchStreamRequestHandler.progressInfoMessage
protected void progressInfoMessage(final String tag) { if(logger.isInfoEnabled()) { long totalTimeS = (System.currentTimeMillis() - startTimeMs) / Time.MS_PER_SECOND; logger.info(tag + " : scanned " + scanned + " and fetched " + fetched + " for store '" + storage...
java
protected void progressInfoMessage(final String tag) { if(logger.isInfoEnabled()) { long totalTimeS = (System.currentTimeMillis() - startTimeMs) / Time.MS_PER_SECOND; logger.info(tag + " : scanned " + scanned + " and fetched " + fetched + " for store '" + storage...
[ "protected", "void", "progressInfoMessage", "(", "final", "String", "tag", ")", "{", "if", "(", "logger", ".", "isInfoEnabled", "(", ")", ")", "{", "long", "totalTimeS", "=", "(", "System", ".", "currentTimeMillis", "(", ")", "-", "startTimeMs", ")", "/", ...
Progress info message @param tag Message that precedes progress info. Indicate 'keys' or 'entries'.
[ "Progress", "info", "message" ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/server/protocol/admin/FetchStreamRequestHandler.java#L175-L183
train
voldemort/voldemort
src/java/voldemort/server/protocol/admin/FetchStreamRequestHandler.java
FetchStreamRequestHandler.sendMessage
protected void sendMessage(DataOutputStream outputStream, Message message) throws IOException { long startNs = System.nanoTime(); ProtoUtils.writeMessage(outputStream, message); if(streamStats != null) { streamStats.reportNetworkTime(operation, ...
java
protected void sendMessage(DataOutputStream outputStream, Message message) throws IOException { long startNs = System.nanoTime(); ProtoUtils.writeMessage(outputStream, message); if(streamStats != null) { streamStats.reportNetworkTime(operation, ...
[ "protected", "void", "sendMessage", "(", "DataOutputStream", "outputStream", ",", "Message", "message", ")", "throws", "IOException", "{", "long", "startNs", "=", "System", ".", "nanoTime", "(", ")", ";", "ProtoUtils", ".", "writeMessage", "(", "outputStream", "...
Helper method to send message on outputStream and account for network time stats. @param outputStream @param message @throws IOException
[ "Helper", "method", "to", "send", "message", "on", "outputStream", "and", "account", "for", "network", "time", "stats", "." ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/server/protocol/admin/FetchStreamRequestHandler.java#L206-L213
train
voldemort/voldemort
src/java/voldemort/server/protocol/admin/FetchStreamRequestHandler.java
FetchStreamRequestHandler.reportStorageOpTime
protected void reportStorageOpTime(long startNs) { if(streamStats != null) { streamStats.reportStreamingScan(operation); streamStats.reportStorageTime(operation, Utils.elapsedTimeNs(startNs, System.nanoTime())); } }
java
protected void reportStorageOpTime(long startNs) { if(streamStats != null) { streamStats.reportStreamingScan(operation); streamStats.reportStorageTime(operation, Utils.elapsedTimeNs(startNs, System.nanoTime())); } }
[ "protected", "void", "reportStorageOpTime", "(", "long", "startNs", ")", "{", "if", "(", "streamStats", "!=", "null", ")", "{", "streamStats", ".", "reportStreamingScan", "(", "operation", ")", ";", "streamStats", ".", "reportStorageTime", "(", "operation", ",",...
Helper method to track storage operations & time via StreamingStats. @param startNs
[ "Helper", "method", "to", "track", "storage", "operations", "&", "time", "via", "StreamingStats", "." ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/server/protocol/admin/FetchStreamRequestHandler.java#L220-L226
train
voldemort/voldemort
src/java/voldemort/server/socket/SocketServer.java
SocketServer.awaitStartupCompletion
public void awaitStartupCompletion() { try { Object obj = startedStatusQueue.take(); if(obj instanceof Throwable) throw new VoldemortException((Throwable) obj); } catch(InterruptedException e) { // this is okay, if we are interrupted we can stop waitin...
java
public void awaitStartupCompletion() { try { Object obj = startedStatusQueue.take(); if(obj instanceof Throwable) throw new VoldemortException((Throwable) obj); } catch(InterruptedException e) { // this is okay, if we are interrupted we can stop waitin...
[ "public", "void", "awaitStartupCompletion", "(", ")", "{", "try", "{", "Object", "obj", "=", "startedStatusQueue", ".", "take", "(", ")", ";", "if", "(", "obj", "instanceof", "Throwable", ")", "throw", "new", "VoldemortException", "(", "(", "Throwable", ")",...
Blocks until the server has started successfully or an exception is thrown. @throws VoldemortException if a problem occurs during start-up wrapping the original exception.
[ "Blocks", "until", "the", "server", "has", "started", "successfully", "or", "an", "exception", "is", "thrown", "." ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/server/socket/SocketServer.java#L258-L266
train
voldemort/voldemort
src/java/voldemort/client/protocol/admin/StreamingClient.java
StreamingClient.streamingSlopPut
protected synchronized void streamingSlopPut(ByteArray key, Versioned<byte[]> value, String storeName, int failedNodeId) throws IOException { Slop slop = new Slop(s...
java
protected synchronized void streamingSlopPut(ByteArray key, Versioned<byte[]> value, String storeName, int failedNodeId) throws IOException { Slop slop = new Slop(s...
[ "protected", "synchronized", "void", "streamingSlopPut", "(", "ByteArray", "key", ",", "Versioned", "<", "byte", "[", "]", ">", "value", ",", "String", "storeName", ",", "int", "failedNodeId", ")", "throws", "IOException", "{", "Slop", "slop", "=", "new", "S...
This is a method to stream slops to "slop" store when a node is detected faulty in a streaming session @param key -- original key @param value -- original value @param storeName -- the store for which we are registering the slop @param failedNodeId -- the faulty node ID for which we register a slop @throws IOException
[ "This", "is", "a", "method", "to", "stream", "slops", "to", "slop", "store", "when", "a", "node", "is", "detected", "faulty", "in", "a", "streaming", "session" ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/client/protocol/admin/StreamingClient.java#L141-L192
train
voldemort/voldemort
src/java/voldemort/client/protocol/admin/StreamingClient.java
StreamingClient.synchronousInvokeCallback
@SuppressWarnings("rawtypes") private void synchronousInvokeCallback(Callable call) { Future future = streamingSlopResults.submit(call); try { future.get(); } catch(InterruptedException e1) { logger.error("Callback failed", e1); throw new VoldemortExce...
java
@SuppressWarnings("rawtypes") private void synchronousInvokeCallback(Callable call) { Future future = streamingSlopResults.submit(call); try { future.get(); } catch(InterruptedException e1) { logger.error("Callback failed", e1); throw new VoldemortExce...
[ "@", "SuppressWarnings", "(", "\"rawtypes\"", ")", "private", "void", "synchronousInvokeCallback", "(", "Callable", "call", ")", "{", "Future", "future", "=", "streamingSlopResults", ".", "submit", "(", "call", ")", ";", "try", "{", "future", ".", "get", "(", ...
Helper method to synchronously invoke a callback @param call
[ "Helper", "method", "to", "synchronously", "invoke", "a", "callback" ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/client/protocol/admin/StreamingClient.java#L224-L243
train
voldemort/voldemort
contrib/hadoop-store-builder/src/java/voldemort/store/readonly/hooks/http/HttpHookRunnable.java
HttpHookRunnable.handleResponse
protected void handleResponse(int responseCode, InputStream inputStream) { BufferedReader rd = null; try { // Buffer the result into a string rd = new BufferedReader(new InputStreamReader(inputStream)); StringBuilder sb = new StringBuilder(); String line; ...
java
protected void handleResponse(int responseCode, InputStream inputStream) { BufferedReader rd = null; try { // Buffer the result into a string rd = new BufferedReader(new InputStreamReader(inputStream)); StringBuilder sb = new StringBuilder(); String line; ...
[ "protected", "void", "handleResponse", "(", "int", "responseCode", ",", "InputStream", "inputStream", ")", "{", "BufferedReader", "rd", "=", "null", ";", "try", "{", "// Buffer the result into a string", "rd", "=", "new", "BufferedReader", "(", "new", "InputStreamRe...
Can be overridden if you want to replace or supplement the debug handling for responses. @param responseCode @param inputStream
[ "Can", "be", "overridden", "if", "you", "want", "to", "replace", "or", "supplement", "the", "debug", "handling", "for", "responses", "." ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/contrib/hadoop-store-builder/src/java/voldemort/store/readonly/hooks/http/HttpHookRunnable.java#L92-L114
train
voldemort/voldemort
src/java/voldemort/client/protocol/admin/BaseStreamingClient.java
BaseStreamingClient.addStoreToSession
@SuppressWarnings({ "unchecked", "rawtypes" }) protected void addStoreToSession(String store) { Exception initializationException = null; storeNames.add(store); for(Node node: nodesToStream) { SocketDestination destination = null; SocketAndStreams sands = null; ...
java
@SuppressWarnings({ "unchecked", "rawtypes" }) protected void addStoreToSession(String store) { Exception initializationException = null; storeNames.add(store); for(Node node: nodesToStream) { SocketDestination destination = null; SocketAndStreams sands = null; ...
[ "@", "SuppressWarnings", "(", "{", "\"unchecked\"", ",", "\"rawtypes\"", "}", ")", "protected", "void", "addStoreToSession", "(", "String", "store", ")", "{", "Exception", "initializationException", "=", "null", ";", "storeNames", ".", "add", "(", "store", ")", ...
Add another store destination to an existing streaming session @param store the name of the store to stream to
[ "Add", "another", "store", "destination", "to", "an", "existing", "streaming", "session" ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/client/protocol/admin/BaseStreamingClient.java#L366-L437
train
voldemort/voldemort
src/java/voldemort/client/protocol/admin/BaseStreamingClient.java
BaseStreamingClient.removeStoreFromSession
@SuppressWarnings({}) public synchronized void removeStoreFromSession(List<String> storeNameToRemove) { logger.info("closing the Streaming session for a few stores"); commitToVoldemort(storeNameToRemove); cleanupSessions(storeNameToRemove); }
java
@SuppressWarnings({}) public synchronized void removeStoreFromSession(List<String> storeNameToRemove) { logger.info("closing the Streaming session for a few stores"); commitToVoldemort(storeNameToRemove); cleanupSessions(storeNameToRemove); }
[ "@", "SuppressWarnings", "(", "{", "}", ")", "public", "synchronized", "void", "removeStoreFromSession", "(", "List", "<", "String", ">", "storeNameToRemove", ")", "{", "logger", ".", "info", "(", "\"closing the Streaming session for a few stores\"", ")", ";", "comm...
Remove a list of stores from the session First commit all entries for these stores and then cleanup resources @param storeNameToRemove List of stores to be removed from the current streaming session
[ "Remove", "a", "list", "of", "stores", "from", "the", "session" ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/client/protocol/admin/BaseStreamingClient.java#L464-L472
train
voldemort/voldemort
src/java/voldemort/client/protocol/admin/BaseStreamingClient.java
BaseStreamingClient.blacklistNode
@SuppressWarnings({ "rawtypes", "unchecked" }) public void blacklistNode(int nodeId) { Collection<Node> nodesInCluster = adminClient.getAdminClientCluster().getNodes(); if(blackListedNodes == null) { blackListedNodes = new ArrayList(); } blackListedNodes.add(nodeId); ...
java
@SuppressWarnings({ "rawtypes", "unchecked" }) public void blacklistNode(int nodeId) { Collection<Node> nodesInCluster = adminClient.getAdminClientCluster().getNodes(); if(blackListedNodes == null) { blackListedNodes = new ArrayList(); } blackListedNodes.add(nodeId); ...
[ "@", "SuppressWarnings", "(", "{", "\"rawtypes\"", ",", "\"unchecked\"", "}", ")", "public", "void", "blacklistNode", "(", "int", "nodeId", ")", "{", "Collection", "<", "Node", ">", "nodesInCluster", "=", "adminClient", ".", "getAdminClientCluster", "(", ")", ...
mark a node as blacklisted @param nodeId Integer node id of the node to be blacklisted
[ "mark", "a", "node", "as", "blacklisted" ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/client/protocol/admin/BaseStreamingClient.java#L608-L637
train
voldemort/voldemort
src/java/voldemort/client/protocol/admin/BaseStreamingClient.java
BaseStreamingClient.commitToVoldemort
@SuppressWarnings({ "unchecked", "rawtypes", "unused" }) private void commitToVoldemort(List<String> storeNamesToCommit) { if(logger.isDebugEnabled()) { logger.debug("Trying to commit to Voldemort"); } boolean hasError = false; if(nodesToStream == null || nodesToStream....
java
@SuppressWarnings({ "unchecked", "rawtypes", "unused" }) private void commitToVoldemort(List<String> storeNamesToCommit) { if(logger.isDebugEnabled()) { logger.debug("Trying to commit to Voldemort"); } boolean hasError = false; if(nodesToStream == null || nodesToStream....
[ "@", "SuppressWarnings", "(", "{", "\"unchecked\"", ",", "\"rawtypes\"", ",", "\"unused\"", "}", ")", "private", "void", "commitToVoldemort", "(", "List", "<", "String", ">", "storeNamesToCommit", ")", "{", "if", "(", "logger", ".", "isDebugEnabled", "(", ")",...
Flush the network buffer and write all entries to the serve. then wait for an ack from the server. This is a blocking call. It is invoked on every Commit batch size of entries, It is also called on the close session call @param storeNamesToCommit List of stores to be flushed and committed
[ "Flush", "the", "network", "buffer", "and", "write", "all", "entries", "to", "the", "serve", ".", "then", "wait", "for", "an", "ack", "from", "the", "server", ".", "This", "is", "a", "blocking", "call", ".", "It", "is", "invoked", "on", "every", "Commi...
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/client/protocol/admin/BaseStreamingClient.java#L648-L733
train
voldemort/voldemort
src/java/voldemort/client/protocol/admin/BaseStreamingClient.java
BaseStreamingClient.cleanupSessions
@SuppressWarnings({ "rawtypes", "unchecked" }) private void cleanupSessions(List<String> storeNamesToCleanUp) { logger.info("Performing cleanup"); for(String store: storeNamesToCleanUp) { for(Node node: nodesToStream) { try { SocketAndStreams sands =...
java
@SuppressWarnings({ "rawtypes", "unchecked" }) private void cleanupSessions(List<String> storeNamesToCleanUp) { logger.info("Performing cleanup"); for(String store: storeNamesToCleanUp) { for(Node node: nodesToStream) { try { SocketAndStreams sands =...
[ "@", "SuppressWarnings", "(", "{", "\"rawtypes\"", ",", "\"unchecked\"", "}", ")", "private", "void", "cleanupSessions", "(", "List", "<", "String", ">", "storeNamesToCleanUp", ")", "{", "logger", ".", "info", "(", "\"Performing cleanup\"", ")", ";", "for", "(...
Helper method to Close all open socket connections and checkin back to the pool @param storeNamesToCleanUp List of stores to be cleanedup from the current streaming session
[ "Helper", "method", "to", "Close", "all", "open", "socket", "connections", "and", "checkin", "back", "to", "the", "pool" ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/client/protocol/admin/BaseStreamingClient.java#L787-L810
train
voldemort/voldemort
src/java/voldemort/store/InsufficientOperationalNodesException.java
InsufficientOperationalNodesException.stripNodeIds
private static List<Integer> stripNodeIds(List<Node> nodeList) { List<Integer> nodeidList = new ArrayList<Integer>(); if(nodeList != null) { for(Node node: nodeList) { nodeidList.add(node.getId()); } } return nodeidList; }
java
private static List<Integer> stripNodeIds(List<Node> nodeList) { List<Integer> nodeidList = new ArrayList<Integer>(); if(nodeList != null) { for(Node node: nodeList) { nodeidList.add(node.getId()); } } return nodeidList; }
[ "private", "static", "List", "<", "Integer", ">", "stripNodeIds", "(", "List", "<", "Node", ">", "nodeList", ")", "{", "List", "<", "Integer", ">", "nodeidList", "=", "new", "ArrayList", "<", "Integer", ">", "(", ")", ";", "if", "(", "nodeList", "!=", ...
Helper method to get a list of node ids. @param nodeList
[ "Helper", "method", "to", "get", "a", "list", "of", "node", "ids", "." ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/store/InsufficientOperationalNodesException.java#L80-L88
train
voldemort/voldemort
src/java/voldemort/store/InsufficientOperationalNodesException.java
InsufficientOperationalNodesException.difference
private static List<Node> difference(List<Node> listA, List<Node> listB) { if(listA != null && listB != null) listA.removeAll(listB); return listA; }
java
private static List<Node> difference(List<Node> listA, List<Node> listB) { if(listA != null && listB != null) listA.removeAll(listB); return listA; }
[ "private", "static", "List", "<", "Node", ">", "difference", "(", "List", "<", "Node", ">", "listA", ",", "List", "<", "Node", ">", "listB", ")", "{", "if", "(", "listA", "!=", "null", "&&", "listB", "!=", "null", ")", "listA", ".", "removeAll", "(...
Computes A-B @param listA @param listB @return
[ "Computes", "A", "-", "B" ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/store/InsufficientOperationalNodesException.java#L97-L101
train
voldemort/voldemort
src/java/voldemort/serialization/avro/versioned/SchemaEvolutionValidator.java
SchemaEvolutionValidator.main
public static void main(String[] args) { if(args.length != 2) { System.out.println("Usage: SchemaEvolutionValidator pathToOldSchema pathToNewSchema"); return; } Schema oldSchema; Schema newSchema; try { oldSchema = Schema.parse(new File(args[...
java
public static void main(String[] args) { if(args.length != 2) { System.out.println("Usage: SchemaEvolutionValidator pathToOldSchema pathToNewSchema"); return; } Schema oldSchema; Schema newSchema; try { oldSchema = Schema.parse(new File(args[...
[ "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "{", "if", "(", "args", ".", "length", "!=", "2", ")", "{", "System", ".", "out", ".", "println", "(", "\"Usage: SchemaEvolutionValidator pathToOldSchema pathToNewSchema\"", ")", ";", ...
This main method provides an easy command line tool to compare two schemas.
[ "This", "main", "method", "provides", "an", "easy", "command", "line", "tool", "to", "compare", "two", "schemas", "." ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/serialization/avro/versioned/SchemaEvolutionValidator.java#L51-L105
train
voldemort/voldemort
src/java/voldemort/serialization/avro/versioned/SchemaEvolutionValidator.java
SchemaEvolutionValidator.validateAllAvroSchemas
public static void validateAllAvroSchemas(SerializerDefinition avroSerDef) { Map<Integer, String> schemaVersions = avroSerDef.getAllSchemaInfoVersions(); if(schemaVersions.size() < 1) { throw new VoldemortException("No schema specified"); } for(Map.Entry<Integer, String> entr...
java
public static void validateAllAvroSchemas(SerializerDefinition avroSerDef) { Map<Integer, String> schemaVersions = avroSerDef.getAllSchemaInfoVersions(); if(schemaVersions.size() < 1) { throw new VoldemortException("No schema specified"); } for(Map.Entry<Integer, String> entr...
[ "public", "static", "void", "validateAllAvroSchemas", "(", "SerializerDefinition", "avroSerDef", ")", "{", "Map", "<", "Integer", ",", "String", ">", "schemaVersions", "=", "avroSerDef", ".", "getAllSchemaInfoVersions", "(", ")", ";", "if", "(", "schemaVersions", ...
Given an AVRO serializer definition, validates if all the avro schemas are valid i.e parseable. @param avroSerDef
[ "Given", "an", "AVRO", "serializer", "definition", "validates", "if", "all", "the", "avro", "schemas", "are", "valid", "i", ".", "e", "parseable", "." ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/serialization/avro/versioned/SchemaEvolutionValidator.java#L826-L842
train
voldemort/voldemort
contrib/hadoop-store-builder/src/java/voldemort/store/readonly/mr/AbstractStoreBuilderConfigurable.java
AbstractStoreBuilderConfigurable.getPartition
public int getPartition(byte[] key, byte[] value, int numReduceTasks) { try { /** * {@link partitionId} is the Voldemort primary partition that this * record belongs to. */ int partitionId = By...
java
public int getPartition(byte[] key, byte[] value, int numReduceTasks) { try { /** * {@link partitionId} is the Voldemort primary partition that this * record belongs to. */ int partitionId = By...
[ "public", "int", "getPartition", "(", "byte", "[", "]", "key", ",", "byte", "[", "]", "value", ",", "int", "numReduceTasks", ")", "{", "try", "{", "/**\n * {@link partitionId} is the Voldemort primary partition that this\n * record belongs to.\n ...
This function computes which reduce task to shuffle a record to.
[ "This", "function", "computes", "which", "reduce", "task", "to", "shuffle", "a", "record", "to", "." ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/contrib/hadoop-store-builder/src/java/voldemort/store/readonly/mr/AbstractStoreBuilderConfigurable.java#L114-L188
train
voldemort/voldemort
contrib/hadoop-store-builder/src/java/voldemort/store/readonly/disk/HadoopStoreWriter.java
HadoopStoreWriter.initFileStreams
@NotThreadsafe private void initFileStreams(int chunkId) { /** * {@link Set#add(Object)} returns false if the element already existed in the set. * This ensures we initialize the resources for each chunk only once. */ if (chunksHandled.add(chunkId)) { try { ...
java
@NotThreadsafe private void initFileStreams(int chunkId) { /** * {@link Set#add(Object)} returns false if the element already existed in the set. * This ensures we initialize the resources for each chunk only once. */ if (chunksHandled.add(chunkId)) { try { ...
[ "@", "NotThreadsafe", "private", "void", "initFileStreams", "(", "int", "chunkId", ")", "{", "/**\n * {@link Set#add(Object)} returns false if the element already existed in the set.\n * This ensures we initialize the resources for each chunk only once.\n */", "if", "...
The MapReduce framework should operate sequentially, so thread safety shouldn't be a problem.
[ "The", "MapReduce", "framework", "should", "operate", "sequentially", "so", "thread", "safety", "shouldn", "t", "be", "a", "problem", "." ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/contrib/hadoop-store-builder/src/java/voldemort/store/readonly/disk/HadoopStoreWriter.java#L155-L204
train
voldemort/voldemort
src/java/voldemort/rest/RestGetRequestValidator.java
RestGetRequestValidator.parseAndValidateRequest
@Override public boolean parseAndValidateRequest() { if(!super.parseAndValidateRequest()) { return false; } isGetVersionRequest = hasGetVersionRequestHeader(); if(isGetVersionRequest && this.parsedKeys.size() > 1) { RestErrorHandler.writeErrorResponse(messageE...
java
@Override public boolean parseAndValidateRequest() { if(!super.parseAndValidateRequest()) { return false; } isGetVersionRequest = hasGetVersionRequestHeader(); if(isGetVersionRequest && this.parsedKeys.size() > 1) { RestErrorHandler.writeErrorResponse(messageE...
[ "@", "Override", "public", "boolean", "parseAndValidateRequest", "(", ")", "{", "if", "(", "!", "super", ".", "parseAndValidateRequest", "(", ")", ")", "{", "return", "false", ";", "}", "isGetVersionRequest", "=", "hasGetVersionRequestHeader", "(", ")", ";", "...
Validations specific to GET and GET ALL
[ "Validations", "specific", "to", "GET", "and", "GET", "ALL" ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/rest/RestGetRequestValidator.java#L31-L44
train
voldemort/voldemort
contrib/hadoop-store-builder/src/java/voldemort/store/readonly/mr/utils/HadoopUtils.java
HadoopUtils.getMetadataFromSequenceFile
public static Map<String, String> getMetadataFromSequenceFile(FileSystem fs, Path path) { try { Configuration conf = new Configuration(); conf.setInt("io.file.buffer.size", 4096); SequenceFile.Reader reader = new SequenceFile.Reader(fs, path, new Configuration()); ...
java
public static Map<String, String> getMetadataFromSequenceFile(FileSystem fs, Path path) { try { Configuration conf = new Configuration(); conf.setInt("io.file.buffer.size", 4096); SequenceFile.Reader reader = new SequenceFile.Reader(fs, path, new Configuration()); ...
[ "public", "static", "Map", "<", "String", ",", "String", ">", "getMetadataFromSequenceFile", "(", "FileSystem", "fs", ",", "Path", "path", ")", "{", "try", "{", "Configuration", "conf", "=", "new", "Configuration", "(", ")", ";", "conf", ".", "setInt", "("...
Read the metadata from a hadoop SequenceFile @param fs The filesystem to read from @param path The file to read from @return The metadata from this file
[ "Read", "the", "metadata", "from", "a", "hadoop", "SequenceFile" ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/contrib/hadoop-store-builder/src/java/voldemort/store/readonly/mr/utils/HadoopUtils.java#L79-L95
train
voldemort/voldemort
src/java/voldemort/store/bdb/BdbNativeBackup.java
BdbNativeBackup.recordBackupSet
private void recordBackupSet(File backupDir) throws IOException { String[] filesInEnv = env.getHome().list(); SimpleDateFormat format = new SimpleDateFormat("yyyy_MM_dd_kk_mm_ss"); String recordFileName = "backupset-" + format.format(new Date()); File recordFile = new File(backupDir, rec...
java
private void recordBackupSet(File backupDir) throws IOException { String[] filesInEnv = env.getHome().list(); SimpleDateFormat format = new SimpleDateFormat("yyyy_MM_dd_kk_mm_ss"); String recordFileName = "backupset-" + format.format(new Date()); File recordFile = new File(backupDir, rec...
[ "private", "void", "recordBackupSet", "(", "File", "backupDir", ")", "throws", "IOException", "{", "String", "[", "]", "filesInEnv", "=", "env", ".", "getHome", "(", ")", ".", "list", "(", ")", ";", "SimpleDateFormat", "format", "=", "new", "SimpleDateFormat...
Records the list of backedup files into a text file @param filesInEnv @param backupDir
[ "Records", "the", "list", "of", "backedup", "files", "into", "a", "text", "file" ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/store/bdb/BdbNativeBackup.java#L184-L202
train
voldemort/voldemort
src/java/voldemort/store/bdb/BdbNativeBackup.java
BdbNativeBackup.cleanStaleFiles
private void cleanStaleFiles(File backupDir, AsyncOperationStatus status) { String[] filesInEnv = env.getHome().list(); String[] filesInBackupDir = backupDir.list(); if(filesInEnv != null && filesInBackupDir != null) { HashSet<String> envFileSet = new HashSet<String>(); f...
java
private void cleanStaleFiles(File backupDir, AsyncOperationStatus status) { String[] filesInEnv = env.getHome().list(); String[] filesInBackupDir = backupDir.list(); if(filesInEnv != null && filesInBackupDir != null) { HashSet<String> envFileSet = new HashSet<String>(); f...
[ "private", "void", "cleanStaleFiles", "(", "File", "backupDir", ",", "AsyncOperationStatus", "status", ")", "{", "String", "[", "]", "filesInEnv", "=", "env", ".", "getHome", "(", ")", ".", "list", "(", ")", ";", "String", "[", "]", "filesInBackupDir", "="...
For recovery from the latest consistent snapshot, we should clean up the old files from the previous backup set, else we will fill the disk with useless log files @param backupDir
[ "For", "recovery", "from", "the", "latest", "consistent", "snapshot", "we", "should", "clean", "up", "the", "old", "files", "from", "the", "previous", "backup", "set", "else", "we", "will", "fill", "the", "disk", "with", "useless", "log", "files" ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/store/bdb/BdbNativeBackup.java#L211-L227
train
voldemort/voldemort
src/java/voldemort/store/bdb/BdbNativeBackup.java
BdbNativeBackup.verifiedCopyFile
private void verifiedCopyFile(File sourceFile, File destFile) throws IOException { if(!destFile.exists()) { destFile.createNewFile(); } FileInputStream source = null; FileOutputStream destination = null; LogVerificationInputStream verifyStream = null; try { ...
java
private void verifiedCopyFile(File sourceFile, File destFile) throws IOException { if(!destFile.exists()) { destFile.createNewFile(); } FileInputStream source = null; FileOutputStream destination = null; LogVerificationInputStream verifyStream = null; try { ...
[ "private", "void", "verifiedCopyFile", "(", "File", "sourceFile", ",", "File", "destFile", ")", "throws", "IOException", "{", "if", "(", "!", "destFile", ".", "exists", "(", ")", ")", "{", "destFile", ".", "createNewFile", "(", ")", ";", "}", "FileInputStr...
Copies the jdb log files, with additional verification of the checksums. @param sourceFile @param destFile @throws IOException
[ "Copies", "the", "jdb", "log", "files", "with", "additional", "verification", "of", "the", "checksums", "." ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/store/bdb/BdbNativeBackup.java#L264-L295
train
voldemort/voldemort
src/java/voldemort/routing/ZoneRoutingStrategy.java
ZoneRoutingStrategy.getReplicatingPartitionList
@Override public List<Integer> getReplicatingPartitionList(int index) { List<Node> preferenceNodesList = new ArrayList<Node>(getNumReplicas()); List<Integer> replicationPartitionsList = new ArrayList<Integer>(getNumReplicas()); // Copy Zone based Replication Factor HashMap<Integer, ...
java
@Override public List<Integer> getReplicatingPartitionList(int index) { List<Node> preferenceNodesList = new ArrayList<Node>(getNumReplicas()); List<Integer> replicationPartitionsList = new ArrayList<Integer>(getNumReplicas()); // Copy Zone based Replication Factor HashMap<Integer, ...
[ "@", "Override", "public", "List", "<", "Integer", ">", "getReplicatingPartitionList", "(", "int", "index", ")", "{", "List", "<", "Node", ">", "preferenceNodesList", "=", "new", "ArrayList", "<", "Node", ">", "(", "getNumReplicas", "(", ")", ")", ";", "Li...
Get the replication partitions list for the given partition. @param index Partition id for which we are generating the preference list @return The List of partitionId where this partition is replicated.
[ "Get", "the", "replication", "partitions", "list", "for", "the", "given", "partition", "." ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/routing/ZoneRoutingStrategy.java#L57-L98
train
voldemort/voldemort
src/java/voldemort/routing/ZoneRoutingStrategy.java
ZoneRoutingStrategy.checkZoneRequirement
private boolean checkZoneRequirement(HashMap<Integer, Integer> requiredRepFactor, int zoneId) { if(requiredRepFactor.containsKey(zoneId)) { if(requiredRepFactor.get(zoneId) == 0) { return false; } else { requiredRepFactor.put(zoneId, requiredRepFactor.get(...
java
private boolean checkZoneRequirement(HashMap<Integer, Integer> requiredRepFactor, int zoneId) { if(requiredRepFactor.containsKey(zoneId)) { if(requiredRepFactor.get(zoneId) == 0) { return false; } else { requiredRepFactor.put(zoneId, requiredRepFactor.get(...
[ "private", "boolean", "checkZoneRequirement", "(", "HashMap", "<", "Integer", ",", "Integer", ">", "requiredRepFactor", ",", "int", "zoneId", ")", "{", "if", "(", "requiredRepFactor", ".", "containsKey", "(", "zoneId", ")", ")", "{", "if", "(", "requiredRepFac...
Check if we still need more nodes from the given zone and reduce the zoneReplicationFactor count accordingly. @param requiredRepFactor @param zoneId @return
[ "Check", "if", "we", "still", "need", "more", "nodes", "from", "the", "given", "zone", "and", "reduce", "the", "zoneReplicationFactor", "count", "accordingly", "." ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/routing/ZoneRoutingStrategy.java#L108-L119
train
voldemort/voldemort
contrib/restclient/src/java/voldemort/restclient/admin/CoordinatorAdminUtils.java
CoordinatorAdminUtils.acceptsUrlMultiple
public static void acceptsUrlMultiple(OptionParser parser) { parser.acceptsAll(Arrays.asList(OPT_U, OPT_URL), "coordinator bootstrap urls") .withRequiredArg() .describedAs("url-list") .withValuesSeparatedBy(',') .ofType(String.class); }
java
public static void acceptsUrlMultiple(OptionParser parser) { parser.acceptsAll(Arrays.asList(OPT_U, OPT_URL), "coordinator bootstrap urls") .withRequiredArg() .describedAs("url-list") .withValuesSeparatedBy(',') .ofType(String.class); }
[ "public", "static", "void", "acceptsUrlMultiple", "(", "OptionParser", "parser", ")", "{", "parser", ".", "acceptsAll", "(", "Arrays", ".", "asList", "(", "OPT_U", ",", "OPT_URL", ")", ",", "\"coordinator bootstrap urls\"", ")", ".", "withRequiredArg", "(", ")",...
Adds OPT_U | OPT_URL option to OptionParser, with multiple arguments. @param parser OptionParser to be modified @param required Tells if this option is required or optional
[ "Adds", "OPT_U", "|", "OPT_URL", "option", "to", "OptionParser", "with", "multiple", "arguments", "." ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/contrib/restclient/src/java/voldemort/restclient/admin/CoordinatorAdminUtils.java#L69-L75
train
voldemort/voldemort
contrib/restclient/src/java/voldemort/restclient/admin/CoordinatorAdminUtils.java
CoordinatorAdminUtils.copyArrayCutFirst
public static String[] copyArrayCutFirst(String[] arr) { if(arr.length > 1) { String[] arrCopy = new String[arr.length - 1]; System.arraycopy(arr, 1, arrCopy, 0, arrCopy.length); return arrCopy; } else { return new String[0]; } }
java
public static String[] copyArrayCutFirst(String[] arr) { if(arr.length > 1) { String[] arrCopy = new String[arr.length - 1]; System.arraycopy(arr, 1, arrCopy, 0, arrCopy.length); return arrCopy; } else { return new String[0]; } }
[ "public", "static", "String", "[", "]", "copyArrayCutFirst", "(", "String", "[", "]", "arr", ")", "{", "if", "(", "arr", ".", "length", ">", "1", ")", "{", "String", "[", "]", "arrCopy", "=", "new", "String", "[", "arr", ".", "length", "-", "1", ...
Utility function that copies a string array except for the first element @param arr Original array of strings @return Copied array of strings
[ "Utility", "function", "that", "copies", "a", "string", "array", "except", "for", "the", "first", "element" ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/contrib/restclient/src/java/voldemort/restclient/admin/CoordinatorAdminUtils.java#L240-L248
train
voldemort/voldemort
contrib/restclient/src/java/voldemort/restclient/admin/CoordinatorAdminUtils.java
CoordinatorAdminUtils.copyArrayAddFirst
public static String[] copyArrayAddFirst(String[] arr, String add) { String[] arrCopy = new String[arr.length + 1]; arrCopy[0] = add; System.arraycopy(arr, 0, arrCopy, 1, arr.length); return arrCopy; }
java
public static String[] copyArrayAddFirst(String[] arr, String add) { String[] arrCopy = new String[arr.length + 1]; arrCopy[0] = add; System.arraycopy(arr, 0, arrCopy, 1, arr.length); return arrCopy; }
[ "public", "static", "String", "[", "]", "copyArrayAddFirst", "(", "String", "[", "]", "arr", ",", "String", "add", ")", "{", "String", "[", "]", "arrCopy", "=", "new", "String", "[", "arr", ".", "length", "+", "1", "]", ";", "arrCopy", "[", "0", "]...
Utility function that copies a string array and add another string to first @param arr Original array of strings @param add @return Copied array of strings
[ "Utility", "function", "that", "copies", "a", "string", "array", "and", "add", "another", "string", "to", "first" ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/contrib/restclient/src/java/voldemort/restclient/admin/CoordinatorAdminUtils.java#L258-L263
train
voldemort/voldemort
src/java/voldemort/store/metadata/MetadataStore.java
MetadataStore.put
@SuppressWarnings("unchecked") public void put(String key, Versioned<Object> value) { // acquire write lock writeLock.lock(); try { if(this.storeNames.contains(key) || key.equals(STORES_KEY)) { // Check for backwards compatibility List<StoreDefin...
java
@SuppressWarnings("unchecked") public void put(String key, Versioned<Object> value) { // acquire write lock writeLock.lock(); try { if(this.storeNames.contains(key) || key.equals(STORES_KEY)) { // Check for backwards compatibility List<StoreDefin...
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "void", "put", "(", "String", "key", ",", "Versioned", "<", "Object", ">", "value", ")", "{", "// acquire write lock", "writeLock", ".", "lock", "(", ")", ";", "try", "{", "if", "(", "this", "...
helper function to convert strings to bytes as needed. @param key @param value
[ "helper", "function", "to", "convert", "strings", "to", "bytes", "as", "needed", "." ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/store/metadata/MetadataStore.java#L323-L396
train
voldemort/voldemort
src/java/voldemort/store/metadata/MetadataStore.java
MetadataStore.updateStoreDefinitions
@SuppressWarnings("unchecked") public void updateStoreDefinitions(Versioned<byte[]> valueBytes) { // acquire write lock writeLock.lock(); try { Versioned<String> value = new Versioned<String>(ByteUtils.getString(valueBytes.getValue(), ...
java
@SuppressWarnings("unchecked") public void updateStoreDefinitions(Versioned<byte[]> valueBytes) { // acquire write lock writeLock.lock(); try { Versioned<String> value = new Versioned<String>(ByteUtils.getString(valueBytes.getValue(), ...
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "void", "updateStoreDefinitions", "(", "Versioned", "<", "byte", "[", "]", ">", "valueBytes", ")", "{", "// acquire write lock", "writeLock", ".", "lock", "(", ")", ";", "try", "{", "Versioned", "<"...
Function to update store definitions. Unlike the put method, this function does not delete any existing state. It only updates the state of the stores specified in the given stores.xml @param valueBytes specifies the bytes of the stores.xml containing updates for the specified stores
[ "Function", "to", "update", "store", "definitions", ".", "Unlike", "the", "put", "method", "this", "function", "does", "not", "delete", "any", "existing", "state", ".", "It", "only", "updates", "the", "state", "of", "the", "stores", "specified", "in", "the",...
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/store/metadata/MetadataStore.java#L406-L450
train
voldemort/voldemort
src/java/voldemort/store/metadata/MetadataStore.java
MetadataStore.put
@Override public void put(ByteArray keyBytes, Versioned<byte[]> valueBytes, byte[] transforms) throws VoldemortException { // acquire write lock writeLock.lock(); try { String key = ByteUtils.getString(keyBytes.get(), "UTF-8"); Versioned<String> value = ne...
java
@Override public void put(ByteArray keyBytes, Versioned<byte[]> valueBytes, byte[] transforms) throws VoldemortException { // acquire write lock writeLock.lock(); try { String key = ByteUtils.getString(keyBytes.get(), "UTF-8"); Versioned<String> value = ne...
[ "@", "Override", "public", "void", "put", "(", "ByteArray", "keyBytes", ",", "Versioned", "<", "byte", "[", "]", ">", "valueBytes", ",", "byte", "[", "]", "transforms", ")", "throws", "VoldemortException", "{", "// acquire write lock", "writeLock", ".", "lock"...
A write through put to inner-store. @param keyBytes : keyName strings serialized as bytes eg. 'cluster.xml' @param valueBytes : versioned byte[] eg. UTF bytes for cluster xml definitions @throws VoldemortException
[ "A", "write", "through", "put", "to", "inner", "-", "store", "." ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/store/metadata/MetadataStore.java#L484-L501
train
voldemort/voldemort
src/java/voldemort/store/metadata/MetadataStore.java
MetadataStore.makeStoreDefinitionMap
private HashMap<String, StoreDefinition> makeStoreDefinitionMap(List<StoreDefinition> storeDefs) { HashMap<String, StoreDefinition> storeDefMap = new HashMap<String, StoreDefinition>(); for(StoreDefinition storeDef: storeDefs) storeDefMap.put(storeDef.getName(), storeDef); return sto...
java
private HashMap<String, StoreDefinition> makeStoreDefinitionMap(List<StoreDefinition> storeDefs) { HashMap<String, StoreDefinition> storeDefMap = new HashMap<String, StoreDefinition>(); for(StoreDefinition storeDef: storeDefs) storeDefMap.put(storeDef.getName(), storeDef); return sto...
[ "private", "HashMap", "<", "String", ",", "StoreDefinition", ">", "makeStoreDefinitionMap", "(", "List", "<", "StoreDefinition", ">", "storeDefs", ")", "{", "HashMap", "<", "String", ",", "StoreDefinition", ">", "storeDefMap", "=", "new", "HashMap", "<", "String...
Returns the list of store defs as a map @param storeDefs @return
[ "Returns", "the", "list", "of", "store", "defs", "as", "a", "map" ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/store/metadata/MetadataStore.java#L828-L833
train
voldemort/voldemort
src/java/voldemort/store/metadata/MetadataStore.java
MetadataStore.updateRoutingStrategies
private void updateRoutingStrategies(Cluster cluster, List<StoreDefinition> storeDefs) { // acquire write lock writeLock.lock(); try { VectorClock clock = new VectorClock(); if(metadataCache.containsKey(ROUTING_STRATEGY_KEY)) clock = (VectorClock) metadata...
java
private void updateRoutingStrategies(Cluster cluster, List<StoreDefinition> storeDefs) { // acquire write lock writeLock.lock(); try { VectorClock clock = new VectorClock(); if(metadataCache.containsKey(ROUTING_STRATEGY_KEY)) clock = (VectorClock) metadata...
[ "private", "void", "updateRoutingStrategies", "(", "Cluster", "cluster", ",", "List", "<", "StoreDefinition", ">", "storeDefs", ")", "{", "// acquire write lock", "writeLock", ".", "lock", "(", ")", ";", "try", "{", "VectorClock", "clock", "=", "new", "VectorClo...
Changes to cluster OR store definition metadata results in routing strategies changing. These changes need to be propagated to all the listeners. @param cluster The updated cluster metadata @param storeDefs The updated list of store definition
[ "Changes", "to", "cluster", "OR", "store", "definition", "metadata", "results", "in", "routing", "strategies", "changing", ".", "These", "changes", "need", "to", "be", "propagated", "to", "all", "the", "listeners", "." ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/store/metadata/MetadataStore.java#L843-L878
train
voldemort/voldemort
src/java/voldemort/store/metadata/MetadataStore.java
MetadataStore.addRebalancingState
public void addRebalancingState(final RebalanceTaskInfo stealInfo) { // acquire write lock writeLock.lock(); try { // Move into rebalancing state if(ByteUtils.getString(get(SERVER_STATE_KEY, null).get(0).getValue(), "UTF-8") .compareTo(VoldemortSta...
java
public void addRebalancingState(final RebalanceTaskInfo stealInfo) { // acquire write lock writeLock.lock(); try { // Move into rebalancing state if(ByteUtils.getString(get(SERVER_STATE_KEY, null).get(0).getValue(), "UTF-8") .compareTo(VoldemortSta...
[ "public", "void", "addRebalancingState", "(", "final", "RebalanceTaskInfo", "stealInfo", ")", "{", "// acquire write lock", "writeLock", ".", "lock", "(", ")", ";", "try", "{", "// Move into rebalancing state", "if", "(", "ByteUtils", ".", "getString", "(", "get", ...
Add the steal information to the rebalancer state @param stealInfo The steal information to add
[ "Add", "the", "steal", "information", "to", "the", "rebalancer", "state" ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/store/metadata/MetadataStore.java#L896-L921
train
voldemort/voldemort
src/java/voldemort/store/metadata/MetadataStore.java
MetadataStore.deleteRebalancingState
public void deleteRebalancingState(RebalanceTaskInfo stealInfo) { // acquire write lock writeLock.lock(); try { RebalancerState rebalancerState = getRebalancerState(); if(!rebalancerState.remove(stealInfo)) throw new IllegalArgumentException("Couldn't fin...
java
public void deleteRebalancingState(RebalanceTaskInfo stealInfo) { // acquire write lock writeLock.lock(); try { RebalancerState rebalancerState = getRebalancerState(); if(!rebalancerState.remove(stealInfo)) throw new IllegalArgumentException("Couldn't fin...
[ "public", "void", "deleteRebalancingState", "(", "RebalanceTaskInfo", "stealInfo", ")", "{", "// acquire write lock", "writeLock", ".", "lock", "(", ")", ";", "try", "{", "RebalancerState", "rebalancerState", "=", "getRebalancerState", "(", ")", ";", "if", "(", "!...
Delete the partition steal information from the rebalancer state @param stealInfo The steal information to delete
[ "Delete", "the", "partition", "steal", "information", "from", "the", "rebalancer", "state" ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/store/metadata/MetadataStore.java#L928-L948
train
voldemort/voldemort
src/java/voldemort/store/metadata/MetadataStore.java
MetadataStore.setOfflineState
public void setOfflineState(boolean setToOffline) { // acquire write lock writeLock.lock(); try { String currentState = ByteUtils.getString(get(SERVER_STATE_KEY, null).get(0).getValue(), "UTF-8"); if(setToOffline) { ...
java
public void setOfflineState(boolean setToOffline) { // acquire write lock writeLock.lock(); try { String currentState = ByteUtils.getString(get(SERVER_STATE_KEY, null).get(0).getValue(), "UTF-8"); if(setToOffline) { ...
[ "public", "void", "setOfflineState", "(", "boolean", "setToOffline", ")", "{", "// acquire write lock", "writeLock", ".", "lock", "(", ")", ";", "try", "{", "String", "currentState", "=", "ByteUtils", ".", "getString", "(", "get", "(", "SERVER_STATE_KEY", ",", ...
change server state between OFFLINE_SERVER and NORMAL_SERVER @param setToOffline True if set to OFFLINE_SERVER
[ "change", "server", "state", "between", "OFFLINE_SERVER", "and", "NORMAL_SERVER" ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/store/metadata/MetadataStore.java#L955-L1005
train
voldemort/voldemort
src/java/voldemort/store/metadata/MetadataStore.java
MetadataStore.addStoreDefinition
public void addStoreDefinition(StoreDefinition storeDef) { // acquire write lock writeLock.lock(); try { // Check if store already exists if(this.storeNames.contains(storeDef.getName())) { throw new VoldemortException("Store already exists !"); ...
java
public void addStoreDefinition(StoreDefinition storeDef) { // acquire write lock writeLock.lock(); try { // Check if store already exists if(this.storeNames.contains(storeDef.getName())) { throw new VoldemortException("Store already exists !"); ...
[ "public", "void", "addStoreDefinition", "(", "StoreDefinition", "storeDef", ")", "{", "// acquire write lock", "writeLock", ".", "lock", "(", ")", ";", "try", "{", "// Check if store already exists", "if", "(", "this", ".", "storeNames", ".", "contains", "(", "sto...
Function to add a new Store to the Metadata store. This involves 1. Create a new entry in the ConfigurationStorageEngine for STORES. 2. Update the metadata cache. 3. Re-create the 'stores.xml' key @param storeDef defines the new store to be created
[ "Function", "to", "add", "a", "new", "Store", "to", "the", "Metadata", "store", ".", "This", "involves" ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/store/metadata/MetadataStore.java#L1018-L1049
train
voldemort/voldemort
src/java/voldemort/store/metadata/MetadataStore.java
MetadataStore.deleteStoreDefinition
public void deleteStoreDefinition(String storeName) { // acquire write lock writeLock.lock(); try { // Check if store exists if(!this.storeNames.contains(storeName)) { throw new VoldemortException("Requested store to be deleted does not exist !"); ...
java
public void deleteStoreDefinition(String storeName) { // acquire write lock writeLock.lock(); try { // Check if store exists if(!this.storeNames.contains(storeName)) { throw new VoldemortException("Requested store to be deleted does not exist !"); ...
[ "public", "void", "deleteStoreDefinition", "(", "String", "storeName", ")", "{", "// acquire write lock", "writeLock", ".", "lock", "(", ")", ";", "try", "{", "// Check if store exists", "if", "(", "!", "this", ".", "storeNames", ".", "contains", "(", "storeName...
Function to delete the specified store from Metadata store. This involves 1. Remove entry from the ConfigurationStorageEngine for STORES. 2. Update the metadata cache. 3. Re-create the 'stores.xml' key @param storeName specifies name of the store to be deleted.
[ "Function", "to", "delete", "the", "specified", "store", "from", "Metadata", "store", ".", "This", "involves" ]
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/store/metadata/MetadataStore.java#L1062-L1087
train
voldemort/voldemort
src/java/voldemort/store/metadata/MetadataStore.java
MetadataStore.isValidStore
public boolean isValidStore(String name) { readLock.lock(); try { if(this.storeNames.contains(name)) { return true; } return false; } finally { readLock.unlock(); } }
java
public boolean isValidStore(String name) { readLock.lock(); try { if(this.storeNames.contains(name)) { return true; } return false; } finally { readLock.unlock(); } }
[ "public", "boolean", "isValidStore", "(", "String", "name", ")", "{", "readLock", ".", "lock", "(", ")", ";", "try", "{", "if", "(", "this", ".", "storeNames", ".", "contains", "(", "name", ")", ")", "{", "return", "true", ";", "}", "return", "false"...
Utility function to validate if the given store name exists in the store name list managed by MetadataStore. This is used by the Admin service for validation before serving a get-metadata request. @param name Name of the store to validate @return True if the store name exists in the 'storeNames' list. False otherwise.
[ "Utility", "function", "to", "validate", "if", "the", "given", "store", "name", "exists", "in", "the", "store", "name", "list", "managed", "by", "MetadataStore", ".", "This", "is", "used", "by", "the", "Admin", "service", "for", "validation", "before", "serv...
a7dbdea58032021361680faacf2782cf981c5332
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/store/metadata/MetadataStore.java#L1142-L1152
train