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/client/rebalance/RebalanceScheduler.java | RebalanceScheduler.populateTasksByStealer | protected void populateTasksByStealer(List<StealerBasedRebalanceTask> sbTaskList) {
// Setup mapping of stealers to work for this run.
for(StealerBasedRebalanceTask task: sbTaskList) {
if(task.getStealInfos().size() != 1) {
throw new VoldemortException("StealerBasedRebalanceT... | java | protected void populateTasksByStealer(List<StealerBasedRebalanceTask> sbTaskList) {
// Setup mapping of stealers to work for this run.
for(StealerBasedRebalanceTask task: sbTaskList) {
if(task.getStealInfos().size() != 1) {
throw new VoldemortException("StealerBasedRebalanceT... | [
"protected",
"void",
"populateTasksByStealer",
"(",
"List",
"<",
"StealerBasedRebalanceTask",
">",
"sbTaskList",
")",
"{",
"// Setup mapping of stealers to work for this run.",
"for",
"(",
"StealerBasedRebalanceTask",
"task",
":",
"sbTaskList",
")",
"{",
"if",
"(",
"task"... | Go over the task list and create a map of stealerId -> Tasks
@param sbTaskList List of all stealer-based rebalancing tasks to be
scheduled. | [
"Go",
"over",
"the",
"task",
"list",
"and",
"create",
"a",
"map",
"of",
"stealerId",
"-",
">",
"Tasks"
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/client/rebalance/RebalanceScheduler.java#L92-L116 | train |
voldemort/voldemort | src/java/voldemort/client/rebalance/RebalanceScheduler.java | RebalanceScheduler.scheduleNextTask | protected synchronized StealerBasedRebalanceTask scheduleNextTask(boolean executeService) {
// Make sure there is work left to do.
if(doneSignal.getCount() == 0) {
logger.info("All tasks completion signaled... returning");
return null;
}
// Limit number of tasks ... | java | protected synchronized StealerBasedRebalanceTask scheduleNextTask(boolean executeService) {
// Make sure there is work left to do.
if(doneSignal.getCount() == 0) {
logger.info("All tasks completion signaled... returning");
return null;
}
// Limit number of tasks ... | [
"protected",
"synchronized",
"StealerBasedRebalanceTask",
"scheduleNextTask",
"(",
"boolean",
"executeService",
")",
"{",
"// Make sure there is work left to do.",
"if",
"(",
"doneSignal",
".",
"getCount",
"(",
")",
"==",
"0",
")",
"{",
"logger",
".",
"info",
"(",
"... | Schedule at most one task.
The scheduled task *must* invoke 'doneTask()' upon
completion/termination.
@param executeService flag to control execution of the service, some tests pass
in value 'false'
@return The task scheduled or null if not possible to schedule a task at
this time. | [
"Schedule",
"at",
"most",
"one",
"task",
"."
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/client/rebalance/RebalanceScheduler.java#L177-L233 | train |
voldemort/voldemort | src/java/voldemort/client/rebalance/RebalanceScheduler.java | RebalanceScheduler.addNodesToWorkerList | public synchronized void addNodesToWorkerList(List<Integer> nodeIds) {
// Bookkeeping for nodes that will be involved in the next task
nodeIdsWithWork.addAll(nodeIds);
logger.info("Node IDs with work: " + nodeIdsWithWork + " Newly added nodes " + nodeIds);
} | java | public synchronized void addNodesToWorkerList(List<Integer> nodeIds) {
// Bookkeeping for nodes that will be involved in the next task
nodeIdsWithWork.addAll(nodeIds);
logger.info("Node IDs with work: " + nodeIdsWithWork + " Newly added nodes " + nodeIds);
} | [
"public",
"synchronized",
"void",
"addNodesToWorkerList",
"(",
"List",
"<",
"Integer",
">",
"nodeIds",
")",
"{",
"// Bookkeeping for nodes that will be involved in the next task",
"nodeIdsWithWork",
".",
"addAll",
"(",
"nodeIds",
")",
";",
"logger",
".",
"info",
"(",
... | Add nodes to the workers list
@param nodeIds list of node ids. | [
"Add",
"nodes",
"to",
"the",
"workers",
"list"
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/client/rebalance/RebalanceScheduler.java#L251-L255 | train |
voldemort/voldemort | src/java/voldemort/client/rebalance/RebalanceScheduler.java | RebalanceScheduler.doneTask | public synchronized void doneTask(int stealerId, int donorId) {
removeNodesFromWorkerList(Arrays.asList(stealerId, donorId));
numTasksExecuting--;
doneSignal.countDown();
// Try and schedule more tasks now that resources may be available to do
// so.
scheduleMoreTasks();
... | java | public synchronized void doneTask(int stealerId, int donorId) {
removeNodesFromWorkerList(Arrays.asList(stealerId, donorId));
numTasksExecuting--;
doneSignal.countDown();
// Try and schedule more tasks now that resources may be available to do
// so.
scheduleMoreTasks();
... | [
"public",
"synchronized",
"void",
"doneTask",
"(",
"int",
"stealerId",
",",
"int",
"donorId",
")",
"{",
"removeNodesFromWorkerList",
"(",
"Arrays",
".",
"asList",
"(",
"stealerId",
",",
"donorId",
")",
")",
";",
"numTasksExecuting",
"--",
";",
"doneSignal",
".... | Method must be invoked upon completion of a rebalancing task. It is the
task's responsibility to do so.
@param stealerId
@param donorId | [
"Method",
"must",
"be",
"invoked",
"upon",
"completion",
"of",
"a",
"rebalancing",
"task",
".",
"It",
"is",
"the",
"task",
"s",
"responsibility",
"to",
"do",
"so",
"."
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/client/rebalance/RebalanceScheduler.java#L274-L281 | train |
voldemort/voldemort | src/java/voldemort/store/bdb/stats/AggregatedBdbEnvironmentStats.java | AggregatedBdbEnvironmentStats.collectLongMetric | private List<Long> collectLongMetric(String metricGetterName) {
List<Long> vals = new ArrayList<Long>();
for(BdbEnvironmentStats envStats: environmentStatsTracked) {
vals.add((Long) ReflectUtils.callMethod(envStats,
BdbEnvironmentStats.clas... | java | private List<Long> collectLongMetric(String metricGetterName) {
List<Long> vals = new ArrayList<Long>();
for(BdbEnvironmentStats envStats: environmentStatsTracked) {
vals.add((Long) ReflectUtils.callMethod(envStats,
BdbEnvironmentStats.clas... | [
"private",
"List",
"<",
"Long",
">",
"collectLongMetric",
"(",
"String",
"metricGetterName",
")",
"{",
"List",
"<",
"Long",
">",
"vals",
"=",
"new",
"ArrayList",
"<",
"Long",
">",
"(",
")",
";",
"for",
"(",
"BdbEnvironmentStats",
"envStats",
":",
"environm... | Calls the provided metric getter on all the tracked environments and
obtains their values
@param metricGetterName
@return | [
"Calls",
"the",
"provided",
"metric",
"getter",
"on",
"all",
"the",
"tracked",
"environments",
"and",
"obtains",
"their",
"values"
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/store/bdb/stats/AggregatedBdbEnvironmentStats.java#L38-L48 | train |
voldemort/voldemort | src/java/voldemort/utils/ByteArray.java | ByteArray.toHexStrings | public static Iterable<String> toHexStrings(Iterable<ByteArray> arrays) {
ArrayList<String> ret = new ArrayList<String>();
for(ByteArray array: arrays)
ret.add(ByteUtils.toHexString(array.get()));
return ret;
} | java | public static Iterable<String> toHexStrings(Iterable<ByteArray> arrays) {
ArrayList<String> ret = new ArrayList<String>();
for(ByteArray array: arrays)
ret.add(ByteUtils.toHexString(array.get()));
return ret;
} | [
"public",
"static",
"Iterable",
"<",
"String",
">",
"toHexStrings",
"(",
"Iterable",
"<",
"ByteArray",
">",
"arrays",
")",
"{",
"ArrayList",
"<",
"String",
">",
"ret",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"for",
"(",
"ByteArray",
... | Translate the each ByteArray in an iterable into a hexadecimal string
@param arrays The array of bytes to translate
@return An iterable of converted strings | [
"Translate",
"the",
"each",
"ByteArray",
"in",
"an",
"iterable",
"into",
"a",
"hexadecimal",
"string"
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/utils/ByteArray.java#L53-L58 | train |
voldemort/voldemort | src/java/voldemort/rest/GetResponseSender.java | GetResponseSender.sendResponse | @Override
public void sendResponse(StoreStats performanceStats,
boolean isFromLocalZone,
long startTimeInMs) throws Exception {
/*
* Pay attention to the code below. Note that in this method we wrap a multiPart object with a mimeMessage.
... | java | @Override
public void sendResponse(StoreStats performanceStats,
boolean isFromLocalZone,
long startTimeInMs) throws Exception {
/*
* Pay attention to the code below. Note that in this method we wrap a multiPart object with a mimeMessage.
... | [
"@",
"Override",
"public",
"void",
"sendResponse",
"(",
"StoreStats",
"performanceStats",
",",
"boolean",
"isFromLocalZone",
",",
"long",
"startTimeInMs",
")",
"throws",
"Exception",
"{",
"/*\n * Pay attention to the code below. Note that in this method we wrap a multiPar... | Sends a multipart response. Each body part represents a versioned value
of the given key.
@throws IOException
@throws MessagingException | [
"Sends",
"a",
"multipart",
"response",
".",
"Each",
"body",
"part",
"represents",
"a",
"versioned",
"value",
"of",
"the",
"given",
"key",
"."
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/rest/GetResponseSender.java#L58-L159 | train |
voldemort/voldemort | src/java/voldemort/server/VoldemortConfig.java | VoldemortConfig.getPublicConfigValue | public String getPublicConfigValue(String key) throws ConfigurationException {
if (!allProps.containsKey(key)) {
throw new UndefinedPropertyException("The requested config key does not exist.");
}
if (restrictedConfigs.contains(key)) {
throw new ConfigurationException("Th... | java | public String getPublicConfigValue(String key) throws ConfigurationException {
if (!allProps.containsKey(key)) {
throw new UndefinedPropertyException("The requested config key does not exist.");
}
if (restrictedConfigs.contains(key)) {
throw new ConfigurationException("Th... | [
"public",
"String",
"getPublicConfigValue",
"(",
"String",
"key",
")",
"throws",
"ConfigurationException",
"{",
"if",
"(",
"!",
"allProps",
".",
"containsKey",
"(",
"key",
")",
")",
"{",
"throw",
"new",
"UndefinedPropertyException",
"(",
"\"The requested config key ... | This is a generic function for retrieving any config value. The returned value
is the one the server is operating with, no matter whether it comes from defaults
or from the user-supplied configuration.
This function only provides access to configs which are deemed safe to share
publicly (i.e.: not security-related con... | [
"This",
"is",
"a",
"generic",
"function",
"for",
"retrieving",
"any",
"config",
"value",
".",
"The",
"returned",
"value",
"is",
"the",
"one",
"the",
"server",
"is",
"operating",
"with",
"no",
"matter",
"whether",
"it",
"comes",
"from",
"defaults",
"or",
"f... | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/server/VoldemortConfig.java#L1171-L1179 | train |
voldemort/voldemort | src/java/voldemort/store/quota/QuotaLimitingStore.java | QuotaLimitingStore.checkRateLimit | private void checkRateLimit(String quotaKey, Tracked trackedOp) {
String quotaValue = null;
try {
if(!metadataStore.getQuotaEnforcingEnabledUnlocked()) {
return;
}
quotaValue = quotaStore.cacheGet(quotaKey);
// Store may not have any quotas... | java | private void checkRateLimit(String quotaKey, Tracked trackedOp) {
String quotaValue = null;
try {
if(!metadataStore.getQuotaEnforcingEnabledUnlocked()) {
return;
}
quotaValue = quotaStore.cacheGet(quotaKey);
// Store may not have any quotas... | [
"private",
"void",
"checkRateLimit",
"(",
"String",
"quotaKey",
",",
"Tracked",
"trackedOp",
")",
"{",
"String",
"quotaValue",
"=",
"null",
";",
"try",
"{",
"if",
"(",
"!",
"metadataStore",
".",
"getQuotaEnforcingEnabledUnlocked",
"(",
")",
")",
"{",
"return",... | Ensure the current throughput levels for the tracked operation does not
exceed set quota limits. Throws an exception if exceeded quota.
@param quotaKey
@param trackedOp | [
"Ensure",
"the",
"current",
"throughput",
"levels",
"for",
"the",
"tracked",
"operation",
"does",
"not",
"exceed",
"set",
"quota",
"limits",
".",
"Throws",
"an",
"exception",
"if",
"exceeded",
"quota",
"."
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/store/quota/QuotaLimitingStore.java#L88-L120 | train |
voldemort/voldemort | src/java/voldemort/server/protocol/admin/AsyncOperationService.java | AsyncOperationService.submitOperation | public synchronized void submitOperation(int requestId, AsyncOperation operation) {
if(this.operations.containsKey(requestId))
throw new VoldemortException("Request " + requestId
+ " already submitted to the system");
this.operations.put(requestId, o... | java | public synchronized void submitOperation(int requestId, AsyncOperation operation) {
if(this.operations.containsKey(requestId))
throw new VoldemortException("Request " + requestId
+ " already submitted to the system");
this.operations.put(requestId, o... | [
"public",
"synchronized",
"void",
"submitOperation",
"(",
"int",
"requestId",
",",
"AsyncOperation",
"operation",
")",
"{",
"if",
"(",
"this",
".",
"operations",
".",
"containsKey",
"(",
"requestId",
")",
")",
"throw",
"new",
"VoldemortException",
"(",
"\"Reques... | Submit a operations. Throw a run time exception if the operations is
already submitted
@param operation The asynchronous operations to submit
@param requestId Id of the request | [
"Submit",
"a",
"operations",
".",
"Throw",
"a",
"run",
"time",
"exception",
"if",
"the",
"operations",
"is",
"already",
"submitted"
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/server/protocol/admin/AsyncOperationService.java#L68-L76 | train |
voldemort/voldemort | src/java/voldemort/server/protocol/admin/AsyncOperationService.java | AsyncOperationService.isComplete | public synchronized boolean isComplete(int requestId, boolean remove) {
if (!operations.containsKey(requestId))
throw new VoldemortException("No operation with id " + requestId + " found");
if (operations.get(requestId).getStatus().isComplete()) {
if (logger.isDebugEnabled())
... | java | public synchronized boolean isComplete(int requestId, boolean remove) {
if (!operations.containsKey(requestId))
throw new VoldemortException("No operation with id " + requestId + " found");
if (operations.get(requestId).getStatus().isComplete()) {
if (logger.isDebugEnabled())
... | [
"public",
"synchronized",
"boolean",
"isComplete",
"(",
"int",
"requestId",
",",
"boolean",
"remove",
")",
"{",
"if",
"(",
"!",
"operations",
".",
"containsKey",
"(",
"requestId",
")",
")",
"throw",
"new",
"VoldemortException",
"(",
"\"No operation with id \"",
... | Check if the an operation is done or not.
@param requestId Id of the request
@param remove Whether remove the request out of the list if it is done.
@return True if request is complete, false otherwise | [
"Check",
"if",
"the",
"an",
"operation",
"is",
"done",
"or",
"not",
"."
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/server/protocol/admin/AsyncOperationService.java#L85-L100 | train |
voldemort/voldemort | src/java/voldemort/server/protocol/admin/AsyncOperationService.java | AsyncOperationService.getStatus | @JmxOperation(description = "Retrieve operation status")
public String getStatus(int id) {
try {
return getOperationStatus(id).toString();
} catch(VoldemortException e) {
return "No operation with id " + id + " found";
}
} | java | @JmxOperation(description = "Retrieve operation status")
public String getStatus(int id) {
try {
return getOperationStatus(id).toString();
} catch(VoldemortException e) {
return "No operation with id " + id + " found";
}
} | [
"@",
"JmxOperation",
"(",
"description",
"=",
"\"Retrieve operation status\"",
")",
"public",
"String",
"getStatus",
"(",
"int",
"id",
")",
"{",
"try",
"{",
"return",
"getOperationStatus",
"(",
"id",
")",
".",
"toString",
"(",
")",
";",
"}",
"catch",
"(",
... | Wrap getOperationStatus to avoid throwing exception over JMX | [
"Wrap",
"getOperationStatus",
"to",
"avoid",
"throwing",
"exception",
"over",
"JMX"
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/server/protocol/admin/AsyncOperationService.java#L110-L117 | train |
voldemort/voldemort | src/java/voldemort/server/protocol/admin/AsyncOperationService.java | AsyncOperationService.getAsyncOperationList | public List<Integer> getAsyncOperationList(boolean showCompleted) {
/**
* Create a copy using an immutable set to avoid a
* {@link java.util.ConcurrentModificationException}
*/
Set<Integer> keySet = ImmutableSet.copyOf(operations.keySet());
if(showCompleted)
... | java | public List<Integer> getAsyncOperationList(boolean showCompleted) {
/**
* Create a copy using an immutable set to avoid a
* {@link java.util.ConcurrentModificationException}
*/
Set<Integer> keySet = ImmutableSet.copyOf(operations.keySet());
if(showCompleted)
... | [
"public",
"List",
"<",
"Integer",
">",
"getAsyncOperationList",
"(",
"boolean",
"showCompleted",
")",
"{",
"/**\n * Create a copy using an immutable set to avoid a\n * {@link java.util.ConcurrentModificationException}\n */",
"Set",
"<",
"Integer",
">",
"keySet... | Get list of asynchronous operations on this node. By default, only the
pending operations are returned.
@param showCompleted Show completed operations
@return A list of operation ids. | [
"Get",
"list",
"of",
"asynchronous",
"operations",
"on",
"this",
"node",
".",
"By",
"default",
"only",
"the",
"pending",
"operations",
"are",
"returned",
"."
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/server/protocol/admin/AsyncOperationService.java#L150-L167 | train |
voldemort/voldemort | src/java/voldemort/server/protocol/admin/AsyncOperationService.java | AsyncOperationService.stopAsyncOperation | @JmxOperation
public String stopAsyncOperation(int requestId) {
try {
stopOperation(requestId);
} catch(VoldemortException e) {
return e.getMessage();
}
return "Stopping operation " + requestId;
} | java | @JmxOperation
public String stopAsyncOperation(int requestId) {
try {
stopOperation(requestId);
} catch(VoldemortException e) {
return e.getMessage();
}
return "Stopping operation " + requestId;
} | [
"@",
"JmxOperation",
"public",
"String",
"stopAsyncOperation",
"(",
"int",
"requestId",
")",
"{",
"try",
"{",
"stopOperation",
"(",
"requestId",
")",
";",
"}",
"catch",
"(",
"VoldemortException",
"e",
")",
"{",
"return",
"e",
".",
"getMessage",
"(",
")",
"... | Wrapper to avoid throwing an exception over JMX | [
"Wrapper",
"to",
"avoid",
"throwing",
"an",
"exception",
"over",
"JMX"
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/server/protocol/admin/AsyncOperationService.java#L177-L186 | train |
voldemort/voldemort | src/java/voldemort/store/retention/RetentionEnforcingStore.java | RetentionEnforcingStore.updateStoreDefinition | @Override
public void updateStoreDefinition(StoreDefinition storeDef) {
this.storeDef = storeDef;
if(storeDef.hasRetentionPeriod())
this.retentionTimeMs = storeDef.getRetentionDays() * Time.MS_PER_DAY;
} | java | @Override
public void updateStoreDefinition(StoreDefinition storeDef) {
this.storeDef = storeDef;
if(storeDef.hasRetentionPeriod())
this.retentionTimeMs = storeDef.getRetentionDays() * Time.MS_PER_DAY;
} | [
"@",
"Override",
"public",
"void",
"updateStoreDefinition",
"(",
"StoreDefinition",
"storeDef",
")",
"{",
"this",
".",
"storeDef",
"=",
"storeDef",
";",
"if",
"(",
"storeDef",
".",
"hasRetentionPeriod",
"(",
")",
")",
"this",
".",
"retentionTimeMs",
"=",
"stor... | Updates the store definition object and the retention time based on the
updated store definition | [
"Updates",
"the",
"store",
"definition",
"object",
"and",
"the",
"retention",
"time",
"based",
"on",
"the",
"updated",
"store",
"definition"
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/store/retention/RetentionEnforcingStore.java#L51-L56 | train |
voldemort/voldemort | src/java/voldemort/store/retention/RetentionEnforcingStore.java | RetentionEnforcingStore.filterExpiredEntries | private List<Versioned<byte[]>> filterExpiredEntries(ByteArray key, List<Versioned<byte[]>> vals) {
Iterator<Versioned<byte[]>> valsIterator = vals.iterator();
while(valsIterator.hasNext()) {
Versioned<byte[]> val = valsIterator.next();
VectorClock clock = (VectorClock) val.getVe... | java | private List<Versioned<byte[]>> filterExpiredEntries(ByteArray key, List<Versioned<byte[]>> vals) {
Iterator<Versioned<byte[]>> valsIterator = vals.iterator();
while(valsIterator.hasNext()) {
Versioned<byte[]> val = valsIterator.next();
VectorClock clock = (VectorClock) val.getVe... | [
"private",
"List",
"<",
"Versioned",
"<",
"byte",
"[",
"]",
">",
">",
"filterExpiredEntries",
"(",
"ByteArray",
"key",
",",
"List",
"<",
"Versioned",
"<",
"byte",
"[",
"]",
">",
">",
"vals",
")",
"{",
"Iterator",
"<",
"Versioned",
"<",
"byte",
"[",
"... | Performs the filtering of the expired entries based on retention time.
Optionally, deletes them also
@param key the key whose value is to be deleted if needed
@param vals set of values to be filtered out
@return filtered list of values which are currently valid | [
"Performs",
"the",
"filtering",
"of",
"the",
"expired",
"entries",
"based",
"on",
"retention",
"time",
".",
"Optionally",
"deletes",
"them",
"also"
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/store/retention/RetentionEnforcingStore.java#L66-L81 | train |
voldemort/voldemort | src/java/voldemort/store/configuration/FileBackedCachingStorageEngine.java | FileBackedCachingStorageEngine.flushData | private synchronized void flushData() {
BufferedWriter writer = null;
try {
writer = new BufferedWriter(new FileWriter(new File(this.inputPath)));
for(String key: this.metadataMap.keySet()) {
writer.write(NEW_PROPERTY_SEPARATOR + key.toString() + "]" + NEW_LINE);
... | java | private synchronized void flushData() {
BufferedWriter writer = null;
try {
writer = new BufferedWriter(new FileWriter(new File(this.inputPath)));
for(String key: this.metadataMap.keySet()) {
writer.write(NEW_PROPERTY_SEPARATOR + key.toString() + "]" + NEW_LINE);
... | [
"private",
"synchronized",
"void",
"flushData",
"(",
")",
"{",
"BufferedWriter",
"writer",
"=",
"null",
";",
"try",
"{",
"writer",
"=",
"new",
"BufferedWriter",
"(",
"new",
"FileWriter",
"(",
"new",
"File",
"(",
"this",
".",
"inputPath",
")",
")",
")",
"... | Flush the in-memory data to the file | [
"Flush",
"the",
"in",
"-",
"memory",
"data",
"to",
"the",
"file"
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/store/configuration/FileBackedCachingStorageEngine.java#L181-L202 | train |
voldemort/voldemort | src/java/voldemort/rest/RestUtils.java | RestUtils.getSerializedVectorClock | public static String getSerializedVectorClock(VectorClock vc) {
VectorClockWrapper vcWrapper = new VectorClockWrapper(vc);
String serializedVC = "";
try {
serializedVC = mapper.writeValueAsString(vcWrapper);
} catch(Exception e) {
e.printStackTrace();
}
... | java | public static String getSerializedVectorClock(VectorClock vc) {
VectorClockWrapper vcWrapper = new VectorClockWrapper(vc);
String serializedVC = "";
try {
serializedVC = mapper.writeValueAsString(vcWrapper);
} catch(Exception e) {
e.printStackTrace();
}
... | [
"public",
"static",
"String",
"getSerializedVectorClock",
"(",
"VectorClock",
"vc",
")",
"{",
"VectorClockWrapper",
"vcWrapper",
"=",
"new",
"VectorClockWrapper",
"(",
"vc",
")",
";",
"String",
"serializedVC",
"=",
"\"\"",
";",
"try",
"{",
"serializedVC",
"=",
"... | Function to serialize the given Vector clock into a string. If something
goes wrong, it returns an empty string.
@param vc The Vector clock to serialize
@return The string (JSON) version of the specified Vector clock | [
"Function",
"to",
"serialize",
"the",
"given",
"Vector",
"clock",
"into",
"a",
"string",
".",
"If",
"something",
"goes",
"wrong",
"it",
"returns",
"an",
"empty",
"string",
"."
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/rest/RestUtils.java#L40-L49 | train |
voldemort/voldemort | src/java/voldemort/rest/RestUtils.java | RestUtils.getSerializedVectorClocks | public static String getSerializedVectorClocks(List<VectorClock> vectorClocks) {
List<VectorClockWrapper> vectorClockWrappers = new ArrayList<VectorClockWrapper>();
for(VectorClock vc: vectorClocks) {
vectorClockWrappers.add(new VectorClockWrapper(vc));
}
String serializedVC ... | java | public static String getSerializedVectorClocks(List<VectorClock> vectorClocks) {
List<VectorClockWrapper> vectorClockWrappers = new ArrayList<VectorClockWrapper>();
for(VectorClock vc: vectorClocks) {
vectorClockWrappers.add(new VectorClockWrapper(vc));
}
String serializedVC ... | [
"public",
"static",
"String",
"getSerializedVectorClocks",
"(",
"List",
"<",
"VectorClock",
">",
"vectorClocks",
")",
"{",
"List",
"<",
"VectorClockWrapper",
">",
"vectorClockWrappers",
"=",
"new",
"ArrayList",
"<",
"VectorClockWrapper",
">",
"(",
")",
";",
"for",... | Function to serialize the given list of Vector clocks into a string. If
something goes wrong, it returns an empty string.
@param vectorClocks The Vector clock list to serialize
@return The string (JSON) version of the specified Vector clock | [
"Function",
"to",
"serialize",
"the",
"given",
"list",
"of",
"Vector",
"clocks",
"into",
"a",
"string",
".",
"If",
"something",
"goes",
"wrong",
"it",
"returns",
"an",
"empty",
"string",
"."
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/rest/RestUtils.java#L74-L86 | train |
voldemort/voldemort | src/java/voldemort/rest/RestUtils.java | RestUtils.constructSerializerInfoXml | public static String constructSerializerInfoXml(StoreDefinition storeDefinition) {
Element store = new Element(StoreDefinitionsMapper.STORE_ELMT);
store.addContent(new Element(StoreDefinitionsMapper.STORE_NAME_ELMT).setText(storeDefinition.getName()));
Element keySerializer = new Element(StoreDe... | java | public static String constructSerializerInfoXml(StoreDefinition storeDefinition) {
Element store = new Element(StoreDefinitionsMapper.STORE_ELMT);
store.addContent(new Element(StoreDefinitionsMapper.STORE_NAME_ELMT).setText(storeDefinition.getName()));
Element keySerializer = new Element(StoreDe... | [
"public",
"static",
"String",
"constructSerializerInfoXml",
"(",
"StoreDefinition",
"storeDefinition",
")",
"{",
"Element",
"store",
"=",
"new",
"Element",
"(",
"StoreDefinitionsMapper",
".",
"STORE_ELMT",
")",
";",
"store",
".",
"addContent",
"(",
"new",
"Element",... | Given a storedefinition, constructs the xml string to be sent out in
response to a "schemata" fetch request
@param storeDefinition
@return serialized store definition | [
"Given",
"a",
"storedefinition",
"constructs",
"the",
"xml",
"string",
"to",
"be",
"sent",
"out",
"in",
"response",
"to",
"a",
"schemata",
"fetch",
"request"
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/rest/RestUtils.java#L119-L132 | train |
voldemort/voldemort | src/java/voldemort/client/scheduler/AsyncMetadataVersionManager.java | AsyncMetadataVersionManager.updateMetadataVersions | public void updateMetadataVersions() {
Properties versionProps = MetadataVersionStoreUtils.getProperties(this.systemStoreRepository.getMetadataVersionStore());
Long newVersion = fetchNewVersion(SystemStoreConstants.CLUSTER_VERSION_KEY,
null,
... | java | public void updateMetadataVersions() {
Properties versionProps = MetadataVersionStoreUtils.getProperties(this.systemStoreRepository.getMetadataVersionStore());
Long newVersion = fetchNewVersion(SystemStoreConstants.CLUSTER_VERSION_KEY,
null,
... | [
"public",
"void",
"updateMetadataVersions",
"(",
")",
"{",
"Properties",
"versionProps",
"=",
"MetadataVersionStoreUtils",
".",
"getProperties",
"(",
"this",
".",
"systemStoreRepository",
".",
"getMetadataVersionStore",
"(",
")",
")",
";",
"Long",
"newVersion",
"=",
... | Fetch the latest versions for cluster metadata | [
"Fetch",
"the",
"latest",
"versions",
"for",
"cluster",
"metadata"
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/client/scheduler/AsyncMetadataVersionManager.java#L203-L211 | train |
voldemort/voldemort | src/java/voldemort/utils/RebalanceUtils.java | RebalanceUtils.validateClusterStores | public static void validateClusterStores(final Cluster cluster,
final List<StoreDefinition> storeDefs) {
// Constructing a StoreRoutingPlan has the (desirable in this
// case) side-effect of verifying that the store definition is congruent
// with the... | java | public static void validateClusterStores(final Cluster cluster,
final List<StoreDefinition> storeDefs) {
// Constructing a StoreRoutingPlan has the (desirable in this
// case) side-effect of verifying that the store definition is congruent
// with the... | [
"public",
"static",
"void",
"validateClusterStores",
"(",
"final",
"Cluster",
"cluster",
",",
"final",
"List",
"<",
"StoreDefinition",
">",
"storeDefs",
")",
"{",
"// Constructing a StoreRoutingPlan has the (desirable in this",
"// case) side-effect of verifying that the store de... | Verify store definitions are congruent with cluster definition.
@param cluster
@param storeDefs | [
"Verify",
"store",
"definitions",
"are",
"congruent",
"with",
"cluster",
"definition",
"."
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/utils/RebalanceUtils.java#L76-L86 | train |
voldemort/voldemort | src/java/voldemort/utils/RebalanceUtils.java | RebalanceUtils.validateCurrentFinalCluster | public static void validateCurrentFinalCluster(final Cluster currentCluster,
final Cluster finalCluster) {
validateClusterPartitionCounts(currentCluster, finalCluster);
validateClusterNodeState(currentCluster, finalCluster);
return;
} | java | public static void validateCurrentFinalCluster(final Cluster currentCluster,
final Cluster finalCluster) {
validateClusterPartitionCounts(currentCluster, finalCluster);
validateClusterNodeState(currentCluster, finalCluster);
return;
} | [
"public",
"static",
"void",
"validateCurrentFinalCluster",
"(",
"final",
"Cluster",
"currentCluster",
",",
"final",
"Cluster",
"finalCluster",
")",
"{",
"validateClusterPartitionCounts",
"(",
"currentCluster",
",",
"finalCluster",
")",
";",
"validateClusterNodeState",
"("... | A final cluster ought to be a super set of current cluster. I.e.,
existing node IDs ought to map to same server, but partition layout can
have changed and there may exist new nodes.
@param currentCluster
@param finalCluster | [
"A",
"final",
"cluster",
"ought",
"to",
"be",
"a",
"super",
"set",
"of",
"current",
"cluster",
".",
"I",
".",
"e",
".",
"existing",
"node",
"IDs",
"ought",
"to",
"map",
"to",
"same",
"server",
"but",
"partition",
"layout",
"can",
"have",
"changed",
"an... | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/utils/RebalanceUtils.java#L102-L108 | train |
voldemort/voldemort | src/java/voldemort/utils/RebalanceUtils.java | RebalanceUtils.validateInterimFinalCluster | public static void validateInterimFinalCluster(final Cluster interimCluster,
final Cluster finalCluster) {
validateClusterPartitionCounts(interimCluster, finalCluster);
validateClusterZonesSame(interimCluster, finalCluster);
validateClusterNodeC... | java | public static void validateInterimFinalCluster(final Cluster interimCluster,
final Cluster finalCluster) {
validateClusterPartitionCounts(interimCluster, finalCluster);
validateClusterZonesSame(interimCluster, finalCluster);
validateClusterNodeC... | [
"public",
"static",
"void",
"validateInterimFinalCluster",
"(",
"final",
"Cluster",
"interimCluster",
",",
"final",
"Cluster",
"finalCluster",
")",
"{",
"validateClusterPartitionCounts",
"(",
"interimCluster",
",",
"finalCluster",
")",
";",
"validateClusterZonesSame",
"("... | Interim and final clusters ought to have same partition counts, same
zones, and same node state. Partitions per node may of course differ.
@param interimCluster
@param finalCluster | [
"Interim",
"and",
"final",
"clusters",
"ought",
"to",
"have",
"same",
"partition",
"counts",
"same",
"zones",
"and",
"same",
"node",
"state",
".",
"Partitions",
"per",
"node",
"may",
"of",
"course",
"differ",
"."
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/utils/RebalanceUtils.java#L135-L142 | train |
voldemort/voldemort | src/java/voldemort/utils/RebalanceUtils.java | RebalanceUtils.validateClusterPartitionCounts | public static void validateClusterPartitionCounts(final Cluster lhs, final Cluster rhs) {
if(lhs.getNumberOfPartitions() != rhs.getNumberOfPartitions())
throw new VoldemortException("Total number of partitions should be equal [ lhs cluster ("
+ lhs.getNumberO... | java | public static void validateClusterPartitionCounts(final Cluster lhs, final Cluster rhs) {
if(lhs.getNumberOfPartitions() != rhs.getNumberOfPartitions())
throw new VoldemortException("Total number of partitions should be equal [ lhs cluster ("
+ lhs.getNumberO... | [
"public",
"static",
"void",
"validateClusterPartitionCounts",
"(",
"final",
"Cluster",
"lhs",
",",
"final",
"Cluster",
"rhs",
")",
"{",
"if",
"(",
"lhs",
".",
"getNumberOfPartitions",
"(",
")",
"!=",
"rhs",
".",
"getNumberOfPartitions",
"(",
")",
")",
"throw",... | Confirms that both clusters have the same number of total partitions.
@param lhs
@param rhs | [
"Confirms",
"that",
"both",
"clusters",
"have",
"the",
"same",
"number",
"of",
"total",
"partitions",
"."
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/utils/RebalanceUtils.java#L150-L156 | train |
voldemort/voldemort | src/java/voldemort/utils/RebalanceUtils.java | RebalanceUtils.validateClusterPartitionState | public static void validateClusterPartitionState(final Cluster subsetCluster,
final Cluster supersetCluster) {
if(!supersetCluster.getNodeIds().containsAll(subsetCluster.getNodeIds())) {
throw new VoldemortException("Superset cluster does not cont... | java | public static void validateClusterPartitionState(final Cluster subsetCluster,
final Cluster supersetCluster) {
if(!supersetCluster.getNodeIds().containsAll(subsetCluster.getNodeIds())) {
throw new VoldemortException("Superset cluster does not cont... | [
"public",
"static",
"void",
"validateClusterPartitionState",
"(",
"final",
"Cluster",
"subsetCluster",
",",
"final",
"Cluster",
"supersetCluster",
")",
"{",
"if",
"(",
"!",
"supersetCluster",
".",
"getNodeIds",
"(",
")",
".",
"containsAll",
"(",
"subsetCluster",
"... | Confirm that all nodes shared between clusters host exact same partition
IDs and that nodes only in the super set cluster have no partition IDs.
@param subsetCluster
@param supersetCluster | [
"Confirm",
"that",
"all",
"nodes",
"shared",
"between",
"clusters",
"host",
"exact",
"same",
"partition",
"IDs",
"and",
"that",
"nodes",
"only",
"in",
"the",
"super",
"set",
"cluster",
"have",
"no",
"partition",
"IDs",
"."
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/utils/RebalanceUtils.java#L165-L197 | train |
voldemort/voldemort | src/java/voldemort/utils/RebalanceUtils.java | RebalanceUtils.validateClusterZonesSame | public static void validateClusterZonesSame(final Cluster lhs, final Cluster rhs) {
Set<Zone> lhsSet = new HashSet<Zone>(lhs.getZones());
Set<Zone> rhsSet = new HashSet<Zone>(rhs.getZones());
if(!lhsSet.equals(rhsSet))
throw new VoldemortException("Zones are not the same [ lhs cluste... | java | public static void validateClusterZonesSame(final Cluster lhs, final Cluster rhs) {
Set<Zone> lhsSet = new HashSet<Zone>(lhs.getZones());
Set<Zone> rhsSet = new HashSet<Zone>(rhs.getZones());
if(!lhsSet.equals(rhsSet))
throw new VoldemortException("Zones are not the same [ lhs cluste... | [
"public",
"static",
"void",
"validateClusterZonesSame",
"(",
"final",
"Cluster",
"lhs",
",",
"final",
"Cluster",
"rhs",
")",
"{",
"Set",
"<",
"Zone",
">",
"lhsSet",
"=",
"new",
"HashSet",
"<",
"Zone",
">",
"(",
"lhs",
".",
"getZones",
"(",
")",
")",
";... | Confirms that both clusters have the same set of zones defined.
@param lhs
@param rhs | [
"Confirms",
"that",
"both",
"clusters",
"have",
"the",
"same",
"set",
"of",
"zones",
"defined",
"."
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/utils/RebalanceUtils.java#L205-L212 | train |
voldemort/voldemort | src/java/voldemort/utils/RebalanceUtils.java | RebalanceUtils.validateClusterNodeCounts | public static void validateClusterNodeCounts(final Cluster lhs, final Cluster rhs) {
if(!lhs.getNodeIds().equals(rhs.getNodeIds())) {
throw new VoldemortException("Node ids are not the same [ lhs cluster node ids ("
+ lhs.getNodeIds()
... | java | public static void validateClusterNodeCounts(final Cluster lhs, final Cluster rhs) {
if(!lhs.getNodeIds().equals(rhs.getNodeIds())) {
throw new VoldemortException("Node ids are not the same [ lhs cluster node ids ("
+ lhs.getNodeIds()
... | [
"public",
"static",
"void",
"validateClusterNodeCounts",
"(",
"final",
"Cluster",
"lhs",
",",
"final",
"Cluster",
"rhs",
")",
"{",
"if",
"(",
"!",
"lhs",
".",
"getNodeIds",
"(",
")",
".",
"equals",
"(",
"rhs",
".",
"getNodeIds",
"(",
")",
")",
")",
"{"... | Confirms that both clusters have the same number of nodes by comparing
set of node Ids between clusters.
@param lhs
@param rhs | [
"Confirms",
"that",
"both",
"clusters",
"have",
"the",
"same",
"number",
"of",
"nodes",
"by",
"comparing",
"set",
"of",
"node",
"Ids",
"between",
"clusters",
"."
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/utils/RebalanceUtils.java#L221-L228 | train |
voldemort/voldemort | src/java/voldemort/utils/RebalanceUtils.java | RebalanceUtils.vacateZone | public static Cluster vacateZone(Cluster currentCluster, int dropZoneId) {
Cluster returnCluster = Cluster.cloneCluster(currentCluster);
// Go over each node in the zone being dropped
for(Integer nodeId: currentCluster.getNodeIdsInZone(dropZoneId)) {
// For each node grab all the par... | java | public static Cluster vacateZone(Cluster currentCluster, int dropZoneId) {
Cluster returnCluster = Cluster.cloneCluster(currentCluster);
// Go over each node in the zone being dropped
for(Integer nodeId: currentCluster.getNodeIdsInZone(dropZoneId)) {
// For each node grab all the par... | [
"public",
"static",
"Cluster",
"vacateZone",
"(",
"Cluster",
"currentCluster",
",",
"int",
"dropZoneId",
")",
"{",
"Cluster",
"returnCluster",
"=",
"Cluster",
".",
"cloneCluster",
"(",
"currentCluster",
")",
";",
"// Go over each node in the zone being dropped",
"for",
... | Given the current cluster and a zone id that needs to be dropped, this
method will remove all partitions from the zone that is being dropped and
move it to the existing zones. The partitions are moved intelligently so
as not to avoid any data movement in the existing zones.
This is achieved by moving the partitions to... | [
"Given",
"the",
"current",
"cluster",
"and",
"a",
"zone",
"id",
"that",
"needs",
"to",
"be",
"dropped",
"this",
"method",
"will",
"remove",
"all",
"partitions",
"from",
"the",
"zone",
"that",
"is",
"being",
"dropped",
"and",
"move",
"it",
"to",
"the",
"e... | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/utils/RebalanceUtils.java#L295-L325 | train |
voldemort/voldemort | src/java/voldemort/utils/RebalanceUtils.java | RebalanceUtils.dropZone | public static Cluster dropZone(Cluster intermediateCluster, int dropZoneId) {
// Filter out nodes that don't belong to the zone being dropped
Set<Node> survivingNodes = new HashSet<Node>();
for(int nodeId: intermediateCluster.getNodeIds()) {
if(intermediateCluster.getNodeById(nodeId)... | java | public static Cluster dropZone(Cluster intermediateCluster, int dropZoneId) {
// Filter out nodes that don't belong to the zone being dropped
Set<Node> survivingNodes = new HashSet<Node>();
for(int nodeId: intermediateCluster.getNodeIds()) {
if(intermediateCluster.getNodeById(nodeId)... | [
"public",
"static",
"Cluster",
"dropZone",
"(",
"Cluster",
"intermediateCluster",
",",
"int",
"dropZoneId",
")",
"{",
"// Filter out nodes that don't belong to the zone being dropped",
"Set",
"<",
"Node",
">",
"survivingNodes",
"=",
"new",
"HashSet",
"<",
"Node",
">",
... | Given a interim cluster with a previously vacated zone, constructs a new
cluster object with the drop zone completely removed
@param intermediateCluster
@param dropZoneId
@return adjusted cluster with the zone dropped | [
"Given",
"a",
"interim",
"cluster",
"with",
"a",
"previously",
"vacated",
"zone",
"constructs",
"a",
"new",
"cluster",
"object",
"with",
"the",
"drop",
"zone",
"completely",
"removed"
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/utils/RebalanceUtils.java#L335-L359 | train |
voldemort/voldemort | src/java/voldemort/utils/RebalanceUtils.java | RebalanceUtils.getStolenPrimaryPartitions | public static List<Integer> getStolenPrimaryPartitions(final Cluster currentCluster,
final Cluster finalCluster,
final int stealNodeId) {
List<Integer> finalList = new ArrayList<Integer>(finalCl... | java | public static List<Integer> getStolenPrimaryPartitions(final Cluster currentCluster,
final Cluster finalCluster,
final int stealNodeId) {
List<Integer> finalList = new ArrayList<Integer>(finalCl... | [
"public",
"static",
"List",
"<",
"Integer",
">",
"getStolenPrimaryPartitions",
"(",
"final",
"Cluster",
"currentCluster",
",",
"final",
"Cluster",
"finalCluster",
",",
"final",
"int",
"stealNodeId",
")",
"{",
"List",
"<",
"Integer",
">",
"finalList",
"=",
"new",... | For a particular stealer node find all the primary partitions tuples it
will steal.
@param currentCluster The cluster definition of the existing cluster
@param finalCluster The final cluster definition
@param stealNodeId Node id of the stealer node
@return Returns a list of primary partitions which this stealer node w... | [
"For",
"a",
"particular",
"stealer",
"node",
"find",
"all",
"the",
"primary",
"partitions",
"tuples",
"it",
"will",
"steal",
"."
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/utils/RebalanceUtils.java#L425-L443 | train |
voldemort/voldemort | src/java/voldemort/utils/RebalanceUtils.java | RebalanceUtils.validateRebalanceStore | public static List<StoreDefinition> validateRebalanceStore(List<StoreDefinition> storeDefList) {
List<StoreDefinition> returnList = new ArrayList<StoreDefinition>(storeDefList.size());
for(StoreDefinition def: storeDefList) {
if(!def.isView() && !canRebalanceList.contains(def.getType())) {
... | java | public static List<StoreDefinition> validateRebalanceStore(List<StoreDefinition> storeDefList) {
List<StoreDefinition> returnList = new ArrayList<StoreDefinition>(storeDefList.size());
for(StoreDefinition def: storeDefList) {
if(!def.isView() && !canRebalanceList.contains(def.getType())) {
... | [
"public",
"static",
"List",
"<",
"StoreDefinition",
">",
"validateRebalanceStore",
"(",
"List",
"<",
"StoreDefinition",
">",
"storeDefList",
")",
"{",
"List",
"<",
"StoreDefinition",
">",
"returnList",
"=",
"new",
"ArrayList",
"<",
"StoreDefinition",
">",
"(",
"... | Given a list of store definitions, makes sure that rebalance supports all
of them. If not it throws an error.
@param storeDefList List of store definitions
@return Filtered list of store definitions which rebalancing supports | [
"Given",
"a",
"list",
"of",
"store",
"definitions",
"makes",
"sure",
"that",
"rebalance",
"supports",
"all",
"of",
"them",
".",
"If",
"not",
"it",
"throws",
"an",
"error",
"."
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/utils/RebalanceUtils.java#L490-L504 | train |
voldemort/voldemort | src/java/voldemort/utils/RebalanceUtils.java | RebalanceUtils.dumpClusters | public static void dumpClusters(Cluster currentCluster,
Cluster finalCluster,
String outputDirName,
String filePrefix) {
dumpClusterToFile(outputDirName, filePrefix + currentClusterFileName, currentCluste... | java | public static void dumpClusters(Cluster currentCluster,
Cluster finalCluster,
String outputDirName,
String filePrefix) {
dumpClusterToFile(outputDirName, filePrefix + currentClusterFileName, currentCluste... | [
"public",
"static",
"void",
"dumpClusters",
"(",
"Cluster",
"currentCluster",
",",
"Cluster",
"finalCluster",
",",
"String",
"outputDirName",
",",
"String",
"filePrefix",
")",
"{",
"dumpClusterToFile",
"(",
"outputDirName",
",",
"filePrefix",
"+",
"currentClusterFileN... | Given the initial and final cluster dumps it into the output directory
@param currentCluster Initial cluster metadata
@param finalCluster Final cluster metadata
@param outputDirName Output directory where to dump this file
@param filePrefix String to prepend to the initial & final cluster
metadata files
@throws IOExce... | [
"Given",
"the",
"initial",
"and",
"final",
"cluster",
"dumps",
"it",
"into",
"the",
"output",
"directory"
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/utils/RebalanceUtils.java#L516-L522 | train |
voldemort/voldemort | src/java/voldemort/utils/RebalanceUtils.java | RebalanceUtils.dumpClusters | public static void dumpClusters(Cluster currentCluster,
Cluster finalCluster,
String outputDirName) {
dumpClusters(currentCluster, finalCluster, outputDirName, "");
} | java | public static void dumpClusters(Cluster currentCluster,
Cluster finalCluster,
String outputDirName) {
dumpClusters(currentCluster, finalCluster, outputDirName, "");
} | [
"public",
"static",
"void",
"dumpClusters",
"(",
"Cluster",
"currentCluster",
",",
"Cluster",
"finalCluster",
",",
"String",
"outputDirName",
")",
"{",
"dumpClusters",
"(",
"currentCluster",
",",
"finalCluster",
",",
"outputDirName",
",",
"\"\"",
")",
";",
"}"
] | Given the current and final cluster dumps it into the output directory
@param currentCluster Initial cluster metadata
@param finalCluster Final cluster metadata
@param outputDirName Output directory where to dump this file
@throws IOException | [
"Given",
"the",
"current",
"and",
"final",
"cluster",
"dumps",
"it",
"into",
"the",
"output",
"directory"
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/utils/RebalanceUtils.java#L532-L536 | train |
voldemort/voldemort | src/java/voldemort/utils/RebalanceUtils.java | RebalanceUtils.dumpClusterToFile | public static void dumpClusterToFile(String outputDirName, String fileName, Cluster cluster) {
if(outputDirName != null) {
File outputDir = new File(outputDirName);
if(!outputDir.exists()) {
Utils.mkdirs(outputDir);
}
try {
FileUt... | java | public static void dumpClusterToFile(String outputDirName, String fileName, Cluster cluster) {
if(outputDirName != null) {
File outputDir = new File(outputDirName);
if(!outputDir.exists()) {
Utils.mkdirs(outputDir);
}
try {
FileUt... | [
"public",
"static",
"void",
"dumpClusterToFile",
"(",
"String",
"outputDirName",
",",
"String",
"fileName",
",",
"Cluster",
"cluster",
")",
"{",
"if",
"(",
"outputDirName",
"!=",
"null",
")",
"{",
"File",
"outputDir",
"=",
"new",
"File",
"(",
"outputDirName",
... | Prints a cluster xml to a file.
@param outputDirName
@param fileName
@param cluster | [
"Prints",
"a",
"cluster",
"xml",
"to",
"a",
"file",
"."
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/utils/RebalanceUtils.java#L545-L560 | train |
voldemort/voldemort | src/java/voldemort/utils/RebalanceUtils.java | RebalanceUtils.dumpStoreDefsToFile | public static void dumpStoreDefsToFile(String outputDirName,
String fileName,
List<StoreDefinition> storeDefs) {
if(outputDirName != null) {
File outputDir = new File(outputDirName);
if(!outputDir.exis... | java | public static void dumpStoreDefsToFile(String outputDirName,
String fileName,
List<StoreDefinition> storeDefs) {
if(outputDirName != null) {
File outputDir = new File(outputDirName);
if(!outputDir.exis... | [
"public",
"static",
"void",
"dumpStoreDefsToFile",
"(",
"String",
"outputDirName",
",",
"String",
"fileName",
",",
"List",
"<",
"StoreDefinition",
">",
"storeDefs",
")",
"{",
"if",
"(",
"outputDirName",
"!=",
"null",
")",
"{",
"File",
"outputDir",
"=",
"new",
... | Prints a stores xml to a file.
@param outputDirName
@param fileName
@param list of storeDefs | [
"Prints",
"a",
"stores",
"xml",
"to",
"a",
"file",
"."
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/utils/RebalanceUtils.java#L569-L586 | train |
voldemort/voldemort | src/java/voldemort/utils/RebalanceUtils.java | RebalanceUtils.dumpAnalysisToFile | public static void dumpAnalysisToFile(String outputDirName,
String baseFileName,
PartitionBalance partitionBalance) {
if(outputDirName != null) {
File outputDir = new File(outputDirName);
if(!outputDir.ex... | java | public static void dumpAnalysisToFile(String outputDirName,
String baseFileName,
PartitionBalance partitionBalance) {
if(outputDirName != null) {
File outputDir = new File(outputDirName);
if(!outputDir.ex... | [
"public",
"static",
"void",
"dumpAnalysisToFile",
"(",
"String",
"outputDirName",
",",
"String",
"baseFileName",
",",
"PartitionBalance",
"partitionBalance",
")",
"{",
"if",
"(",
"outputDirName",
"!=",
"null",
")",
"{",
"File",
"outputDir",
"=",
"new",
"File",
"... | Prints a balance analysis to a file.
@param outputDirName
@param baseFileName suffix '.analysis' is appended to baseFileName.
@param partitionBalance | [
"Prints",
"a",
"balance",
"analysis",
"to",
"a",
"file",
"."
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/utils/RebalanceUtils.java#L595-L611 | train |
voldemort/voldemort | src/java/voldemort/utils/RebalanceUtils.java | RebalanceUtils.dumpPlanToFile | public static void dumpPlanToFile(String outputDirName, RebalancePlan plan) {
if(outputDirName != null) {
File outputDir = new File(outputDirName);
if(!outputDir.exists()) {
Utils.mkdirs(outputDir);
}
try {
FileUtils.writeStringToFi... | java | public static void dumpPlanToFile(String outputDirName, RebalancePlan plan) {
if(outputDirName != null) {
File outputDir = new File(outputDirName);
if(!outputDir.exists()) {
Utils.mkdirs(outputDir);
}
try {
FileUtils.writeStringToFi... | [
"public",
"static",
"void",
"dumpPlanToFile",
"(",
"String",
"outputDirName",
",",
"RebalancePlan",
"plan",
")",
"{",
"if",
"(",
"outputDirName",
"!=",
"null",
")",
"{",
"File",
"outputDir",
"=",
"new",
"File",
"(",
"outputDirName",
")",
";",
"if",
"(",
"!... | Prints the plan to a file.
@param outputDirName
@param plan | [
"Prints",
"the",
"plan",
"to",
"a",
"file",
"."
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/utils/RebalanceUtils.java#L619-L631 | train |
voldemort/voldemort | src/java/voldemort/utils/RebalanceUtils.java | RebalanceUtils.filterTaskPlanWithStores | public static List<RebalanceTaskInfo> filterTaskPlanWithStores(List<RebalanceTaskInfo> existingPlanList,
List<StoreDefinition> storeDefs) {
List<RebalanceTaskInfo> plans = Lists.newArrayList();
List<String> storeNames = StoreDefinitionUt... | java | public static List<RebalanceTaskInfo> filterTaskPlanWithStores(List<RebalanceTaskInfo> existingPlanList,
List<StoreDefinition> storeDefs) {
List<RebalanceTaskInfo> plans = Lists.newArrayList();
List<String> storeNames = StoreDefinitionUt... | [
"public",
"static",
"List",
"<",
"RebalanceTaskInfo",
">",
"filterTaskPlanWithStores",
"(",
"List",
"<",
"RebalanceTaskInfo",
">",
"existingPlanList",
",",
"List",
"<",
"StoreDefinition",
">",
"storeDefs",
")",
"{",
"List",
"<",
"RebalanceTaskInfo",
">",
"plans",
... | Given a list of partition plans and a set of stores, copies the store
names to every individual plan and creates a new list
@param existingPlanList Existing partition plan list
@param storeDefs List of store names we are rebalancing
@return List of updated partition plan | [
"Given",
"a",
"list",
"of",
"partition",
"plans",
"and",
"a",
"set",
"of",
"stores",
"copies",
"the",
"store",
"names",
"to",
"every",
"individual",
"plan",
"and",
"creates",
"a",
"new",
"list"
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/utils/RebalanceUtils.java#L649-L669 | train |
voldemort/voldemort | src/java/voldemort/utils/RebalanceUtils.java | RebalanceUtils.executorShutDown | public static void executorShutDown(ExecutorService executorService, long timeOutSec) {
try {
executorService.shutdown();
executorService.awaitTermination(timeOutSec, TimeUnit.SECONDS);
} catch(Exception e) {
logger.warn("Error while stoping executor service.", e);
... | java | public static void executorShutDown(ExecutorService executorService, long timeOutSec) {
try {
executorService.shutdown();
executorService.awaitTermination(timeOutSec, TimeUnit.SECONDS);
} catch(Exception e) {
logger.warn("Error while stoping executor service.", e);
... | [
"public",
"static",
"void",
"executorShutDown",
"(",
"ExecutorService",
"executorService",
",",
"long",
"timeOutSec",
")",
"{",
"try",
"{",
"executorService",
".",
"shutdown",
"(",
")",
";",
"executorService",
".",
"awaitTermination",
"(",
"timeOutSec",
",",
"Time... | Wait to shutdown service
@param executorService Executor service to shutdown
@param timeOutSec Time we wait for | [
"Wait",
"to",
"shutdown",
"service"
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/utils/RebalanceUtils.java#L704-L711 | train |
voldemort/voldemort | src/java/voldemort/versioning/ArbitraryInconsistencyResolver.java | ArbitraryInconsistencyResolver.resolveConflicts | public List<T> resolveConflicts(List<T> values) {
if(values.size() > 1)
return values;
else
return Collections.singletonList(values.get(0));
} | java | public List<T> resolveConflicts(List<T> values) {
if(values.size() > 1)
return values;
else
return Collections.singletonList(values.get(0));
} | [
"public",
"List",
"<",
"T",
">",
"resolveConflicts",
"(",
"List",
"<",
"T",
">",
"values",
")",
"{",
"if",
"(",
"values",
".",
"size",
"(",
")",
">",
"1",
")",
"return",
"values",
";",
"else",
"return",
"Collections",
".",
"singletonList",
"(",
"valu... | Arbitrarily resolve the inconsistency by choosing the first object if
there is one.
@param values The list of objects
@return A single value, if one exists, taken from the input list. | [
"Arbitrarily",
"resolve",
"the",
"inconsistency",
"by",
"choosing",
"the",
"first",
"object",
"if",
"there",
"is",
"one",
"."
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/versioning/ArbitraryInconsistencyResolver.java#L37-L42 | train |
voldemort/voldemort | src/java/voldemort/store/StoreUtils.java | StoreUtils.get | public static <K, V, T> List<Versioned<V>> get(Store<K, V, T> storageEngine, K key, T transform) {
Map<K, List<Versioned<V>>> result = storageEngine.getAll(Collections.singleton(key),
Collections.singletonMap(key,
... | java | public static <K, V, T> List<Versioned<V>> get(Store<K, V, T> storageEngine, K key, T transform) {
Map<K, List<Versioned<V>>> result = storageEngine.getAll(Collections.singleton(key),
Collections.singletonMap(key,
... | [
"public",
"static",
"<",
"K",
",",
"V",
",",
"T",
">",
"List",
"<",
"Versioned",
"<",
"V",
">",
">",
"get",
"(",
"Store",
"<",
"K",
",",
"V",
",",
"T",
">",
"storageEngine",
",",
"K",
"key",
",",
"T",
"transform",
")",
"{",
"Map",
"<",
"K",
... | Implements get by delegating to getAll. | [
"Implements",
"get",
"by",
"delegating",
"to",
"getAll",
"."
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/store/StoreUtils.java#L68-L76 | train |
voldemort/voldemort | src/java/voldemort/store/StoreUtils.java | StoreUtils.getAll | public static <K, V, T> Map<K, List<Versioned<V>>> getAll(Store<K, V, T> storageEngine,
Iterable<K> keys,
Map<K, T> transforms) {
Map<K, List<Versioned<V>>> result = newEmptyHashMap(keys);... | java | public static <K, V, T> Map<K, List<Versioned<V>>> getAll(Store<K, V, T> storageEngine,
Iterable<K> keys,
Map<K, T> transforms) {
Map<K, List<Versioned<V>>> result = newEmptyHashMap(keys);... | [
"public",
"static",
"<",
"K",
",",
"V",
",",
"T",
">",
"Map",
"<",
"K",
",",
"List",
"<",
"Versioned",
"<",
"V",
">",
">",
">",
"getAll",
"(",
"Store",
"<",
"K",
",",
"V",
",",
"T",
">",
"storageEngine",
",",
"Iterable",
"<",
"K",
">",
"keys"... | Implements getAll by delegating to get. | [
"Implements",
"getAll",
"by",
"delegating",
"to",
"get",
"."
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/store/StoreUtils.java#L81-L93 | train |
voldemort/voldemort | src/java/voldemort/store/StoreUtils.java | StoreUtils.newEmptyHashMap | public static <K, V> HashMap<K, V> newEmptyHashMap(Iterable<?> iterable) {
if(iterable instanceof Collection<?>)
return Maps.newHashMapWithExpectedSize(((Collection<?>) iterable).size());
return Maps.newHashMap();
} | java | public static <K, V> HashMap<K, V> newEmptyHashMap(Iterable<?> iterable) {
if(iterable instanceof Collection<?>)
return Maps.newHashMapWithExpectedSize(((Collection<?>) iterable).size());
return Maps.newHashMap();
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"HashMap",
"<",
"K",
",",
"V",
">",
"newEmptyHashMap",
"(",
"Iterable",
"<",
"?",
">",
"iterable",
")",
"{",
"if",
"(",
"iterable",
"instanceof",
"Collection",
"<",
"?",
">",
")",
"return",
"Maps",
".",
... | Returns an empty map with expected size matching the iterable size if
it's of type Collection. Otherwise, an empty map with the default size is
returned. | [
"Returns",
"an",
"empty",
"map",
"with",
"expected",
"size",
"matching",
"the",
"iterable",
"size",
"if",
"it",
"s",
"of",
"type",
"Collection",
".",
"Otherwise",
"an",
"empty",
"map",
"with",
"the",
"default",
"size",
"is",
"returned",
"."
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/store/StoreUtils.java#L100-L104 | train |
voldemort/voldemort | src/java/voldemort/store/StoreUtils.java | StoreUtils.assertValidMetadata | public static void assertValidMetadata(ByteArray key,
RoutingStrategy routingStrategy,
Node currentNode) {
List<Node> nodes = routingStrategy.routeRequest(key.get());
for(Node node: nodes) {
if(node.getId()... | java | public static void assertValidMetadata(ByteArray key,
RoutingStrategy routingStrategy,
Node currentNode) {
List<Node> nodes = routingStrategy.routeRequest(key.get());
for(Node node: nodes) {
if(node.getId()... | [
"public",
"static",
"void",
"assertValidMetadata",
"(",
"ByteArray",
"key",
",",
"RoutingStrategy",
"routingStrategy",
",",
"Node",
"currentNode",
")",
"{",
"List",
"<",
"Node",
">",
"nodes",
"=",
"routingStrategy",
".",
"routeRequest",
"(",
"key",
".",
"get",
... | Check if the current node is part of routing request based on cluster.xml
or throw an exception.
@param key The key we are checking
@param routingStrategy The routing strategy
@param currentNode Current node | [
"Check",
"if",
"the",
"current",
"node",
"is",
"part",
"of",
"routing",
"request",
"based",
"on",
"cluster",
".",
"xml",
"or",
"throw",
"an",
"exception",
"."
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/store/StoreUtils.java#L133-L146 | train |
voldemort/voldemort | src/java/voldemort/store/StoreUtils.java | StoreUtils.assertValidNode | public static void assertValidNode(MetadataStore metadataStore, Integer nodeId) {
if(!metadataStore.getCluster().hasNodeWithId(nodeId)) {
throw new InvalidMetadataException("NodeId " + nodeId + " is not or no longer in this cluster");
}
} | java | public static void assertValidNode(MetadataStore metadataStore, Integer nodeId) {
if(!metadataStore.getCluster().hasNodeWithId(nodeId)) {
throw new InvalidMetadataException("NodeId " + nodeId + " is not or no longer in this cluster");
}
} | [
"public",
"static",
"void",
"assertValidNode",
"(",
"MetadataStore",
"metadataStore",
",",
"Integer",
"nodeId",
")",
"{",
"if",
"(",
"!",
"metadataStore",
".",
"getCluster",
"(",
")",
".",
"hasNodeWithId",
"(",
"nodeId",
")",
")",
"{",
"throw",
"new",
"Inval... | Check if the the nodeId is present in the cluster managed by the metadata store
or throw an exception.
@param nodeId The nodeId to check existence of | [
"Check",
"if",
"the",
"the",
"nodeId",
"is",
"present",
"in",
"the",
"cluster",
"managed",
"by",
"the",
"metadata",
"store",
"or",
"throw",
"an",
"exception",
"."
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/store/StoreUtils.java#L154-L158 | train |
voldemort/voldemort | src/java/voldemort/store/StoreUtils.java | StoreUtils.unsafeGetSerializer | @SuppressWarnings("unchecked")
public static <T> Serializer<T> unsafeGetSerializer(SerializerFactory serializerFactory,
SerializerDefinition serializerDefinition) {
return (Serializer<T>) serializerFactory.getSerializer(serializerDefinition);
} | java | @SuppressWarnings("unchecked")
public static <T> Serializer<T> unsafeGetSerializer(SerializerFactory serializerFactory,
SerializerDefinition serializerDefinition) {
return (Serializer<T>) serializerFactory.getSerializer(serializerDefinition);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"Serializer",
"<",
"T",
">",
"unsafeGetSerializer",
"(",
"SerializerFactory",
"serializerFactory",
",",
"SerializerDefinition",
"serializerDefinition",
")",
"{",
"return",
"(",
"S... | This is a temporary measure until we have a type-safe solution for
retrieving serializers from a SerializerFactory. It avoids warnings all
over the codebase while making it easy to verify who calls it. | [
"This",
"is",
"a",
"temporary",
"measure",
"until",
"we",
"have",
"a",
"type",
"-",
"safe",
"solution",
"for",
"retrieving",
"serializers",
"from",
"a",
"SerializerFactory",
".",
"It",
"avoids",
"warnings",
"all",
"over",
"the",
"codebase",
"while",
"making",
... | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/store/StoreUtils.java#L197-L201 | train |
voldemort/voldemort | src/java/voldemort/store/StoreUtils.java | StoreUtils.getStoreDef | public static StoreDefinition getStoreDef(List<StoreDefinition> list, String name) {
for(StoreDefinition def: list)
if(def.getName().equals(name))
return def;
return null;
} | java | public static StoreDefinition getStoreDef(List<StoreDefinition> list, String name) {
for(StoreDefinition def: list)
if(def.getName().equals(name))
return def;
return null;
} | [
"public",
"static",
"StoreDefinition",
"getStoreDef",
"(",
"List",
"<",
"StoreDefinition",
">",
"list",
",",
"String",
"name",
")",
"{",
"for",
"(",
"StoreDefinition",
"def",
":",
"list",
")",
"if",
"(",
"def",
".",
"getName",
"(",
")",
".",
"equals",
"(... | Get a store definition from the given list of store definitions
@param list A list of store definitions
@param name The name of the store
@return The store definition | [
"Get",
"a",
"store",
"definition",
"from",
"the",
"given",
"list",
"of",
"store",
"definitions"
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/store/StoreUtils.java#L210-L215 | train |
voldemort/voldemort | src/java/voldemort/store/StoreUtils.java | StoreUtils.getStoreNames | public static List<String> getStoreNames(List<StoreDefinition> list, boolean ignoreViews) {
List<String> storeNameSet = new ArrayList<String>();
for(StoreDefinition def: list)
if(!def.isView() || !ignoreViews)
storeNameSet.add(def.getName());
return storeNameSet;
... | java | public static List<String> getStoreNames(List<StoreDefinition> list, boolean ignoreViews) {
List<String> storeNameSet = new ArrayList<String>();
for(StoreDefinition def: list)
if(!def.isView() || !ignoreViews)
storeNameSet.add(def.getName());
return storeNameSet;
... | [
"public",
"static",
"List",
"<",
"String",
">",
"getStoreNames",
"(",
"List",
"<",
"StoreDefinition",
">",
"list",
",",
"boolean",
"ignoreViews",
")",
"{",
"List",
"<",
"String",
">",
"storeNameSet",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
... | Get the list of store names from a list of store definitions
@param list
@param ignoreViews
@return list of store names | [
"Get",
"the",
"list",
"of",
"store",
"names",
"from",
"a",
"list",
"of",
"store",
"definitions"
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/store/StoreUtils.java#L224-L230 | train |
voldemort/voldemort | src/java/voldemort/client/rebalance/RebalancePlan.java | RebalancePlan.plan | private void plan() {
// Mapping of stealer node to list of primary partitions being moved
final TreeMultimap<Integer, Integer> stealerToStolenPrimaryPartitions = TreeMultimap.create();
// Output initial and final cluster
if(outputDir != null)
RebalanceUtils.dumpClusters(cur... | java | private void plan() {
// Mapping of stealer node to list of primary partitions being moved
final TreeMultimap<Integer, Integer> stealerToStolenPrimaryPartitions = TreeMultimap.create();
// Output initial and final cluster
if(outputDir != null)
RebalanceUtils.dumpClusters(cur... | [
"private",
"void",
"plan",
"(",
")",
"{",
"// Mapping of stealer node to list of primary partitions being moved",
"final",
"TreeMultimap",
"<",
"Integer",
",",
"Integer",
">",
"stealerToStolenPrimaryPartitions",
"=",
"TreeMultimap",
".",
"create",
"(",
")",
";",
"// Outpu... | Create a plan. The plan consists of batches. Each batch involves the
movement of no more than batchSize primary partitions. The movement of a
single primary partition may require migration of other n-ary replicas,
and potentially deletions. Migrating a primary or n-ary partition
requires migrating one partition-store f... | [
"Create",
"a",
"plan",
".",
"The",
"plan",
"consists",
"of",
"batches",
".",
"Each",
"batch",
"involves",
"the",
"movement",
"of",
"no",
"more",
"than",
"batchSize",
"primary",
"partitions",
".",
"The",
"movement",
"of",
"a",
"single",
"primary",
"partition"... | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/client/rebalance/RebalancePlan.java#L152-L226 | train |
voldemort/voldemort | src/java/voldemort/client/rebalance/RebalancePlan.java | RebalancePlan.storageOverhead | private String storageOverhead(Map<Integer, Integer> finalNodeToOverhead) {
double maxOverhead = Double.MIN_VALUE;
PartitionBalance pb = new PartitionBalance(currentCluster, currentStoreDefs);
StringBuilder sb = new StringBuilder();
sb.append("Per-node store-overhead:").append(Utils.NEWL... | java | private String storageOverhead(Map<Integer, Integer> finalNodeToOverhead) {
double maxOverhead = Double.MIN_VALUE;
PartitionBalance pb = new PartitionBalance(currentCluster, currentStoreDefs);
StringBuilder sb = new StringBuilder();
sb.append("Per-node store-overhead:").append(Utils.NEWL... | [
"private",
"String",
"storageOverhead",
"(",
"Map",
"<",
"Integer",
",",
"Integer",
">",
"finalNodeToOverhead",
")",
"{",
"double",
"maxOverhead",
"=",
"Double",
".",
"MIN_VALUE",
";",
"PartitionBalance",
"pb",
"=",
"new",
"PartitionBalance",
"(",
"currentCluster"... | Determines storage overhead and returns pretty printed summary.
@param finalNodeToOverhead Map of node IDs from final cluster to number
of partition-stores to be moved to the node.
@return pretty printed string summary of storage overhead. | [
"Determines",
"storage",
"overhead",
"and",
"returns",
"pretty",
"printed",
"summary",
"."
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/client/rebalance/RebalancePlan.java#L235-L267 | train |
voldemort/voldemort | src/java/voldemort/tools/admin/AdminToolUtils.java | AdminToolUtils.askConfirm | public static Boolean askConfirm(Boolean confirm, String opDesc) throws IOException {
if(confirm) {
System.out.println("Confirmed " + opDesc + " in command-line.");
return true;
} else {
System.out.println("Are you sure you want to " + opDesc + "? (yes/no)");
... | java | public static Boolean askConfirm(Boolean confirm, String opDesc) throws IOException {
if(confirm) {
System.out.println("Confirmed " + opDesc + " in command-line.");
return true;
} else {
System.out.println("Are you sure you want to " + opDesc + "? (yes/no)");
... | [
"public",
"static",
"Boolean",
"askConfirm",
"(",
"Boolean",
"confirm",
",",
"String",
"opDesc",
")",
"throws",
"IOException",
"{",
"if",
"(",
"confirm",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Confirmed \"",
"+",
"opDesc",
"+",
"\" in comman... | Utility function that pauses and asks for confirmation on dangerous
operations.
@param confirm User has already confirmed in command-line input
@param opDesc Description of the dangerous operation
@throws IOException
@return True if user confirms the operation in either command-line input
or here. | [
"Utility",
"function",
"that",
"pauses",
"and",
"asks",
"for",
"confirmation",
"on",
"dangerous",
"operations",
"."
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/tools/admin/AdminToolUtils.java#L99-L113 | train |
voldemort/voldemort | src/java/voldemort/tools/admin/AdminToolUtils.java | AdminToolUtils.getValueList | public static List<String> getValueList(List<String> valuePairs, String delim) {
List<String> valueList = Lists.newArrayList();
for(String valuePair: valuePairs) {
String[] value = valuePair.split(delim, 2);
if(value.length != 2)
throw new VoldemortException("Inva... | java | public static List<String> getValueList(List<String> valuePairs, String delim) {
List<String> valueList = Lists.newArrayList();
for(String valuePair: valuePairs) {
String[] value = valuePair.split(delim, 2);
if(value.length != 2)
throw new VoldemortException("Inva... | [
"public",
"static",
"List",
"<",
"String",
">",
"getValueList",
"(",
"List",
"<",
"String",
">",
"valuePairs",
",",
"String",
"delim",
")",
"{",
"List",
"<",
"String",
">",
"valueList",
"=",
"Lists",
".",
"newArrayList",
"(",
")",
";",
"for",
"(",
"Str... | Utility function that gives list of values from list of value-pair
strings.
@param valuePairs List of value-pair strings
@param delim Delimiter that separates the value pair
@returns The list of values; empty if no value-pair is present, The even
elements are the first ones of the value pair, and the odd
elements are ... | [
"Utility",
"function",
"that",
"gives",
"list",
"of",
"values",
"from",
"list",
"of",
"value",
"-",
"pair",
"strings",
"."
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/tools/admin/AdminToolUtils.java#L128-L138 | train |
voldemort/voldemort | src/java/voldemort/tools/admin/AdminToolUtils.java | AdminToolUtils.convertListToMap | public static <V> Map<V, V> convertListToMap(List<V> list) {
Map<V, V> map = new HashMap<V, V>();
if(list.size() % 2 != 0)
throw new VoldemortException("Failed to convert list to map.");
for(int i = 0; i < list.size(); i += 2) {
map.put(list.get(i), list.get(i + 1));
... | java | public static <V> Map<V, V> convertListToMap(List<V> list) {
Map<V, V> map = new HashMap<V, V>();
if(list.size() % 2 != 0)
throw new VoldemortException("Failed to convert list to map.");
for(int i = 0; i < list.size(); i += 2) {
map.put(list.get(i), list.get(i + 1));
... | [
"public",
"static",
"<",
"V",
">",
"Map",
"<",
"V",
",",
"V",
">",
"convertListToMap",
"(",
"List",
"<",
"V",
">",
"list",
")",
"{",
"Map",
"<",
"V",
",",
"V",
">",
"map",
"=",
"new",
"HashMap",
"<",
"V",
",",
"V",
">",
"(",
")",
";",
"if",... | Utility function that converts a list to a map.
@param list The list in which even elements are keys and odd elements are
values.
@rturn The map container that maps even elements to odd elements, e.g.
0->1, 2->3, etc. | [
"Utility",
"function",
"that",
"converts",
"a",
"list",
"to",
"a",
"map",
"."
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/tools/admin/AdminToolUtils.java#L148-L156 | train |
voldemort/voldemort | src/java/voldemort/tools/admin/AdminToolUtils.java | AdminToolUtils.getAdminClient | public static AdminClient getAdminClient(String url) {
ClientConfig config = new ClientConfig().setBootstrapUrls(url)
.setConnectionTimeout(5, TimeUnit.SECONDS);
AdminClientConfig adminConfig = new AdminClientConfig().setAdminSocketTimeoutSec(5);
... | java | public static AdminClient getAdminClient(String url) {
ClientConfig config = new ClientConfig().setBootstrapUrls(url)
.setConnectionTimeout(5, TimeUnit.SECONDS);
AdminClientConfig adminConfig = new AdminClientConfig().setAdminSocketTimeoutSec(5);
... | [
"public",
"static",
"AdminClient",
"getAdminClient",
"(",
"String",
"url",
")",
"{",
"ClientConfig",
"config",
"=",
"new",
"ClientConfig",
"(",
")",
".",
"setBootstrapUrls",
"(",
"url",
")",
".",
"setConnectionTimeout",
"(",
"5",
",",
"TimeUnit",
".",
"SECONDS... | Utility function that constructs AdminClient.
@param url URL pointing to the bootstrap node
@return Newly constructed AdminClient | [
"Utility",
"function",
"that",
"constructs",
"AdminClient",
"."
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/tools/admin/AdminToolUtils.java#L164-L170 | train |
voldemort/voldemort | src/java/voldemort/tools/admin/AdminToolUtils.java | AdminToolUtils.getAllNodeIds | public static List<Integer> getAllNodeIds(AdminClient adminClient) {
List<Integer> nodeIds = Lists.newArrayList();
for(Integer nodeId: adminClient.getAdminClientCluster().getNodeIds()) {
nodeIds.add(nodeId);
}
return nodeIds;
} | java | public static List<Integer> getAllNodeIds(AdminClient adminClient) {
List<Integer> nodeIds = Lists.newArrayList();
for(Integer nodeId: adminClient.getAdminClientCluster().getNodeIds()) {
nodeIds.add(nodeId);
}
return nodeIds;
} | [
"public",
"static",
"List",
"<",
"Integer",
">",
"getAllNodeIds",
"(",
"AdminClient",
"adminClient",
")",
"{",
"List",
"<",
"Integer",
">",
"nodeIds",
"=",
"Lists",
".",
"newArrayList",
"(",
")",
";",
"for",
"(",
"Integer",
"nodeId",
":",
"adminClient",
".... | Utility function that fetches node ids.
@param adminClient An instance of AdminClient points to given cluster
@return Node ids in cluster | [
"Utility",
"function",
"that",
"fetches",
"node",
"ids",
"."
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/tools/admin/AdminToolUtils.java#L178-L184 | train |
voldemort/voldemort | src/java/voldemort/tools/admin/AdminToolUtils.java | AdminToolUtils.getAllUserStoreNamesOnNode | public static List<String> getAllUserStoreNamesOnNode(AdminClient adminClient, Integer nodeId) {
List<String> storeNames = Lists.newArrayList();
List<StoreDefinition> storeDefinitionList = adminClient.metadataMgmtOps.getRemoteStoreDefList(nodeId)
... | java | public static List<String> getAllUserStoreNamesOnNode(AdminClient adminClient, Integer nodeId) {
List<String> storeNames = Lists.newArrayList();
List<StoreDefinition> storeDefinitionList = adminClient.metadataMgmtOps.getRemoteStoreDefList(nodeId)
... | [
"public",
"static",
"List",
"<",
"String",
">",
"getAllUserStoreNamesOnNode",
"(",
"AdminClient",
"adminClient",
",",
"Integer",
"nodeId",
")",
"{",
"List",
"<",
"String",
">",
"storeNames",
"=",
"Lists",
".",
"newArrayList",
"(",
")",
";",
"List",
"<",
"Sto... | Utility function that fetches all stores on a node.
@param adminClient An instance of AdminClient points to given cluster
@param nodeId Node id to fetch stores from
@return List of all store names | [
"Utility",
"function",
"that",
"fetches",
"all",
"stores",
"on",
"a",
"node",
"."
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/tools/admin/AdminToolUtils.java#L193-L202 | train |
voldemort/voldemort | src/java/voldemort/tools/admin/AdminToolUtils.java | AdminToolUtils.validateUserStoreNamesOnNode | public static void validateUserStoreNamesOnNode(AdminClient adminClient,
Integer nodeId,
List<String> storeNames) {
List<StoreDefinition> storeDefList = adminClient.metadataMgmtOps.getRemoteStoreDefList(nodeI... | java | public static void validateUserStoreNamesOnNode(AdminClient adminClient,
Integer nodeId,
List<String> storeNames) {
List<StoreDefinition> storeDefList = adminClient.metadataMgmtOps.getRemoteStoreDefList(nodeI... | [
"public",
"static",
"void",
"validateUserStoreNamesOnNode",
"(",
"AdminClient",
"adminClient",
",",
"Integer",
"nodeId",
",",
"List",
"<",
"String",
">",
"storeNames",
")",
"{",
"List",
"<",
"StoreDefinition",
">",
"storeDefList",
"=",
"adminClient",
".",
"metadat... | Utility function that checks if store names are valid on a node.
@param adminClient An instance of AdminClient points to given cluster
@param nodeId Node id to fetch stores from
@param storeNames Store names to check | [
"Utility",
"function",
"that",
"checks",
"if",
"store",
"names",
"are",
"valid",
"on",
"a",
"node",
"."
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/tools/admin/AdminToolUtils.java#L228-L242 | train |
voldemort/voldemort | src/java/voldemort/tools/admin/AdminToolUtils.java | AdminToolUtils.getAllPartitions | public static List<Integer> getAllPartitions(AdminClient adminClient) {
List<Integer> partIds = Lists.newArrayList();
partIds = Lists.newArrayList();
for(Node node: adminClient.getAdminClientCluster().getNodes()) {
partIds.addAll(node.getPartitionIds());
}
return part... | java | public static List<Integer> getAllPartitions(AdminClient adminClient) {
List<Integer> partIds = Lists.newArrayList();
partIds = Lists.newArrayList();
for(Node node: adminClient.getAdminClientCluster().getNodes()) {
partIds.addAll(node.getPartitionIds());
}
return part... | [
"public",
"static",
"List",
"<",
"Integer",
">",
"getAllPartitions",
"(",
"AdminClient",
"adminClient",
")",
"{",
"List",
"<",
"Integer",
">",
"partIds",
"=",
"Lists",
".",
"newArrayList",
"(",
")",
";",
"partIds",
"=",
"Lists",
".",
"newArrayList",
"(",
"... | Utility function that fetches partitions.
@param adminClient An instance of AdminClient points to given cluster
@return all partitions on cluster | [
"Utility",
"function",
"that",
"fetches",
"partitions",
"."
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/tools/admin/AdminToolUtils.java#L250-L257 | train |
voldemort/voldemort | src/java/voldemort/tools/admin/AdminToolUtils.java | AdminToolUtils.getQuotaTypes | public static List<QuotaType> getQuotaTypes(List<String> strQuotaTypes) {
if(strQuotaTypes.size() < 1) {
throw new VoldemortException("Quota type not specified.");
}
List<QuotaType> quotaTypes;
if(strQuotaTypes.size() == 1 && strQuotaTypes.get(0).equals(AdminToolUtils.QUOTATY... | java | public static List<QuotaType> getQuotaTypes(List<String> strQuotaTypes) {
if(strQuotaTypes.size() < 1) {
throw new VoldemortException("Quota type not specified.");
}
List<QuotaType> quotaTypes;
if(strQuotaTypes.size() == 1 && strQuotaTypes.get(0).equals(AdminToolUtils.QUOTATY... | [
"public",
"static",
"List",
"<",
"QuotaType",
">",
"getQuotaTypes",
"(",
"List",
"<",
"String",
">",
"strQuotaTypes",
")",
"{",
"if",
"(",
"strQuotaTypes",
".",
"size",
"(",
")",
"<",
"1",
")",
"{",
"throw",
"new",
"VoldemortException",
"(",
"\"Quota type ... | Utility function that fetches quota types. | [
"Utility",
"function",
"that",
"fetches",
"quota",
"types",
"."
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/tools/admin/AdminToolUtils.java#L262-L277 | train |
voldemort/voldemort | src/java/voldemort/tools/admin/AdminToolUtils.java | AdminToolUtils.createDir | public static File createDir(String dir) {
// create outdir
File directory = null;
if(dir != null) {
directory = new File(dir);
if(!(directory.exists() || directory.mkdir())) {
Utils.croak("Can't find or create directory " + dir);
}
}
... | java | public static File createDir(String dir) {
// create outdir
File directory = null;
if(dir != null) {
directory = new File(dir);
if(!(directory.exists() || directory.mkdir())) {
Utils.croak("Can't find or create directory " + dir);
}
}
... | [
"public",
"static",
"File",
"createDir",
"(",
"String",
"dir",
")",
"{",
"// create outdir",
"File",
"directory",
"=",
"null",
";",
"if",
"(",
"dir",
"!=",
"null",
")",
"{",
"directory",
"=",
"new",
"File",
"(",
"dir",
")",
";",
"if",
"(",
"!",
"(",
... | Utility function that creates directory.
@param dir Directory path
@return File object of directory. | [
"Utility",
"function",
"that",
"creates",
"directory",
"."
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/tools/admin/AdminToolUtils.java#L285-L295 | train |
voldemort/voldemort | src/java/voldemort/tools/admin/AdminToolUtils.java | AdminToolUtils.getSystemStoreDefMap | public static Map<String, StoreDefinition> getSystemStoreDefMap() {
Map<String, StoreDefinition> sysStoreDefMap = Maps.newHashMap();
List<StoreDefinition> storesDefs = SystemStoreConstants.getAllSystemStoreDefs();
for(StoreDefinition def: storesDefs) {
sysStoreDefMap.put(def.getName(... | java | public static Map<String, StoreDefinition> getSystemStoreDefMap() {
Map<String, StoreDefinition> sysStoreDefMap = Maps.newHashMap();
List<StoreDefinition> storesDefs = SystemStoreConstants.getAllSystemStoreDefs();
for(StoreDefinition def: storesDefs) {
sysStoreDefMap.put(def.getName(... | [
"public",
"static",
"Map",
"<",
"String",
",",
"StoreDefinition",
">",
"getSystemStoreDefMap",
"(",
")",
"{",
"Map",
"<",
"String",
",",
"StoreDefinition",
">",
"sysStoreDefMap",
"=",
"Maps",
".",
"newHashMap",
"(",
")",
";",
"List",
"<",
"StoreDefinition",
... | Utility function that fetches system store definitions
@return The map container that maps store names to store definitions | [
"Utility",
"function",
"that",
"fetches",
"system",
"store",
"definitions"
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/tools/admin/AdminToolUtils.java#L302-L309 | train |
voldemort/voldemort | src/java/voldemort/tools/admin/AdminToolUtils.java | AdminToolUtils.getUserStoreDefMapOnNode | public static Map<String, StoreDefinition> getUserStoreDefMapOnNode(AdminClient adminClient,
Integer nodeId) {
List<StoreDefinition> storeDefinitionList = adminClient.metadataMgmtOps.getRemoteStoreDefList(nodeId)
... | java | public static Map<String, StoreDefinition> getUserStoreDefMapOnNode(AdminClient adminClient,
Integer nodeId) {
List<StoreDefinition> storeDefinitionList = adminClient.metadataMgmtOps.getRemoteStoreDefList(nodeId)
... | [
"public",
"static",
"Map",
"<",
"String",
",",
"StoreDefinition",
">",
"getUserStoreDefMapOnNode",
"(",
"AdminClient",
"adminClient",
",",
"Integer",
"nodeId",
")",
"{",
"List",
"<",
"StoreDefinition",
">",
"storeDefinitionList",
"=",
"adminClient",
".",
"metadataMg... | Utility function that fetches user defined store definitions
@param adminClient An instance of AdminClient points to given cluster
@param nodeId Node id to fetch store definitions from
@return The map container that maps store names to store definitions | [
"Utility",
"function",
"that",
"fetches",
"user",
"defined",
"store",
"definitions"
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/tools/admin/AdminToolUtils.java#L318-L327 | train |
voldemort/voldemort | src/java/voldemort/client/protocol/pb/ProtoUtils.java | ProtoUtils.decodeRebalanceTaskInfoMap | public static RebalanceTaskInfo decodeRebalanceTaskInfoMap(VAdminProto.RebalanceTaskInfoMap rebalanceTaskInfoMap) {
RebalanceTaskInfo rebalanceTaskInfo = new RebalanceTaskInfo(
rebalanceTaskInfoMap.getStealerId(),
... | java | public static RebalanceTaskInfo decodeRebalanceTaskInfoMap(VAdminProto.RebalanceTaskInfoMap rebalanceTaskInfoMap) {
RebalanceTaskInfo rebalanceTaskInfo = new RebalanceTaskInfo(
rebalanceTaskInfoMap.getStealerId(),
... | [
"public",
"static",
"RebalanceTaskInfo",
"decodeRebalanceTaskInfoMap",
"(",
"VAdminProto",
".",
"RebalanceTaskInfoMap",
"rebalanceTaskInfoMap",
")",
"{",
"RebalanceTaskInfo",
"rebalanceTaskInfo",
"=",
"new",
"RebalanceTaskInfo",
"(",
"rebalanceTaskInfoMap",
".",
"getStealerId",... | Given a protobuf rebalance-partition info, converts it into our
rebalance-partition info
@param rebalanceTaskInfoMap Proto-buff version of
RebalanceTaskInfoMap
@return RebalanceTaskInfo object. | [
"Given",
"a",
"protobuf",
"rebalance",
"-",
"partition",
"info",
"converts",
"it",
"into",
"our",
"rebalance",
"-",
"partition",
"info"
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/client/protocol/pb/ProtoUtils.java#L70-L77 | train |
voldemort/voldemort | src/java/voldemort/client/protocol/pb/ProtoUtils.java | ProtoUtils.encodeRebalanceTaskInfoMap | public static RebalanceTaskInfoMap encodeRebalanceTaskInfoMap(RebalanceTaskInfo stealInfo) {
return RebalanceTaskInfoMap.newBuilder()
.setStealerId(stealInfo.getStealerId())
.setDonorId(stealInfo.getDonorId())
... | java | public static RebalanceTaskInfoMap encodeRebalanceTaskInfoMap(RebalanceTaskInfo stealInfo) {
return RebalanceTaskInfoMap.newBuilder()
.setStealerId(stealInfo.getStealerId())
.setDonorId(stealInfo.getDonorId())
... | [
"public",
"static",
"RebalanceTaskInfoMap",
"encodeRebalanceTaskInfoMap",
"(",
"RebalanceTaskInfo",
"stealInfo",
")",
"{",
"return",
"RebalanceTaskInfoMap",
".",
"newBuilder",
"(",
")",
".",
"setStealerId",
"(",
"stealInfo",
".",
"getStealerId",
"(",
")",
")",
".",
... | Given a rebalance-task info, convert it into the protobuf equivalent
@param stealInfo Rebalance task info
@return Protobuf equivalent of the same | [
"Given",
"a",
"rebalance",
"-",
"task",
"info",
"convert",
"it",
"into",
"the",
"protobuf",
"equivalent"
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/client/protocol/pb/ProtoUtils.java#L101-L108 | train |
voldemort/voldemort | contrib/collections/src/java/voldemort/collections/VStack.java | VStack.getVersionedById | public Versioned<E> getVersionedById(int id) {
Versioned<VListNode<E>> listNode = getListNode(id);
if(listNode == null)
throw new IndexOutOfBoundsException();
return new Versioned<E>(listNode.getValue().getValue(), listNode.getVersion());
} | java | public Versioned<E> getVersionedById(int id) {
Versioned<VListNode<E>> listNode = getListNode(id);
if(listNode == null)
throw new IndexOutOfBoundsException();
return new Versioned<E>(listNode.getValue().getValue(), listNode.getVersion());
} | [
"public",
"Versioned",
"<",
"E",
">",
"getVersionedById",
"(",
"int",
"id",
")",
"{",
"Versioned",
"<",
"VListNode",
"<",
"E",
">>",
"listNode",
"=",
"getListNode",
"(",
"id",
")",
";",
"if",
"(",
"listNode",
"==",
"null",
")",
"throw",
"new",
"IndexOu... | Get the ver
@param id
@return | [
"Get",
"the",
"ver"
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/contrib/collections/src/java/voldemort/collections/VStack.java#L272-L277 | train |
voldemort/voldemort | contrib/collections/src/java/voldemort/collections/VStack.java | VStack.setById | public E setById(final int id, final E element) {
VListKey<K> key = new VListKey<K>(_key, id);
UpdateElementById<K, E> updateElementAction = new UpdateElementById<K, E>(key, element);
if(!_storeClient.applyUpdate(updateElementAction))
throw new ObsoleteVersionException("update faile... | java | public E setById(final int id, final E element) {
VListKey<K> key = new VListKey<K>(_key, id);
UpdateElementById<K, E> updateElementAction = new UpdateElementById<K, E>(key, element);
if(!_storeClient.applyUpdate(updateElementAction))
throw new ObsoleteVersionException("update faile... | [
"public",
"E",
"setById",
"(",
"final",
"int",
"id",
",",
"final",
"E",
"element",
")",
"{",
"VListKey",
"<",
"K",
">",
"key",
"=",
"new",
"VListKey",
"<",
"K",
">",
"(",
"_key",
",",
"id",
")",
";",
"UpdateElementById",
"<",
"K",
",",
"E",
">",
... | Put the given value to the appropriate id in the stack, using the version
of the current list node identified by that id.
@param id
@param element element to set
@return element that was replaced by the new element
@throws ObsoleteVersionException when an update fails | [
"Put",
"the",
"given",
"value",
"to",
"the",
"appropriate",
"id",
"in",
"the",
"stack",
"using",
"the",
"version",
"of",
"the",
"current",
"list",
"node",
"identified",
"by",
"that",
"id",
"."
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/contrib/collections/src/java/voldemort/collections/VStack.java#L300-L308 | train |
voldemort/voldemort | contrib/hadoop-store-builder/src/java/voldemort/store/readonly/mr/azkaban/VoldemortBuildAndPushJob.java | VoldemortBuildAndPushJob.allClustersEqual | private void allClustersEqual(final List<String> clusterUrls) {
Validate.notEmpty(clusterUrls, "clusterUrls cannot be null");
// If only one clusterUrl return immediately
if (clusterUrls.size() == 1)
return;
AdminClient adminClientLhs = adminClientPerCluster.get(clusterUrls.g... | java | private void allClustersEqual(final List<String> clusterUrls) {
Validate.notEmpty(clusterUrls, "clusterUrls cannot be null");
// If only one clusterUrl return immediately
if (clusterUrls.size() == 1)
return;
AdminClient adminClientLhs = adminClientPerCluster.get(clusterUrls.g... | [
"private",
"void",
"allClustersEqual",
"(",
"final",
"List",
"<",
"String",
">",
"clusterUrls",
")",
"{",
"Validate",
".",
"notEmpty",
"(",
"clusterUrls",
",",
"\"clusterUrls cannot be null\"",
")",
";",
"// If only one clusterUrl return immediately",
"if",
"(",
"clus... | Check if all cluster objects in the list are congruent.
@param clusterUrls of cluster objects
@return | [
"Check",
"if",
"all",
"cluster",
"objects",
"in",
"the",
"list",
"are",
"congruent",
"."
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/contrib/hadoop-store-builder/src/java/voldemort/store/readonly/mr/azkaban/VoldemortBuildAndPushJob.java#L416-L430 | train |
voldemort/voldemort | contrib/hadoop-store-builder/src/java/voldemort/store/readonly/mr/azkaban/VoldemortBuildAndPushJob.java | VoldemortBuildAndPushJob.getInputPathJsonSchema | private synchronized JsonSchema getInputPathJsonSchema() throws IOException {
if (inputPathJsonSchema == null) {
// No need to query Hadoop more than once as this shouldn't change mid-run,
// thus, we can lazily initialize and cache the result.
inputPathJsonSchema = HadoopUti... | java | private synchronized JsonSchema getInputPathJsonSchema() throws IOException {
if (inputPathJsonSchema == null) {
// No need to query Hadoop more than once as this shouldn't change mid-run,
// thus, we can lazily initialize and cache the result.
inputPathJsonSchema = HadoopUti... | [
"private",
"synchronized",
"JsonSchema",
"getInputPathJsonSchema",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"inputPathJsonSchema",
"==",
"null",
")",
"{",
"// No need to query Hadoop more than once as this shouldn't change mid-run,",
"// thus, we can lazily initialize and... | Get the Json Schema of the input path, assuming the path contains just one
schema version in all files under that path. | [
"Get",
"the",
"Json",
"Schema",
"of",
"the",
"input",
"path",
"assuming",
"the",
"path",
"contains",
"just",
"one",
"schema",
"version",
"in",
"all",
"files",
"under",
"that",
"path",
"."
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/contrib/hadoop-store-builder/src/java/voldemort/store/readonly/mr/azkaban/VoldemortBuildAndPushJob.java#L892-L899 | train |
voldemort/voldemort | contrib/hadoop-store-builder/src/java/voldemort/store/readonly/mr/azkaban/VoldemortBuildAndPushJob.java | VoldemortBuildAndPushJob.getInputPathAvroSchema | private synchronized Schema getInputPathAvroSchema() throws IOException {
if (inputPathAvroSchema == null) {
// No need to query Hadoop more than once as this shouldn't change mid-run,
// thus, we can lazily initialize and cache the result.
inputPathAvroSchema = AvroUtils.get... | java | private synchronized Schema getInputPathAvroSchema() throws IOException {
if (inputPathAvroSchema == null) {
// No need to query Hadoop more than once as this shouldn't change mid-run,
// thus, we can lazily initialize and cache the result.
inputPathAvroSchema = AvroUtils.get... | [
"private",
"synchronized",
"Schema",
"getInputPathAvroSchema",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"inputPathAvroSchema",
"==",
"null",
")",
"{",
"// No need to query Hadoop more than once as this shouldn't change mid-run,",
"// thus, we can lazily initialize and cac... | Get the Avro Schema of the input path, assuming the path contains just one
schema version in all files under that path. | [
"Get",
"the",
"Avro",
"Schema",
"of",
"the",
"input",
"path",
"assuming",
"the",
"path",
"contains",
"just",
"one",
"schema",
"version",
"in",
"all",
"files",
"under",
"that",
"path",
"."
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/contrib/hadoop-store-builder/src/java/voldemort/store/readonly/mr/azkaban/VoldemortBuildAndPushJob.java#L905-L912 | train |
voldemort/voldemort | contrib/hadoop-store-builder/src/java/voldemort/store/readonly/mr/azkaban/VoldemortBuildAndPushJob.java | VoldemortBuildAndPushJob.getRecordSchema | public String getRecordSchema() throws IOException {
Schema schema = getInputPathAvroSchema();
String recSchema = schema.toString();
return recSchema;
} | java | public String getRecordSchema() throws IOException {
Schema schema = getInputPathAvroSchema();
String recSchema = schema.toString();
return recSchema;
} | [
"public",
"String",
"getRecordSchema",
"(",
")",
"throws",
"IOException",
"{",
"Schema",
"schema",
"=",
"getInputPathAvroSchema",
"(",
")",
";",
"String",
"recSchema",
"=",
"schema",
".",
"toString",
"(",
")",
";",
"return",
"recSchema",
";",
"}"
] | Get the schema for the Avro Record from the object container file | [
"Get",
"the",
"schema",
"for",
"the",
"Avro",
"Record",
"from",
"the",
"object",
"container",
"file"
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/contrib/hadoop-store-builder/src/java/voldemort/store/readonly/mr/azkaban/VoldemortBuildAndPushJob.java#L915-L919 | train |
voldemort/voldemort | contrib/hadoop-store-builder/src/java/voldemort/store/readonly/mr/azkaban/VoldemortBuildAndPushJob.java | VoldemortBuildAndPushJob.getKeySchema | public String getKeySchema() throws IOException {
Schema schema = getInputPathAvroSchema();
String keySchema = schema.getField(keyFieldName).schema().toString();
return keySchema;
} | java | public String getKeySchema() throws IOException {
Schema schema = getInputPathAvroSchema();
String keySchema = schema.getField(keyFieldName).schema().toString();
return keySchema;
} | [
"public",
"String",
"getKeySchema",
"(",
")",
"throws",
"IOException",
"{",
"Schema",
"schema",
"=",
"getInputPathAvroSchema",
"(",
")",
";",
"String",
"keySchema",
"=",
"schema",
".",
"getField",
"(",
"keyFieldName",
")",
".",
"schema",
"(",
")",
".",
"toSt... | Extract schema of the key field | [
"Extract",
"schema",
"of",
"the",
"key",
"field"
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/contrib/hadoop-store-builder/src/java/voldemort/store/readonly/mr/azkaban/VoldemortBuildAndPushJob.java#L922-L926 | train |
voldemort/voldemort | contrib/hadoop-store-builder/src/java/voldemort/store/readonly/mr/azkaban/VoldemortBuildAndPushJob.java | VoldemortBuildAndPushJob.getValueSchema | public String getValueSchema() throws IOException {
Schema schema = getInputPathAvroSchema();
String valueSchema = schema.getField(valueFieldName).schema().toString();
return valueSchema;
} | java | public String getValueSchema() throws IOException {
Schema schema = getInputPathAvroSchema();
String valueSchema = schema.getField(valueFieldName).schema().toString();
return valueSchema;
} | [
"public",
"String",
"getValueSchema",
"(",
")",
"throws",
"IOException",
"{",
"Schema",
"schema",
"=",
"getInputPathAvroSchema",
"(",
")",
";",
"String",
"valueSchema",
"=",
"schema",
".",
"getField",
"(",
"valueFieldName",
")",
".",
"schema",
"(",
")",
".",
... | Extract schema of the value field | [
"Extract",
"schema",
"of",
"the",
"value",
"field"
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/contrib/hadoop-store-builder/src/java/voldemort/store/readonly/mr/azkaban/VoldemortBuildAndPushJob.java#L929-L933 | train |
voldemort/voldemort | contrib/hadoop-store-builder/src/java/voldemort/store/readonly/mr/azkaban/VoldemortBuildAndPushJob.java | VoldemortBuildAndPushJob.verifyOrAddStore | private void verifyOrAddStore(String clusterURL,
String keySchema,
String valueSchema) {
String newStoreDefXml = VoldemortUtils.getStoreDefXml(
storeName,
props.getInt(BUILD_REPLICATION_FACTOR, 2),
... | java | private void verifyOrAddStore(String clusterURL,
String keySchema,
String valueSchema) {
String newStoreDefXml = VoldemortUtils.getStoreDefXml(
storeName,
props.getInt(BUILD_REPLICATION_FACTOR, 2),
... | [
"private",
"void",
"verifyOrAddStore",
"(",
"String",
"clusterURL",
",",
"String",
"keySchema",
",",
"String",
"valueSchema",
")",
"{",
"String",
"newStoreDefXml",
"=",
"VoldemortUtils",
".",
"getStoreDefXml",
"(",
"storeName",
",",
"props",
".",
"getInt",
"(",
... | For each node, checks if the store exists and then verifies that the remote schema
matches the new one. If the remote store doesn't exist, it creates it. | [
"For",
"each",
"node",
"checks",
"if",
"the",
"store",
"exists",
"and",
"then",
"verifies",
"that",
"the",
"remote",
"schema",
"matches",
"the",
"new",
"one",
".",
"If",
"the",
"remote",
"store",
"doesn",
"t",
"exist",
"it",
"creates",
"it",
"."
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/contrib/hadoop-store-builder/src/java/voldemort/store/readonly/mr/azkaban/VoldemortBuildAndPushJob.java#L1014-L1042 | train |
voldemort/voldemort | src/java/voldemort/store/readonly/StoreVersionManager.java | StoreVersionManager.syncInternalStateFromFileSystem | public void syncInternalStateFromFileSystem(boolean alsoSyncRemoteState) {
// Make sure versions missing from the file-system are cleaned up from the internal state
for (Long version: versionToEnabledMap.keySet()) {
File[] existingVersionDirs = ReadOnlyUtils.getVersionDirs(rootDir, version, ... | java | public void syncInternalStateFromFileSystem(boolean alsoSyncRemoteState) {
// Make sure versions missing from the file-system are cleaned up from the internal state
for (Long version: versionToEnabledMap.keySet()) {
File[] existingVersionDirs = ReadOnlyUtils.getVersionDirs(rootDir, version, ... | [
"public",
"void",
"syncInternalStateFromFileSystem",
"(",
"boolean",
"alsoSyncRemoteState",
")",
"{",
"// Make sure versions missing from the file-system are cleaned up from the internal state",
"for",
"(",
"Long",
"version",
":",
"versionToEnabledMap",
".",
"keySet",
"(",
")",
... | Compares the StoreVersionManager's internal state with the content on the file-system
of the rootDir provided at construction time.
TODO: If the StoreVersionManager supports non-RO stores in the future,
we should move some of the ReadOnlyUtils functions below to another Utils class. | [
"Compares",
"the",
"StoreVersionManager",
"s",
"internal",
"state",
"with",
"the",
"content",
"on",
"the",
"file",
"-",
"system",
"of",
"the",
"rootDir",
"provided",
"at",
"construction",
"time",
"."
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/store/readonly/StoreVersionManager.java#L86-L114 | train |
voldemort/voldemort | src/java/voldemort/store/readonly/StoreVersionManager.java | StoreVersionManager.persistDisabledVersion | private void persistDisabledVersion(long version) throws PersistenceFailureException {
File disabledMarker = getDisabledMarkerFile(version);
try {
disabledMarker.createNewFile();
} catch (IOException e) {
throw new PersistenceFailureException("Failed to create the disable... | java | private void persistDisabledVersion(long version) throws PersistenceFailureException {
File disabledMarker = getDisabledMarkerFile(version);
try {
disabledMarker.createNewFile();
} catch (IOException e) {
throw new PersistenceFailureException("Failed to create the disable... | [
"private",
"void",
"persistDisabledVersion",
"(",
"long",
"version",
")",
"throws",
"PersistenceFailureException",
"{",
"File",
"disabledMarker",
"=",
"getDisabledMarkerFile",
"(",
"version",
")",
";",
"try",
"{",
"disabledMarker",
".",
"createNewFile",
"(",
")",
";... | Places a disabled marker file in the directory of the specified version.
@param version to disable
@throws PersistenceFailureException if the marker file could not be created (can happen if
the storage system has become read-only or is otherwise
inaccessible). | [
"Places",
"a",
"disabled",
"marker",
"file",
"in",
"the",
"directory",
"of",
"the",
"specified",
"version",
"."
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/store/readonly/StoreVersionManager.java#L206-L215 | train |
voldemort/voldemort | src/java/voldemort/store/readonly/StoreVersionManager.java | StoreVersionManager.persistEnabledVersion | private void persistEnabledVersion(long version) throws PersistenceFailureException {
File disabledMarker = getDisabledMarkerFile(version);
if (disabledMarker.exists()) {
if (!disabledMarker.delete()) {
throw new PersistenceFailureException("Failed to create the disabled mark... | java | private void persistEnabledVersion(long version) throws PersistenceFailureException {
File disabledMarker = getDisabledMarkerFile(version);
if (disabledMarker.exists()) {
if (!disabledMarker.delete()) {
throw new PersistenceFailureException("Failed to create the disabled mark... | [
"private",
"void",
"persistEnabledVersion",
"(",
"long",
"version",
")",
"throws",
"PersistenceFailureException",
"{",
"File",
"disabledMarker",
"=",
"getDisabledMarkerFile",
"(",
"version",
")",
";",
"if",
"(",
"disabledMarker",
".",
"exists",
"(",
")",
")",
"{",... | Deletes the disabled marker file in the directory of the specified version.
@param version to enable
@throws PersistenceFailureException if the marker file could not be deleted (can happen if
the storage system has become read-only or is otherwise
inaccessible). | [
"Deletes",
"the",
"disabled",
"marker",
"file",
"in",
"the",
"directory",
"of",
"the",
"specified",
"version",
"."
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/store/readonly/StoreVersionManager.java#L225-L234 | train |
voldemort/voldemort | src/java/voldemort/store/readonly/StoreVersionManager.java | StoreVersionManager.getDisabledMarkerFile | private File getDisabledMarkerFile(long version) throws PersistenceFailureException {
File[] versionDirArray = ReadOnlyUtils.getVersionDirs(rootDir, version, version);
if (versionDirArray.length == 0) {
throw new PersistenceFailureException("getDisabledMarkerFile did not find the requested v... | java | private File getDisabledMarkerFile(long version) throws PersistenceFailureException {
File[] versionDirArray = ReadOnlyUtils.getVersionDirs(rootDir, version, version);
if (versionDirArray.length == 0) {
throw new PersistenceFailureException("getDisabledMarkerFile did not find the requested v... | [
"private",
"File",
"getDisabledMarkerFile",
"(",
"long",
"version",
")",
"throws",
"PersistenceFailureException",
"{",
"File",
"[",
"]",
"versionDirArray",
"=",
"ReadOnlyUtils",
".",
"getVersionDirs",
"(",
"rootDir",
",",
"version",
",",
"version",
")",
";",
"if",... | Gets the '.disabled' file for a given version of this store. That file may or may not
exist.
@param version of the store for which to get the '.disabled' file.
@return an instance of {@link File} pointing to the '.disabled' file.
@throws PersistenceFailureException if the requested version cannot be found. | [
"Gets",
"the",
".",
"disabled",
"file",
"for",
"a",
"given",
"version",
"of",
"this",
"store",
".",
"That",
"file",
"may",
"or",
"may",
"not",
"exist",
"."
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/store/readonly/StoreVersionManager.java#L244-L252 | train |
voldemort/voldemort | src/java/voldemort/store/stats/SimpleCounter.java | SimpleCounter.getAvgEventValue | public Double getAvgEventValue() {
resetIfNeeded();
synchronized(this) {
long eventsLastInterval = numEventsLastInterval - numEventsLastLastInterval;
if(eventsLastInterval > 0)
return ((totalEventValueLastInterval - totalEventValueLastLastInterval) * 1.0)
... | java | public Double getAvgEventValue() {
resetIfNeeded();
synchronized(this) {
long eventsLastInterval = numEventsLastInterval - numEventsLastLastInterval;
if(eventsLastInterval > 0)
return ((totalEventValueLastInterval - totalEventValueLastLastInterval) * 1.0)
... | [
"public",
"Double",
"getAvgEventValue",
"(",
")",
"{",
"resetIfNeeded",
"(",
")",
";",
"synchronized",
"(",
"this",
")",
"{",
"long",
"eventsLastInterval",
"=",
"numEventsLastInterval",
"-",
"numEventsLastLastInterval",
";",
"if",
"(",
"eventsLastInterval",
">",
"... | Returns the average event value in the current interval | [
"Returns",
"the",
"average",
"event",
"value",
"in",
"the",
"current",
"interval"
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/store/stats/SimpleCounter.java#L125-L135 | train |
voldemort/voldemort | src/java/voldemort/tools/admin/command/AdminCommandMeta.java | SubCommandMetaCheck.executeCommand | @SuppressWarnings("unchecked")
public static void executeCommand(String[] args) throws IOException {
OptionParser parser = getParser();
// declare parameters
List<String> metaKeys = null;
String url = null;
// parse command-line input
ar... | java | @SuppressWarnings("unchecked")
public static void executeCommand(String[] args) throws IOException {
OptionParser parser = getParser();
// declare parameters
List<String> metaKeys = null;
String url = null;
// parse command-line input
ar... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"void",
"executeCommand",
"(",
"String",
"[",
"]",
"args",
")",
"throws",
"IOException",
"{",
"OptionParser",
"parser",
"=",
"getParser",
"(",
")",
";",
"// declare parameters",
"List",
"<",... | Parses command-line and checks if metadata is consistent across all
nodes.
@param args Command-line input
@param printHelp Tells whether to print help only or execute command
actually
@throws IOException | [
"Parses",
"command",
"-",
"line",
"and",
"checks",
"if",
"metadata",
"is",
"consistent",
"across",
"all",
"nodes",
"."
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/tools/admin/command/AdminCommandMeta.java#L212-L250 | train |
voldemort/voldemort | src/java/voldemort/tools/admin/command/AdminCommandMeta.java | SubCommandMetaClearRebalance.executeCommand | @SuppressWarnings("unchecked")
public static void executeCommand(String[] args) throws IOException {
OptionParser parser = getParser();
// declare parameters
String url = null;
List<Integer> nodeIds = null;
Boolean allNodes = true;
Boolea... | java | @SuppressWarnings("unchecked")
public static void executeCommand(String[] args) throws IOException {
OptionParser parser = getParser();
// declare parameters
String url = null;
List<Integer> nodeIds = null;
Boolean allNodes = true;
Boolea... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"void",
"executeCommand",
"(",
"String",
"[",
"]",
"args",
")",
"throws",
"IOException",
"{",
"OptionParser",
"parser",
"=",
"getParser",
"(",
")",
";",
"// declare parameters",
"String",
"u... | Parses command-line and removes metadata related to rebalancing.
@param args Command-line input
@param printHelp Tells whether to print help only or execute command
actually
@throws IOException | [
"Parses",
"command",
"-",
"line",
"and",
"removes",
"metadata",
"related",
"to",
"rebalancing",
"."
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/tools/admin/command/AdminCommandMeta.java#L592-L649 | train |
voldemort/voldemort | src/java/voldemort/tools/admin/command/AdminCommandMeta.java | SubCommandMetaClearRebalance.doMetaClearRebalance | public static void doMetaClearRebalance(AdminClient adminClient, List<Integer> nodeIds) {
AdminToolUtils.assertServerNotInOfflineState(adminClient, nodeIds);
System.out.println("Setting " + MetadataStore.SERVER_STATE_KEY + " to "
+ MetadataStore.VoldemortState.NORM... | java | public static void doMetaClearRebalance(AdminClient adminClient, List<Integer> nodeIds) {
AdminToolUtils.assertServerNotInOfflineState(adminClient, nodeIds);
System.out.println("Setting " + MetadataStore.SERVER_STATE_KEY + " to "
+ MetadataStore.VoldemortState.NORM... | [
"public",
"static",
"void",
"doMetaClearRebalance",
"(",
"AdminClient",
"adminClient",
",",
"List",
"<",
"Integer",
">",
"nodeIds",
")",
"{",
"AdminToolUtils",
".",
"assertServerNotInOfflineState",
"(",
"adminClient",
",",
"nodeIds",
")",
";",
"System",
".",
"out"... | Removes metadata related to rebalancing.
@param adminClient An instance of AdminClient points to given cluster
@param nodeIds Node ids to clear metadata after rebalancing | [
"Removes",
"metadata",
"related",
"to",
"rebalancing",
"."
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/tools/admin/command/AdminCommandMeta.java#L658-L676 | train |
voldemort/voldemort | src/java/voldemort/tools/admin/command/AdminCommandMeta.java | SubCommandMetaGet.executeCommand | @SuppressWarnings("unchecked")
public static void executeCommand(String[] args) throws IOException {
OptionParser parser = getParser();
// declare parameters
List<String> metaKeys = null;
String url = null;
String dir = null;
List<Integer... | java | @SuppressWarnings("unchecked")
public static void executeCommand(String[] args) throws IOException {
OptionParser parser = getParser();
// declare parameters
List<String> metaKeys = null;
String url = null;
String dir = null;
List<Integer... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"void",
"executeCommand",
"(",
"String",
"[",
"]",
"args",
")",
"throws",
"IOException",
"{",
"OptionParser",
"parser",
"=",
"getParser",
"(",
")",
";",
"// declare parameters",
"List",
"<",... | Parses command-line and gets metadata.
@param args Command-line input
@param printHelp Tells whether to print help only or execute command
actually
@throws IOException | [
"Parses",
"command",
"-",
"line",
"and",
"gets",
"metadata",
"."
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/tools/admin/command/AdminCommandMeta.java#L747-L805 | train |
voldemort/voldemort | src/java/voldemort/tools/admin/command/AdminCommandMeta.java | SubCommandMetaGetRO.executeCommand | @SuppressWarnings("unchecked")
public static void executeCommand(String[] args) throws IOException {
OptionParser parser = getParser();
// declare parameters
List<String> metaKeys = null;
String url = null;
List<Integer> nodeIds = null;
B... | java | @SuppressWarnings("unchecked")
public static void executeCommand(String[] args) throws IOException {
OptionParser parser = getParser();
// declare parameters
List<String> metaKeys = null;
String url = null;
List<Integer> nodeIds = null;
B... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"void",
"executeCommand",
"(",
"String",
"[",
"]",
"args",
")",
"throws",
"IOException",
"{",
"OptionParser",
"parser",
"=",
"getParser",
"(",
")",
";",
"// declare parameters",
"List",
"<",... | Parses command-line and gets read-only metadata.
@param args Command-line input
@param printHelp Tells whether to print help only or execute command
actually
@throws IOException | [
"Parses",
"command",
"-",
"line",
"and",
"gets",
"read",
"-",
"only",
"metadata",
"."
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/tools/admin/command/AdminCommandMeta.java#L952-L1004 | train |
voldemort/voldemort | src/java/voldemort/tools/admin/command/AdminCommandMeta.java | SubCommandMetaGetRO.doMetaGetRO | public static void doMetaGetRO(AdminClient adminClient,
Collection<Integer> nodeIds,
List<String> storeNames,
List<String> metaKeys) throws IOException {
for(String key: metaKeys) {
... | java | public static void doMetaGetRO(AdminClient adminClient,
Collection<Integer> nodeIds,
List<String> storeNames,
List<String> metaKeys) throws IOException {
for(String key: metaKeys) {
... | [
"public",
"static",
"void",
"doMetaGetRO",
"(",
"AdminClient",
"adminClient",
",",
"Collection",
"<",
"Integer",
">",
"nodeIds",
",",
"List",
"<",
"String",
">",
"storeNames",
",",
"List",
"<",
"String",
">",
"metaKeys",
")",
"throws",
"IOException",
"{",
"f... | Gets read-only metadata.
@param adminClient An instance of AdminClient points to given cluster
@param nodeIds Node ids to fetch read-only metadata from
@param storeNames Stores names to fetch read-only metadata from
@param metaKeys List of read-only metadata to fetch
@throws IOException | [
"Gets",
"read",
"-",
"only",
"metadata",
"."
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/tools/admin/command/AdminCommandMeta.java#L1015-L1056 | train |
voldemort/voldemort | src/java/voldemort/tools/admin/command/AdminCommandMeta.java | SubCommandMetaSet.doMetaUpdateVersionsOnStores | public static void doMetaUpdateVersionsOnStores(AdminClient adminClient,
List<StoreDefinition> oldStoreDefs,
List<StoreDefinition> newStoreDefs) {
Set<String> storeNamesUnion = new HashSet<String>... | java | public static void doMetaUpdateVersionsOnStores(AdminClient adminClient,
List<StoreDefinition> oldStoreDefs,
List<StoreDefinition> newStoreDefs) {
Set<String> storeNamesUnion = new HashSet<String>... | [
"public",
"static",
"void",
"doMetaUpdateVersionsOnStores",
"(",
"AdminClient",
"adminClient",
",",
"List",
"<",
"StoreDefinition",
">",
"oldStoreDefs",
",",
"List",
"<",
"StoreDefinition",
">",
"newStoreDefs",
")",
"{",
"Set",
"<",
"String",
">",
"storeNamesUnion",... | Updates metadata versions on stores.
@param adminClient An instance of AdminClient points to given cluster
@param oldStoreDefs List of old store definitions
@param newStoreDefs List of new store definitions | [
"Updates",
"metadata",
"versions",
"on",
"stores",
"."
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/tools/admin/command/AdminCommandMeta.java#L1485-L1520 | train |
voldemort/voldemort | src/java/voldemort/tools/admin/command/AdminCommandMeta.java | SubCommandMetaSyncVersion.executeCommand | public static void executeCommand(String[] args) throws IOException {
OptionParser parser = getParser();
String url = null;
Boolean confirm = false;
// parse command-line input
OptionSet options = parser.parse(args);
if(options.has(AdminParserUti... | java | public static void executeCommand(String[] args) throws IOException {
OptionParser parser = getParser();
String url = null;
Boolean confirm = false;
// parse command-line input
OptionSet options = parser.parse(args);
if(options.has(AdminParserUti... | [
"public",
"static",
"void",
"executeCommand",
"(",
"String",
"[",
"]",
"args",
")",
"throws",
"IOException",
"{",
"OptionParser",
"parser",
"=",
"getParser",
"(",
")",
";",
"String",
"url",
"=",
"null",
";",
"Boolean",
"confirm",
"=",
"false",
";",
"// par... | Parses command-line and synchronizes metadata versions across all
nodes.
@param args Command-line input
@param printHelp Tells whether to print help only or execute command
actually
@throws IOException | [
"Parses",
"command",
"-",
"line",
"and",
"synchronizes",
"metadata",
"versions",
"across",
"all",
"nodes",
"."
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/tools/admin/command/AdminCommandMeta.java#L1571-L1611 | train |
voldemort/voldemort | src/java/voldemort/tools/admin/command/AdminCommandMeta.java | SubCommandMetaCheckVersion.executeCommand | public static void executeCommand(String[] args) throws IOException {
OptionParser parser = getParser();
// declare parameters
String url = null;
// parse command-line input
OptionSet options = parser.parse(args);
if(options.has(AdminParserUtils... | java | public static void executeCommand(String[] args) throws IOException {
OptionParser parser = getParser();
// declare parameters
String url = null;
// parse command-line input
OptionSet options = parser.parse(args);
if(options.has(AdminParserUtils... | [
"public",
"static",
"void",
"executeCommand",
"(",
"String",
"[",
"]",
"args",
")",
"throws",
"IOException",
"{",
"OptionParser",
"parser",
"=",
"getParser",
"(",
")",
";",
"// declare parameters",
"String",
"url",
"=",
"null",
";",
"// parse command-line input",
... | Parses command-line and verifies metadata versions on all the cluster
nodes
@param args Command-line input
@param printHelp Tells whether to print help only or execute command
actually
@throws IOException | [
"Parses",
"command",
"-",
"line",
"and",
"verifies",
"metadata",
"versions",
"on",
"all",
"the",
"cluster",
"nodes"
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/tools/admin/command/AdminCommandMeta.java#L1687-L1711 | train |
voldemort/voldemort | src/java/voldemort/server/protocol/admin/FullScanFetchStreamRequestHandler.java | FullScanFetchStreamRequestHandler.getKeyPartitionId | private Integer getKeyPartitionId(byte[] key) {
Integer keyPartitionId = storeInstance.getNodesPartitionIdForKey(nodeId, key);
Utils.notNull(keyPartitionId);
return keyPartitionId;
} | java | private Integer getKeyPartitionId(byte[] key) {
Integer keyPartitionId = storeInstance.getNodesPartitionIdForKey(nodeId, key);
Utils.notNull(keyPartitionId);
return keyPartitionId;
} | [
"private",
"Integer",
"getKeyPartitionId",
"(",
"byte",
"[",
"]",
"key",
")",
"{",
"Integer",
"keyPartitionId",
"=",
"storeInstance",
".",
"getNodesPartitionIdForKey",
"(",
"nodeId",
",",
"key",
")",
";",
"Utils",
".",
"notNull",
"(",
"keyPartitionId",
")",
";... | Given the key, figures out which partition on the local node hosts the key.
@param key
@return | [
"Given",
"the",
"key",
"figures",
"out",
"which",
"partition",
"on",
"the",
"local",
"node",
"hosts",
"the",
"key",
"."
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/server/protocol/admin/FullScanFetchStreamRequestHandler.java#L80-L85 | train |
voldemort/voldemort | src/java/voldemort/server/protocol/admin/FullScanFetchStreamRequestHandler.java | FullScanFetchStreamRequestHandler.isItemAccepted | protected boolean isItemAccepted(byte[] key) {
boolean entryAccepted = false;
if (!fetchOrphaned) {
if (isKeyNeeded(key)) {
entryAccepted = true;
}
} else {
if (!StoreRoutingPlan.checkKeyBelongsToNode(key, nodeId, initialCluster, storeDef)) {
... | java | protected boolean isItemAccepted(byte[] key) {
boolean entryAccepted = false;
if (!fetchOrphaned) {
if (isKeyNeeded(key)) {
entryAccepted = true;
}
} else {
if (!StoreRoutingPlan.checkKeyBelongsToNode(key, nodeId, initialCluster, storeDef)) {
... | [
"protected",
"boolean",
"isItemAccepted",
"(",
"byte",
"[",
"]",
"key",
")",
"{",
"boolean",
"entryAccepted",
"=",
"false",
";",
"if",
"(",
"!",
"fetchOrphaned",
")",
"{",
"if",
"(",
"isKeyNeeded",
"(",
"key",
")",
")",
"{",
"entryAccepted",
"=",
"true",... | Determines if entry is accepted. For normal usage, this means confirming that the key is
needed. For orphan usage, this simply means confirming the key belongs to the node.
@param key
@return true iff entry is accepted. | [
"Determines",
"if",
"entry",
"is",
"accepted",
".",
"For",
"normal",
"usage",
"this",
"means",
"confirming",
"that",
"the",
"key",
"is",
"needed",
".",
"For",
"orphan",
"usage",
"this",
"simply",
"means",
"confirming",
"the",
"key",
"belongs",
"to",
"the",
... | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/server/protocol/admin/FullScanFetchStreamRequestHandler.java#L126-L138 | train |
voldemort/voldemort | src/java/voldemort/server/protocol/admin/FullScanFetchStreamRequestHandler.java | FullScanFetchStreamRequestHandler.accountForFetchedKey | protected void accountForFetchedKey(byte[] key) {
fetched++;
if (streamStats != null) {
streamStats.reportStreamingFetch(operation);
}
if (recordsPerPartition <= 0) {
return;
}
Integer keyPartitionId = getKeyPartitionId(key);
Long partiti... | java | protected void accountForFetchedKey(byte[] key) {
fetched++;
if (streamStats != null) {
streamStats.reportStreamingFetch(operation);
}
if (recordsPerPartition <= 0) {
return;
}
Integer keyPartitionId = getKeyPartitionId(key);
Long partiti... | [
"protected",
"void",
"accountForFetchedKey",
"(",
"byte",
"[",
"]",
"key",
")",
"{",
"fetched",
"++",
";",
"if",
"(",
"streamStats",
"!=",
"null",
")",
"{",
"streamStats",
".",
"reportStreamingFetch",
"(",
"operation",
")",
";",
"}",
"if",
"(",
"recordsPer... | Account for key being fetched.
@param key | [
"Account",
"for",
"key",
"being",
"fetched",
"."
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/server/protocol/admin/FullScanFetchStreamRequestHandler.java#L145-L172 | train |
voldemort/voldemort | src/java/voldemort/server/protocol/admin/FullScanFetchStreamRequestHandler.java | FullScanFetchStreamRequestHandler.determineRequestHandlerState | protected StreamRequestHandlerState determineRequestHandlerState(String itemTag) {
if (keyIterator.hasNext() && !fetchedEnoughForAllPartitions()) {
return StreamRequestHandlerState.WRITING;
} else {
logger.info("Finished fetch " + itemTag + " for store '" + storageEngine.getName... | java | protected StreamRequestHandlerState determineRequestHandlerState(String itemTag) {
if (keyIterator.hasNext() && !fetchedEnoughForAllPartitions()) {
return StreamRequestHandlerState.WRITING;
} else {
logger.info("Finished fetch " + itemTag + " for store '" + storageEngine.getName... | [
"protected",
"StreamRequestHandlerState",
"determineRequestHandlerState",
"(",
"String",
"itemTag",
")",
"{",
"if",
"(",
"keyIterator",
".",
"hasNext",
"(",
")",
"&&",
"!",
"fetchedEnoughForAllPartitions",
"(",
")",
")",
"{",
"return",
"StreamRequestHandlerState",
"."... | Determines if still WRITING or COMPLETE.
@param itemTag mad libs style string to insert into progress message.
@return state of stream request handler | [
"Determines",
"if",
"still",
"WRITING",
"or",
"COMPLETE",
"."
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/server/protocol/admin/FullScanFetchStreamRequestHandler.java#L197-L208 | train |
voldemort/voldemort | src/java/voldemort/store/AbstractStorageEngine.java | AbstractStorageEngine.resolveAndConstructVersionsToPersist | protected List<Versioned<V>> resolveAndConstructVersionsToPersist(List<Versioned<V>> valuesInStorage,
List<Versioned<V>> multiPutValues) {
List<Versioned<V>> obsoleteVals = new ArrayList<Versioned<V>>(multiPutValues.size());
// Go ove... | java | protected List<Versioned<V>> resolveAndConstructVersionsToPersist(List<Versioned<V>> valuesInStorage,
List<Versioned<V>> multiPutValues) {
List<Versioned<V>> obsoleteVals = new ArrayList<Versioned<V>>(multiPutValues.size());
// Go ove... | [
"protected",
"List",
"<",
"Versioned",
"<",
"V",
">",
">",
"resolveAndConstructVersionsToPersist",
"(",
"List",
"<",
"Versioned",
"<",
"V",
">",
">",
"valuesInStorage",
",",
"List",
"<",
"Versioned",
"<",
"V",
">",
">",
"multiPutValues",
")",
"{",
"List",
... | Computes the final list of versions to be stored, on top of what is
currently being stored. Final list is valuesInStorage modified in place
@param valuesInStorage list of versions currently in storage
@param multiPutValues list of new versions being written to storage
@return list of versions from multiPutVals that w... | [
"Computes",
"the",
"final",
"list",
"of",
"versions",
"to",
"be",
"stored",
"on",
"top",
"of",
"what",
"is",
"currently",
"being",
"stored",
".",
"Final",
"list",
"is",
"valuesInStorage",
"modified",
"in",
"place"
] | a7dbdea58032021361680faacf2782cf981c5332 | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/store/AbstractStorageEngine.java#L93-L122 | train |
stephanenicolas/toothpick | toothpick-runtime/src/main/java/toothpick/ScopeImpl.java | ScopeImpl.installInternalProvider | private <T> InternalProviderImpl installInternalProvider(Class<T> clazz, String bindingName, InternalProviderImpl<? extends T> internalProvider,
boolean isBound, boolean isTestProvider) {
if (bindingName == null) {
if (isBound) {
return installUnNamedProvider(mapClassesToUnNamedBoundProviders, c... | java | private <T> InternalProviderImpl installInternalProvider(Class<T> clazz, String bindingName, InternalProviderImpl<? extends T> internalProvider,
boolean isBound, boolean isTestProvider) {
if (bindingName == null) {
if (isBound) {
return installUnNamedProvider(mapClassesToUnNamedBoundProviders, c... | [
"private",
"<",
"T",
">",
"InternalProviderImpl",
"installInternalProvider",
"(",
"Class",
"<",
"T",
">",
"clazz",
",",
"String",
"bindingName",
",",
"InternalProviderImpl",
"<",
"?",
"extends",
"T",
">",
"internalProvider",
",",
"boolean",
"isBound",
",",
"bool... | Installs a provider either in the scope or the pool of unbound providers.
@param clazz the class for which to install the provider.
@param bindingName the name, possibly {@code null}, for which to install the scoped provider.
@param internalProvider the internal provider to install.
@param isBound whether or not the p... | [
"Installs",
"a",
"provider",
"either",
"in",
"the",
"scope",
"or",
"the",
"pool",
"of",
"unbound",
"providers",
"."
] | 54476ca9a5fa48809c15a46e43e38db9ed7e1a75 | https://github.com/stephanenicolas/toothpick/blob/54476ca9a5fa48809c15a46e43e38db9ed7e1a75/toothpick-runtime/src/main/java/toothpick/ScopeImpl.java#L479-L490 | train |
stephanenicolas/toothpick | toothpick-runtime/src/main/java/toothpick/ScopeImpl.java | ScopeImpl.reset | @Override
protected void reset() {
super.reset();
mapClassesToNamedBoundProviders.clear();
mapClassesToUnNamedBoundProviders.clear();
hasTestModules = false;
installBindingForScope();
} | java | @Override
protected void reset() {
super.reset();
mapClassesToNamedBoundProviders.clear();
mapClassesToUnNamedBoundProviders.clear();
hasTestModules = false;
installBindingForScope();
} | [
"@",
"Override",
"protected",
"void",
"reset",
"(",
")",
"{",
"super",
".",
"reset",
"(",
")",
";",
"mapClassesToNamedBoundProviders",
".",
"clear",
"(",
")",
";",
"mapClassesToUnNamedBoundProviders",
".",
"clear",
"(",
")",
";",
"hasTestModules",
"=",
"false"... | Resets the state of the scope.
Useful for automation testing when we want to reset the scope used to install test modules. | [
"Resets",
"the",
"state",
"of",
"the",
"scope",
".",
"Useful",
"for",
"automation",
"testing",
"when",
"we",
"want",
"to",
"reset",
"the",
"scope",
"used",
"to",
"install",
"test",
"modules",
"."
] | 54476ca9a5fa48809c15a46e43e38db9ed7e1a75 | https://github.com/stephanenicolas/toothpick/blob/54476ca9a5fa48809c15a46e43e38db9ed7e1a75/toothpick-runtime/src/main/java/toothpick/ScopeImpl.java#L541-L548 | train |
stephanenicolas/toothpick | toothpick-runtime/src/main/java/toothpick/InternalProviderImpl.java | InternalProviderImpl.get | public synchronized T get(Scope scope) {
if (instance != null) {
return instance;
}
if (providerInstance != null) {
if (isProvidingSingletonInScope) {
instance = providerInstance.get();
//gc
providerInstance = null;
return instance;
}
return provider... | java | public synchronized T get(Scope scope) {
if (instance != null) {
return instance;
}
if (providerInstance != null) {
if (isProvidingSingletonInScope) {
instance = providerInstance.get();
//gc
providerInstance = null;
return instance;
}
return provider... | [
"public",
"synchronized",
"T",
"get",
"(",
"Scope",
"scope",
")",
"{",
"if",
"(",
"instance",
"!=",
"null",
")",
"{",
"return",
"instance",
";",
"}",
"if",
"(",
"providerInstance",
"!=",
"null",
")",
"{",
"if",
"(",
"isProvidingSingletonInScope",
")",
"{... | of the unbound provider ( | [
"of",
"the",
"unbound",
"provider",
"("
] | 54476ca9a5fa48809c15a46e43e38db9ed7e1a75 | https://github.com/stephanenicolas/toothpick/blob/54476ca9a5fa48809c15a46e43e38db9ed7e1a75/toothpick-runtime/src/main/java/toothpick/InternalProviderImpl.java#L70-L126 | train |
stephanenicolas/toothpick | toothpick-runtime/src/main/java/toothpick/Toothpick.java | Toothpick.closeScope | public static void closeScope(Object name) {
//we remove the scope first, so that other threads don't see it, and see the next snapshot of the tree
ScopeNode scope = (ScopeNode) MAP_KEY_TO_SCOPE.remove(name);
if (scope != null) {
ScopeNode parentScope = scope.getParentScope();
if (parentScope !=... | java | public static void closeScope(Object name) {
//we remove the scope first, so that other threads don't see it, and see the next snapshot of the tree
ScopeNode scope = (ScopeNode) MAP_KEY_TO_SCOPE.remove(name);
if (scope != null) {
ScopeNode parentScope = scope.getParentScope();
if (parentScope !=... | [
"public",
"static",
"void",
"closeScope",
"(",
"Object",
"name",
")",
"{",
"//we remove the scope first, so that other threads don't see it, and see the next snapshot of the tree",
"ScopeNode",
"scope",
"=",
"(",
"ScopeNode",
")",
"MAP_KEY_TO_SCOPE",
".",
"remove",
"(",
"name... | Detach a scope from its parent, this will trigger the garbage collection of this scope and it's
sub-scopes
if they are not referenced outside of Toothpick.
@param name the name of the scope to close. | [
"Detach",
"a",
"scope",
"from",
"its",
"parent",
"this",
"will",
"trigger",
"the",
"garbage",
"collection",
"of",
"this",
"scope",
"and",
"it",
"s",
"sub",
"-",
"scopes",
"if",
"they",
"are",
"not",
"referenced",
"outside",
"of",
"Toothpick",
"."
] | 54476ca9a5fa48809c15a46e43e38db9ed7e1a75 | https://github.com/stephanenicolas/toothpick/blob/54476ca9a5fa48809c15a46e43e38db9ed7e1a75/toothpick-runtime/src/main/java/toothpick/Toothpick.java#L120-L132 | train |
stephanenicolas/toothpick | toothpick-runtime/src/main/java/toothpick/Toothpick.java | Toothpick.reset | public static void reset() {
for (Object name : Collections.list(MAP_KEY_TO_SCOPE.keys())) {
closeScope(name);
}
ConfigurationHolder.configuration.onScopeForestReset();
ScopeImpl.resetUnBoundProviders();
} | java | public static void reset() {
for (Object name : Collections.list(MAP_KEY_TO_SCOPE.keys())) {
closeScope(name);
}
ConfigurationHolder.configuration.onScopeForestReset();
ScopeImpl.resetUnBoundProviders();
} | [
"public",
"static",
"void",
"reset",
"(",
")",
"{",
"for",
"(",
"Object",
"name",
":",
"Collections",
".",
"list",
"(",
"MAP_KEY_TO_SCOPE",
".",
"keys",
"(",
")",
")",
")",
"{",
"closeScope",
"(",
"name",
")",
";",
"}",
"ConfigurationHolder",
".",
"con... | Clears all scopes. Useful for testing and not getting any leak... | [
"Clears",
"all",
"scopes",
".",
"Useful",
"for",
"testing",
"and",
"not",
"getting",
"any",
"leak",
"..."
] | 54476ca9a5fa48809c15a46e43e38db9ed7e1a75 | https://github.com/stephanenicolas/toothpick/blob/54476ca9a5fa48809c15a46e43e38db9ed7e1a75/toothpick-runtime/src/main/java/toothpick/Toothpick.java#L137-L143 | train |
Wikidata/Wikidata-Toolkit | wdtk-dumpfiles/src/main/java/org/wikidata/wdtk/dumpfiles/MwRevisionProcessorBroker.java | MwRevisionProcessorBroker.notifyMwRevisionProcessors | void notifyMwRevisionProcessors(MwRevision mwRevision, boolean isCurrent) {
if (mwRevision == null || mwRevision.getPageId() <= 0) {
return;
}
for (MwRevisionProcessorBroker.RevisionSubscription rs : this.revisionSubscriptions) {
if (rs.onlyCurrentRevisions == isCurrent
&& (rs.model == null || mwRevisi... | java | void notifyMwRevisionProcessors(MwRevision mwRevision, boolean isCurrent) {
if (mwRevision == null || mwRevision.getPageId() <= 0) {
return;
}
for (MwRevisionProcessorBroker.RevisionSubscription rs : this.revisionSubscriptions) {
if (rs.onlyCurrentRevisions == isCurrent
&& (rs.model == null || mwRevisi... | [
"void",
"notifyMwRevisionProcessors",
"(",
"MwRevision",
"mwRevision",
",",
"boolean",
"isCurrent",
")",
"{",
"if",
"(",
"mwRevision",
"==",
"null",
"||",
"mwRevision",
".",
"getPageId",
"(",
")",
"<=",
"0",
")",
"{",
"return",
";",
"}",
"for",
"(",
"MwRev... | Notifies all interested subscribers of the given revision.
@param mwRevision
the given revision
@param isCurrent
true if this is guaranteed to be the most current revision | [
"Notifies",
"all",
"interested",
"subscribers",
"of",
"the",
"given",
"revision",
"."
] | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-dumpfiles/src/main/java/org/wikidata/wdtk/dumpfiles/MwRevisionProcessorBroker.java#L175-L186 | train |
Wikidata/Wikidata-Toolkit | wdtk-datamodel/src/main/java/org/wikidata/wdtk/datamodel/implementation/ItemIdValueImpl.java | ItemIdValueImpl.fromIri | static ItemIdValueImpl fromIri(String iri) {
int separator = iri.lastIndexOf('/') + 1;
try {
return new ItemIdValueImpl(iri.substring(separator), iri.substring(0, separator));
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException("Invalid Wikibase entity IRI: " + iri, e);
}
} | java | static ItemIdValueImpl fromIri(String iri) {
int separator = iri.lastIndexOf('/') + 1;
try {
return new ItemIdValueImpl(iri.substring(separator), iri.substring(0, separator));
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException("Invalid Wikibase entity IRI: " + iri, e);
}
} | [
"static",
"ItemIdValueImpl",
"fromIri",
"(",
"String",
"iri",
")",
"{",
"int",
"separator",
"=",
"iri",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
"+",
"1",
";",
"try",
"{",
"return",
"new",
"ItemIdValueImpl",
"(",
"iri",
".",
"substring",
"(",
"separator",... | Parses an item IRI
@param iri
the item IRI like http://www.wikidata.org/entity/Q42
@throws IllegalArgumentException
if the IRI is invalid or does not ends with an item id | [
"Parses",
"an",
"item",
"IRI"
] | 7732851dda47e1febff406fba27bfec023f4786e | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-datamodel/src/main/java/org/wikidata/wdtk/datamodel/implementation/ItemIdValueImpl.java#L67-L74 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.