id
int32
0
165k
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
102,600
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/strategy/SqlgWhereStrategy.java
SqlgWhereStrategy.captureLabels
private void captureLabels(Step<?,?> step,Map<String,Object> stepsByLabel){ for (String s:step.getLabels()){ stepsByLabel.put(s, step); } // labels on replaced steps are not bubbled up to the graphstep if (step instanceof SqlgGraphStep<?, ?>){ SqlgGraphStep<?, ?> sgs=(SqlgGra...
java
private void captureLabels(Step<?,?> step,Map<String,Object> stepsByLabel){ for (String s:step.getLabels()){ stepsByLabel.put(s, step); } // labels on replaced steps are not bubbled up to the graphstep if (step instanceof SqlgGraphStep<?, ?>){ SqlgGraphStep<?, ?> sgs=(SqlgGra...
[ "private", "void", "captureLabels", "(", "Step", "<", "?", ",", "?", ">", "step", ",", "Map", "<", "String", ",", "Object", ">", "stepsByLabel", ")", "{", "for", "(", "String", "s", ":", "step", ".", "getLabels", "(", ")", ")", "{", "stepsByLabel", ...
add all labels for the step in the given map @param step @param stepsByLabel the map to fill up
[ "add", "all", "labels", "for", "the", "step", "in", "the", "given", "map" ]
c1845a1b31328a5ffda646873b0369ee72af56a7
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/strategy/SqlgWhereStrategy.java#L91-L108
102,601
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/structure/SqlgStartupManager.java
SqlgStartupManager.createOrUpdateGraph
private String createOrUpdateGraph(String version) { String oldVersion = null; Connection conn = this.sqlgGraph.tx().getConnection(); try { DatabaseMetaData metadata = conn.getMetaData(); String[] types = new String[]{"TABLE"}; //load the vertices ...
java
private String createOrUpdateGraph(String version) { String oldVersion = null; Connection conn = this.sqlgGraph.tx().getConnection(); try { DatabaseMetaData metadata = conn.getMetaData(); String[] types = new String[]{"TABLE"}; //load the vertices ...
[ "private", "String", "createOrUpdateGraph", "(", "String", "version", ")", "{", "String", "oldVersion", "=", "null", ";", "Connection", "conn", "=", "this", ".", "sqlgGraph", ".", "tx", "(", ")", ".", "getConnection", "(", ")", ";", "try", "{", "DatabaseMe...
create or update the graph metadata @param version the new version of the graph @return the old version of the graph, or null if there was no graph
[ "create", "or", "update", "the", "graph", "metadata" ]
c1845a1b31328a5ffda646873b0369ee72af56a7
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/structure/SqlgStartupManager.java#L176-L214
102,602
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/structure/SqlgStartupManager.java
SqlgStartupManager.getBuildVersion
String getBuildVersion() { if (this.buildVersion == null) { Properties prop = new Properties(); try { // try system URL u = ClassLoader.getSystemResource(SQLG_APPLICATION_PROPERTIES); if (u == null) { // try own class lo...
java
String getBuildVersion() { if (this.buildVersion == null) { Properties prop = new Properties(); try { // try system URL u = ClassLoader.getSystemResource(SQLG_APPLICATION_PROPERTIES); if (u == null) { // try own class lo...
[ "String", "getBuildVersion", "(", ")", "{", "if", "(", "this", ".", "buildVersion", "==", "null", ")", "{", "Properties", "prop", "=", "new", "Properties", "(", ")", ";", "try", "{", "// try system", "URL", "u", "=", "ClassLoader", ".", "getSystemResource"...
get the build version @return the build version, or null if unknown
[ "get", "the", "build", "version" ]
c1845a1b31328a5ffda646873b0369ee72af56a7
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/structure/SqlgStartupManager.java#L626-L647
102,603
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/structure/SqlgGraph.java
SqlgGraph.query
public String query(String query) { try { Connection conn = this.tx().getConnection(); ObjectNode result = this.mapper.createObjectNode(); ArrayNode dataNode = this.mapper.createArrayNode(); ArrayNode metaNode = this.mapper.createArrayNode(); Statement...
java
public String query(String query) { try { Connection conn = this.tx().getConnection(); ObjectNode result = this.mapper.createObjectNode(); ArrayNode dataNode = this.mapper.createArrayNode(); ArrayNode metaNode = this.mapper.createArrayNode(); Statement...
[ "public", "String", "query", "(", "String", "query", ")", "{", "try", "{", "Connection", "conn", "=", "this", ".", "tx", "(", ")", ".", "getConnection", "(", ")", ";", "ObjectNode", "result", "=", "this", ".", "mapper", ".", "createObjectNode", "(", ")...
This is executes a sql query and returns the result as a json string. @param query The sql to executeRegularQuery. @return The query result as json.
[ "This", "is", "executes", "a", "sql", "query", "and", "returns", "the", "result", "as", "a", "json", "string", "." ]
c1845a1b31328a5ffda646873b0369ee72af56a7
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/structure/SqlgGraph.java#L1052-L1090
102,604
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/structure/SqlgCompiledResultIterator.java
SqlgCompiledResultIterator.nextLazy
@SuppressWarnings("unchecked") private E nextLazy() { //noinspection unchecked List<Emit<SqlgElement>> result = this.elements; this.elements = null; return (E) result; }
java
@SuppressWarnings("unchecked") private E nextLazy() { //noinspection unchecked List<Emit<SqlgElement>> result = this.elements; this.elements = null; return (E) result; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "E", "nextLazy", "(", ")", "{", "//noinspection unchecked", "List", "<", "Emit", "<", "SqlgElement", ">>", "result", "=", "this", ".", "elements", ";", "this", ".", "elements", "=", "null", ";", ...
return the next lazy results @return
[ "return", "the", "next", "lazy", "results" ]
c1845a1b31328a5ffda646873b0369ee72af56a7
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/structure/SqlgCompiledResultIterator.java#L238-L244
102,605
pietermartin/sqlg
sqlg-cockroachdb-parent/sqlg-cockroachdb-dialect/src/main/java/org/umlg/sqlg/sql/dialect/CockroachdbDialect.java
CockroachdbDialect.shiftDST
@SuppressWarnings("deprecation") private static Time shiftDST(LocalTime lt) { Time t = Time.valueOf(lt); int offset = Calendar.getInstance().get(Calendar.DST_OFFSET) / 1000; // I know this are deprecated methods, but it's so much clearer than alternatives int m = t.getSeconds(); ...
java
@SuppressWarnings("deprecation") private static Time shiftDST(LocalTime lt) { Time t = Time.valueOf(lt); int offset = Calendar.getInstance().get(Calendar.DST_OFFSET) / 1000; // I know this are deprecated methods, but it's so much clearer than alternatives int m = t.getSeconds(); ...
[ "@", "SuppressWarnings", "(", "\"deprecation\"", ")", "private", "static", "Time", "shiftDST", "(", "LocalTime", "lt", ")", "{", "Time", "t", "=", "Time", ".", "valueOf", "(", "lt", ")", ";", "int", "offset", "=", "Calendar", ".", "getInstance", "(", ")"...
Postgres gets confused by DST, it sets the timezone badly and then reads the wrong value out, so we convert the value to "winter time" @param lt the current time @return the time in "winter time" if there is DST in effect today
[ "Postgres", "gets", "confused", "by", "DST", "it", "sets", "the", "timezone", "badly", "and", "then", "reads", "the", "wrong", "value", "out", "so", "we", "convert", "the", "value", "to", "winter", "time" ]
c1845a1b31328a5ffda646873b0369ee72af56a7
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-cockroachdb-parent/sqlg-cockroachdb-dialect/src/main/java/org/umlg/sqlg/sql/dialect/CockroachdbDialect.java#L1656-L1664
102,606
pietermartin/sqlg
sqlg-postgres-parent/sqlg-postgres-dialect/src/main/java/org/umlg/sqlg/sql/dialect/PostgresDialect.java
PostgresDialect.sqlTypeToPropertyType
@Override public PropertyType sqlTypeToPropertyType(SqlgGraph sqlgGraph, String schema, String table, String column, int sqlType, String typeName, ListIterator<Triple<String, Integer, String>> metaDataIter) { switch (sqlType) { case Types.BIT: return PropertyType.BOOLEAN; ...
java
@Override public PropertyType sqlTypeToPropertyType(SqlgGraph sqlgGraph, String schema, String table, String column, int sqlType, String typeName, ListIterator<Triple<String, Integer, String>> metaDataIter) { switch (sqlType) { case Types.BIT: return PropertyType.BOOLEAN; ...
[ "@", "Override", "public", "PropertyType", "sqlTypeToPropertyType", "(", "SqlgGraph", "sqlgGraph", ",", "String", "schema", ",", "String", "table", ",", "String", "column", ",", "int", "sqlType", ",", "String", "typeName", ",", "ListIterator", "<", "Triple", "<"...
This is only used for upgrading from pre sqlg_schema sqlg to a sqlg_schema
[ "This", "is", "only", "used", "for", "upgrading", "from", "pre", "sqlg_schema", "sqlg", "to", "a", "sqlg_schema" ]
c1845a1b31328a5ffda646873b0369ee72af56a7
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-postgres-parent/sqlg-postgres-dialect/src/main/java/org/umlg/sqlg/sql/dialect/PostgresDialect.java#L2108-L2152
102,607
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/step/SqlgVertexStep.java
SqlgVertexStep.elements
private ListIterator<List<Emit<E>>> elements(SchemaTable schemaTable, SchemaTableTree rootSchemaTableTree) { this.sqlgGraph.tx().readWrite(); if (this.sqlgGraph.getSqlDialect().supportsBatchMode() && this.sqlgGraph.tx().getBatchManager().isStreaming()) { throw new IllegalStateException("stre...
java
private ListIterator<List<Emit<E>>> elements(SchemaTable schemaTable, SchemaTableTree rootSchemaTableTree) { this.sqlgGraph.tx().readWrite(); if (this.sqlgGraph.getSqlDialect().supportsBatchMode() && this.sqlgGraph.tx().getBatchManager().isStreaming()) { throw new IllegalStateException("stre...
[ "private", "ListIterator", "<", "List", "<", "Emit", "<", "E", ">", ">", ">", "elements", "(", "SchemaTable", "schemaTable", ",", "SchemaTableTree", "rootSchemaTableTree", ")", "{", "this", ".", "sqlgGraph", ".", "tx", "(", ")", ".", "readWrite", "(", ")",...
Called from SqlgVertexStepCompiler which compiled VertexStep and HasSteps. This is only called when not in BatchMode
[ "Called", "from", "SqlgVertexStepCompiler", "which", "compiled", "VertexStep", "and", "HasSteps", ".", "This", "is", "only", "called", "when", "not", "in", "BatchMode" ]
c1845a1b31328a5ffda646873b0369ee72af56a7
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/step/SqlgVertexStep.java#L238-L248
102,608
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/AbstractLabel.java
AbstractLabel.removeColumn
void removeColumn(String schema, String table, String column) { StringBuilder sql = new StringBuilder("ALTER TABLE "); sql.append(sqlgGraph.getSqlDialect().maybeWrapInQoutes(schema)); sql.append("."); sql.append(sqlgGraph.getSqlDialect().maybeWrapInQoutes(table)); sql.append(" DR...
java
void removeColumn(String schema, String table, String column) { StringBuilder sql = new StringBuilder("ALTER TABLE "); sql.append(sqlgGraph.getSqlDialect().maybeWrapInQoutes(schema)); sql.append("."); sql.append(sqlgGraph.getSqlDialect().maybeWrapInQoutes(table)); sql.append(" DR...
[ "void", "removeColumn", "(", "String", "schema", ",", "String", "table", ",", "String", "column", ")", "{", "StringBuilder", "sql", "=", "new", "StringBuilder", "(", "\"ALTER TABLE \"", ")", ";", "sql", ".", "append", "(", "sqlgGraph", ".", "getSqlDialect", ...
remove a column from the table @param schema the schema @param table the table name @param column the column name
[ "remove", "a", "column", "from", "the", "table" ]
c1845a1b31328a5ffda646873b0369ee72af56a7
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/AbstractLabel.java#L1002-L1024
102,609
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/AbstractLabel.java
AbstractLabel.removeIndex
void removeIndex(Index idx, boolean preserveData) { this.getSchema().getTopology().lock(); if (!uncommittedRemovedIndexes.contains(idx.getName())) { uncommittedRemovedIndexes.add(idx.getName()); TopologyManager.removeIndex(this.sqlgGraph, idx); if (!preserveData) { ...
java
void removeIndex(Index idx, boolean preserveData) { this.getSchema().getTopology().lock(); if (!uncommittedRemovedIndexes.contains(idx.getName())) { uncommittedRemovedIndexes.add(idx.getName()); TopologyManager.removeIndex(this.sqlgGraph, idx); if (!preserveData) { ...
[ "void", "removeIndex", "(", "Index", "idx", ",", "boolean", "preserveData", ")", "{", "this", ".", "getSchema", "(", ")", ".", "getTopology", "(", ")", ".", "lock", "(", ")", ";", "if", "(", "!", "uncommittedRemovedIndexes", ".", "contains", "(", "idx", ...
remove a given index that was on this label @param idx the index @param preserveData should we keep the SQL data
[ "remove", "a", "given", "index", "that", "was", "on", "this", "label" ]
c1845a1b31328a5ffda646873b0369ee72af56a7
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/AbstractLabel.java#L1032-L1042
102,610
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/util/SqlgUtil.java
SqlgUtil.setKeyValuesAsParameterUsingPropertyColumn
public static int setKeyValuesAsParameterUsingPropertyColumn(SqlgGraph sqlgGraph, int i, PreparedStatement preparedStatement, Map<String, Pair<PropertyType, Object>> properties) throws SQLException { i = setKeyValuesAsParameterUsingPropertyColumn(sqlgGraph, true, i, preparedStatement, properties.values()); ...
java
public static int setKeyValuesAsParameterUsingPropertyColumn(SqlgGraph sqlgGraph, int i, PreparedStatement preparedStatement, Map<String, Pair<PropertyType, Object>> properties) throws SQLException { i = setKeyValuesAsParameterUsingPropertyColumn(sqlgGraph, true, i, preparedStatement, properties.values()); ...
[ "public", "static", "int", "setKeyValuesAsParameterUsingPropertyColumn", "(", "SqlgGraph", "sqlgGraph", ",", "int", "i", ",", "PreparedStatement", "preparedStatement", ",", "Map", "<", "String", ",", "Pair", "<", "PropertyType", ",", "Object", ">", ">", "properties"...
This is called for inserts
[ "This", "is", "called", "for", "inserts" ]
c1845a1b31328a5ffda646873b0369ee72af56a7
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/util/SqlgUtil.java#L323-L326
102,611
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/util/SqlgUtil.java
SqlgUtil.validateVertexKeysValues
public static Triple<Map<String, PropertyType>, Map<String, Object>, Map<String, Object>> validateVertexKeysValues(SqlDialect sqlDialect, Object[] keyValues) { Map<String, Object> resultAllValues = new LinkedHashMap<>(); Map<String, Object> resultNotNullValues = new LinkedHashMap<>(); Map<String...
java
public static Triple<Map<String, PropertyType>, Map<String, Object>, Map<String, Object>> validateVertexKeysValues(SqlDialect sqlDialect, Object[] keyValues) { Map<String, Object> resultAllValues = new LinkedHashMap<>(); Map<String, Object> resultNotNullValues = new LinkedHashMap<>(); Map<String...
[ "public", "static", "Triple", "<", "Map", "<", "String", ",", "PropertyType", ">", ",", "Map", "<", "String", ",", "Object", ">", ",", "Map", "<", "String", ",", "Object", ">", ">", "validateVertexKeysValues", "(", "SqlDialect", "sqlDialect", ",", "Object"...
Validates the key values and converts it into a Triple with three maps. The left map is a map of keys together with their PropertyType. The middle map is a map of keys together with their values. The right map is a map of keys with values where the values are guaranteed not to be null. @param sqlDialect The dialect. ...
[ "Validates", "the", "key", "values", "and", "converts", "it", "into", "a", "Triple", "with", "three", "maps", ".", "The", "left", "map", "is", "a", "map", "of", "keys", "together", "with", "their", "PropertyType", ".", "The", "middle", "map", "is", "a", ...
c1845a1b31328a5ffda646873b0369ee72af56a7
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/util/SqlgUtil.java#L616-L647
102,612
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/sql/parse/GremlinParser.java
GremlinParser.parse
public SchemaTableTree parse(SchemaTable schemaTable, ReplacedStepTree replacedStepTree) { ReplacedStep<?, ?> rootReplacedStep = replacedStepTree.root().getReplacedStep(); Preconditions.checkArgument(!rootReplacedStep.isGraphStep(), "Expected VertexStep, found GraphStep"); Set<SchemaTableTree> ...
java
public SchemaTableTree parse(SchemaTable schemaTable, ReplacedStepTree replacedStepTree) { ReplacedStep<?, ?> rootReplacedStep = replacedStepTree.root().getReplacedStep(); Preconditions.checkArgument(!rootReplacedStep.isGraphStep(), "Expected VertexStep, found GraphStep"); Set<SchemaTableTree> ...
[ "public", "SchemaTableTree", "parse", "(", "SchemaTable", "schemaTable", ",", "ReplacedStepTree", "replacedStepTree", ")", "{", "ReplacedStep", "<", "?", ",", "?", ">", "rootReplacedStep", "=", "replacedStepTree", ".", "root", "(", ")", ".", "getReplacedStep", "("...
This is only called for vertex steps. Constructs the label paths from the given schemaTable to the leaf vertex labels for the gremlin query. For each path Sqlg will executeRegularQuery a sql query. The union of the queries is the result the gremlin query. The vertex labels can be calculated from the steps. @param sche...
[ "This", "is", "only", "called", "for", "vertex", "steps", ".", "Constructs", "the", "label", "paths", "from", "the", "given", "schemaTable", "to", "the", "leaf", "vertex", "labels", "for", "the", "gremlin", "query", ".", "For", "each", "path", "Sqlg", "wil...
c1845a1b31328a5ffda646873b0369ee72af56a7
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/sql/parse/GremlinParser.java#L53-L71
102,613
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/Schema.java
Schema.createSchemaOnDb
private void createSchemaOnDb() { StringBuilder sql = new StringBuilder(); sql.append(topology.getSqlgGraph().getSqlDialect().createSchemaStatement(this.name)); if (this.sqlgGraph.getSqlDialect().needsSemicolon()) { sql.append(";"); } if (logger.isDebugEnabled()) { ...
java
private void createSchemaOnDb() { StringBuilder sql = new StringBuilder(); sql.append(topology.getSqlgGraph().getSqlDialect().createSchemaStatement(this.name)); if (this.sqlgGraph.getSqlDialect().needsSemicolon()) { sql.append(";"); } if (logger.isDebugEnabled()) { ...
[ "private", "void", "createSchemaOnDb", "(", ")", "{", "StringBuilder", "sql", "=", "new", "StringBuilder", "(", ")", ";", "sql", ".", "append", "(", "topology", ".", "getSqlgGraph", "(", ")", ".", "getSqlDialect", "(", ")", ".", "createSchemaStatement", "(",...
Creates a new schema on the database. i.e. 'CREATE SCHEMA...' sql statement.
[ "Creates", "a", "new", "schema", "on", "the", "database", ".", "i", ".", "e", ".", "CREATE", "SCHEMA", "...", "sql", "statement", "." ]
c1845a1b31328a5ffda646873b0369ee72af56a7
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/Schema.java#L569-L585
102,614
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/Schema.java
Schema.getAllTables
Map<String, Map<String, PropertyType>> getAllTables() { Map<String, Map<String, PropertyType>> result = new HashMap<>(); for (Map.Entry<String, VertexLabel> vertexLabelEntry : this.vertexLabels.entrySet()) { String vertexQualifiedName = this.name + "." + VERTEX_PREFIX + vertexLabelEntry.getV...
java
Map<String, Map<String, PropertyType>> getAllTables() { Map<String, Map<String, PropertyType>> result = new HashMap<>(); for (Map.Entry<String, VertexLabel> vertexLabelEntry : this.vertexLabels.entrySet()) { String vertexQualifiedName = this.name + "." + VERTEX_PREFIX + vertexLabelEntry.getV...
[ "Map", "<", "String", ",", "Map", "<", "String", ",", "PropertyType", ">", ">", "getAllTables", "(", ")", "{", "Map", "<", "String", ",", "Map", "<", "String", ",", "PropertyType", ">", ">", "result", "=", "new", "HashMap", "<>", "(", ")", ";", "fo...
remove in favour of PropertyColumn
[ "remove", "in", "favour", "of", "PropertyColumn" ]
c1845a1b31328a5ffda646873b0369ee72af56a7
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/Schema.java#L676-L694
102,615
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/Schema.java
Schema.loadVertexIndices
void loadVertexIndices(GraphTraversalSource traversalSource, Vertex schemaVertex) { List<Path> indices = traversalSource .V(schemaVertex) .out(SQLG_SCHEMA_SCHEMA_VERTEX_EDGE).as("vertex") .out(SQLG_SCHEMA_VERTEX_INDEX_EDGE).as("index") .outE(SQLG_S...
java
void loadVertexIndices(GraphTraversalSource traversalSource, Vertex schemaVertex) { List<Path> indices = traversalSource .V(schemaVertex) .out(SQLG_SCHEMA_SCHEMA_VERTEX_EDGE).as("vertex") .out(SQLG_SCHEMA_VERTEX_INDEX_EDGE).as("index") .outE(SQLG_S...
[ "void", "loadVertexIndices", "(", "GraphTraversalSource", "traversalSource", ",", "Vertex", "schemaVertex", ")", "{", "List", "<", "Path", ">", "indices", "=", "traversalSource", ".", "V", "(", "schemaVertex", ")", ".", "out", "(", "SQLG_SCHEMA_SCHEMA_VERTEX_EDGE", ...
load indices for all vertices in schema @param traversalSource @param schemaVertex
[ "load", "indices", "for", "all", "vertices", "in", "schema" ]
c1845a1b31328a5ffda646873b0369ee72af56a7
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/Schema.java#L1205-L1266
102,616
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/Schema.java
Schema.removeEdgeLabel
void removeEdgeLabel(EdgeLabel edgeLabel, boolean preserveData) { getTopology().lock(); String fn = this.name + "." + EDGE_PREFIX + edgeLabel.getName(); if (!uncommittedRemovedEdgeLabels.contains(fn)) { uncommittedRemovedEdgeLabels.add(fn); TopologyManager.removeEdgeLabe...
java
void removeEdgeLabel(EdgeLabel edgeLabel, boolean preserveData) { getTopology().lock(); String fn = this.name + "." + EDGE_PREFIX + edgeLabel.getName(); if (!uncommittedRemovedEdgeLabels.contains(fn)) { uncommittedRemovedEdgeLabels.add(fn); TopologyManager.removeEdgeLabe...
[ "void", "removeEdgeLabel", "(", "EdgeLabel", "edgeLabel", ",", "boolean", "preserveData", ")", "{", "getTopology", "(", ")", ".", "lock", "(", ")", ";", "String", "fn", "=", "this", ".", "name", "+", "\".\"", "+", "EDGE_PREFIX", "+", "edgeLabel", ".", "g...
remove a given edge label @param edgeLabel the edge label @param preserveData should we keep the SQL data
[ "remove", "a", "given", "edge", "label" ]
c1845a1b31328a5ffda646873b0369ee72af56a7
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/Schema.java#L1757-L1776
102,617
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/Schema.java
Schema.removeVertexLabel
void removeVertexLabel(VertexLabel vertexLabel, boolean preserveData) { getTopology().lock(); String fn = this.name + "." + VERTEX_PREFIX + vertexLabel.getName(); if (!uncommittedRemovedVertexLabels.contains(fn)) { uncommittedRemovedVertexLabels.add(fn); TopologyManager.r...
java
void removeVertexLabel(VertexLabel vertexLabel, boolean preserveData) { getTopology().lock(); String fn = this.name + "." + VERTEX_PREFIX + vertexLabel.getName(); if (!uncommittedRemovedVertexLabels.contains(fn)) { uncommittedRemovedVertexLabels.add(fn); TopologyManager.r...
[ "void", "removeVertexLabel", "(", "VertexLabel", "vertexLabel", ",", "boolean", "preserveData", ")", "{", "getTopology", "(", ")", ".", "lock", "(", ")", ";", "String", "fn", "=", "this", ".", "name", "+", "\".\"", "+", "VERTEX_PREFIX", "+", "vertexLabel", ...
remove a given vertex label @param vertexLabel the vertex label @param preserveData should we keep the SQL data
[ "remove", "a", "given", "vertex", "label" ]
c1845a1b31328a5ffda646873b0369ee72af56a7
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/Schema.java#L1784-L1802
102,618
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/Schema.java
Schema.removeGlobalUniqueIndex
void removeGlobalUniqueIndex(GlobalUniqueIndex index, boolean preserveData) { getTopology().lock(); String fn = index.getName(); if (!uncommittedRemovedGlobalUniqueIndexes.contains(fn)) { uncommittedRemovedGlobalUniqueIndexes.add(fn); TopologyManager.removeGlobalUniqueInd...
java
void removeGlobalUniqueIndex(GlobalUniqueIndex index, boolean preserveData) { getTopology().lock(); String fn = index.getName(); if (!uncommittedRemovedGlobalUniqueIndexes.contains(fn)) { uncommittedRemovedGlobalUniqueIndexes.add(fn); TopologyManager.removeGlobalUniqueInd...
[ "void", "removeGlobalUniqueIndex", "(", "GlobalUniqueIndex", "index", ",", "boolean", "preserveData", ")", "{", "getTopology", "(", ")", ".", "lock", "(", ")", ";", "String", "fn", "=", "index", ".", "getName", "(", ")", ";", "if", "(", "!", "uncommittedRe...
remove the given global unique index @param index the index to remove @param preserveData should we keep the sql data?
[ "remove", "the", "given", "global", "unique", "index" ]
c1845a1b31328a5ffda646873b0369ee72af56a7
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/Schema.java#L1810-L1822
102,619
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/Schema.java
Schema.delete
void delete() { StringBuilder sql = new StringBuilder(); sql.append("DROP SCHEMA "); sql.append(this.sqlgGraph.getSqlDialect().maybeWrapInQoutes(this.name)); if (this.sqlgGraph.getSqlDialect().supportsCascade()) { sql.append(" CASCADE"); } if (this.sqlgGraph.g...
java
void delete() { StringBuilder sql = new StringBuilder(); sql.append("DROP SCHEMA "); sql.append(this.sqlgGraph.getSqlDialect().maybeWrapInQoutes(this.name)); if (this.sqlgGraph.getSqlDialect().supportsCascade()) { sql.append(" CASCADE"); } if (this.sqlgGraph.g...
[ "void", "delete", "(", ")", "{", "StringBuilder", "sql", "=", "new", "StringBuilder", "(", ")", ";", "sql", ".", "append", "(", "\"DROP SCHEMA \"", ")", ";", "sql", ".", "append", "(", "this", ".", "sqlgGraph", ".", "getSqlDialect", "(", ")", ".", "may...
delete schema in DB
[ "delete", "schema", "in", "DB" ]
c1845a1b31328a5ffda646873b0369ee72af56a7
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/Schema.java#L1827-L1847
102,620
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/VertexLabel.java
VertexLabel.getOutEdgeLabel
public Optional<EdgeLabel> getOutEdgeLabel(String edgeLabelName) { EdgeLabel edgeLabel = getOutEdgeLabels().get(this.schema.getName() + "." + edgeLabelName); if (edgeLabel != null) { return Optional.of(edgeLabel); } return Optional.empty(); }
java
public Optional<EdgeLabel> getOutEdgeLabel(String edgeLabelName) { EdgeLabel edgeLabel = getOutEdgeLabels().get(this.schema.getName() + "." + edgeLabelName); if (edgeLabel != null) { return Optional.of(edgeLabel); } return Optional.empty(); }
[ "public", "Optional", "<", "EdgeLabel", ">", "getOutEdgeLabel", "(", "String", "edgeLabelName", ")", "{", "EdgeLabel", "edgeLabel", "=", "getOutEdgeLabels", "(", ")", ".", "get", "(", "this", ".", "schema", ".", "getName", "(", ")", "+", "\".\"", "+", "edg...
Out EdgeLabels are always in the same schema as the this VertexLabel' schema. So the edgeLabelName must not contain the schema prefix @param edgeLabelName @return
[ "Out", "EdgeLabels", "are", "always", "in", "the", "same", "schema", "as", "the", "this", "VertexLabel", "schema", ".", "So", "the", "edgeLabelName", "must", "not", "contain", "the", "schema", "prefix" ]
c1845a1b31328a5ffda646873b0369ee72af56a7
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/VertexLabel.java#L209-L215
102,621
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/VertexLabel.java
VertexLabel.removeEdgeRole
void removeEdgeRole(EdgeRole er, boolean preserveData) { if (er.getVertexLabel() != this) { throw new IllegalStateException("Trying to remove a EdgeRole from a non owner VertexLabel"); } Collection<VertexLabel> ers; switch (er.getDirection()) { // we don't support...
java
void removeEdgeRole(EdgeRole er, boolean preserveData) { if (er.getVertexLabel() != this) { throw new IllegalStateException("Trying to remove a EdgeRole from a non owner VertexLabel"); } Collection<VertexLabel> ers; switch (er.getDirection()) { // we don't support...
[ "void", "removeEdgeRole", "(", "EdgeRole", "er", ",", "boolean", "preserveData", ")", "{", "if", "(", "er", ".", "getVertexLabel", "(", ")", "!=", "this", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Trying to remove a EdgeRole from a non owner VertexL...
remove a given edge role @param er the edge role @param preserveData should we keep the SQL data
[ "remove", "a", "given", "edge", "role" ]
c1845a1b31328a5ffda646873b0369ee72af56a7
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/VertexLabel.java#L1061-L1103
102,622
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/sql/dialect/BaseSqlDialect.java
BaseSqlDialect.escapeQuotes
protected String escapeQuotes(Object o) { if (o != null) { return o.toString().replace("'", "''"); } return null; }
java
protected String escapeQuotes(Object o) { if (o != null) { return o.toString().replace("'", "''"); } return null; }
[ "protected", "String", "escapeQuotes", "(", "Object", "o", ")", "{", "if", "(", "o", "!=", "null", ")", "{", "return", "o", ".", "toString", "(", ")", ".", "replace", "(", "\"'\"", ",", "\"''\"", ")", ";", "}", "return", "null", ";", "}" ]
escape quotes by doubling them when we need a string inside quotes @param o @return
[ "escape", "quotes", "by", "doubling", "them", "when", "we", "need", "a", "string", "inside", "quotes" ]
c1845a1b31328a5ffda646873b0369ee72af56a7
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/sql/dialect/BaseSqlDialect.java#L1197-L1202
102,623
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/EdgeLabel.java
EdgeLabel.delete
void delete() { String schema = getSchema().getName(); String tableName = EDGE_PREFIX + getLabel(); SqlDialect sqlDialect = this.sqlgGraph.getSqlDialect(); sqlDialect.assertTableName(tableName); StringBuilder sql = new StringBuilder("DROP TABLE IF EXISTS "); sql.append(s...
java
void delete() { String schema = getSchema().getName(); String tableName = EDGE_PREFIX + getLabel(); SqlDialect sqlDialect = this.sqlgGraph.getSqlDialect(); sqlDialect.assertTableName(tableName); StringBuilder sql = new StringBuilder("DROP TABLE IF EXISTS "); sql.append(s...
[ "void", "delete", "(", ")", "{", "String", "schema", "=", "getSchema", "(", ")", ".", "getName", "(", ")", ";", "String", "tableName", "=", "EDGE_PREFIX", "+", "getLabel", "(", ")", ";", "SqlDialect", "sqlDialect", "=", "this", ".", "sqlgGraph", ".", "...
delete the table
[ "delete", "the", "table" ]
c1845a1b31328a5ffda646873b0369ee72af56a7
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/EdgeLabel.java#L1190-L1215
102,624
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/EdgeLabel.java
EdgeLabel.removeOutVertexLabel
void removeOutVertexLabel(VertexLabel lbl, boolean preserveData) { this.uncommittedRemovedOutVertexLabels.add(lbl); if (!preserveData) { deleteColumn(lbl.getFullName() + Topology.OUT_VERTEX_COLUMN_END); } }
java
void removeOutVertexLabel(VertexLabel lbl, boolean preserveData) { this.uncommittedRemovedOutVertexLabels.add(lbl); if (!preserveData) { deleteColumn(lbl.getFullName() + Topology.OUT_VERTEX_COLUMN_END); } }
[ "void", "removeOutVertexLabel", "(", "VertexLabel", "lbl", ",", "boolean", "preserveData", ")", "{", "this", ".", "uncommittedRemovedOutVertexLabels", ".", "add", "(", "lbl", ")", ";", "if", "(", "!", "preserveData", ")", "{", "deleteColumn", "(", "lbl", ".", ...
remove a vertex label from the out collection @param lbl the vertex label @param preserveData should we keep the sql data?
[ "remove", "a", "vertex", "label", "from", "the", "out", "collection" ]
c1845a1b31328a5ffda646873b0369ee72af56a7
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/EdgeLabel.java#L1232-L1237
102,625
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/EdgeLabel.java
EdgeLabel.removeInVertexLabel
void removeInVertexLabel(VertexLabel lbl, boolean preserveData) { this.uncommittedRemovedInVertexLabels.add(lbl); if (!preserveData) { deleteColumn(lbl.getFullName() + Topology.IN_VERTEX_COLUMN_END); } }
java
void removeInVertexLabel(VertexLabel lbl, boolean preserveData) { this.uncommittedRemovedInVertexLabels.add(lbl); if (!preserveData) { deleteColumn(lbl.getFullName() + Topology.IN_VERTEX_COLUMN_END); } }
[ "void", "removeInVertexLabel", "(", "VertexLabel", "lbl", ",", "boolean", "preserveData", ")", "{", "this", ".", "uncommittedRemovedInVertexLabels", ".", "add", "(", "lbl", ")", ";", "if", "(", "!", "preserveData", ")", "{", "deleteColumn", "(", "lbl", ".", ...
remove a vertex label from the in collection @param lbl the vertex label @param preserveData should we keep the sql data?
[ "remove", "a", "vertex", "label", "from", "the", "in", "collection" ]
c1845a1b31328a5ffda646873b0369ee72af56a7
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/EdgeLabel.java#L1245-L1250
102,626
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/strategy/VertexStrategy.java
VertexStrategy.doFirst
@SuppressWarnings("unchecked") @Override protected boolean doFirst(ListIterator<Step<?, ?>> stepIterator, Step<?, ?> step, MutableInt pathCount) { if (step instanceof SelectOneStep) { if (stepIterator.hasNext()) { stepIterator.next(); return true; ...
java
@SuppressWarnings("unchecked") @Override protected boolean doFirst(ListIterator<Step<?, ?>> stepIterator, Step<?, ?> step, MutableInt pathCount) { if (step instanceof SelectOneStep) { if (stepIterator.hasNext()) { stepIterator.next(); return true; ...
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "@", "Override", "protected", "boolean", "doFirst", "(", "ListIterator", "<", "Step", "<", "?", ",", "?", ">", ">", "stepIterator", ",", "Step", "<", "?", ",", "?", ">", "step", ",", "MutableInt", "path...
EdgeOtherVertexStep can not be optimized as the direction information is lost. @param stepIterator The steps to iterate. Unused for the VertexStrategy @param step The current step. @param pathCount The path count. @return true if the optimization can continue else false.
[ "EdgeOtherVertexStep", "can", "not", "be", "optimized", "as", "the", "direction", "information", "is", "lost", "." ]
c1845a1b31328a5ffda646873b0369ee72af56a7
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/strategy/VertexStrategy.java#L92-L122
102,627
adminfaces/admin-persistence
src/main/java/com/github/adminfaces/persistence/service/CrudService.java
CrudService.count
public Long count(Criteria<T, T> criteria) { SingularAttribute<? super T, PK> id = getEntityManager().getMetamodel().entity(entityClass).getId(entityKey); return criteria.select(Long.class, countDistinct(id)) .getSingleResult(); }
java
public Long count(Criteria<T, T> criteria) { SingularAttribute<? super T, PK> id = getEntityManager().getMetamodel().entity(entityClass).getId(entityKey); return criteria.select(Long.class, countDistinct(id)) .getSingleResult(); }
[ "public", "Long", "count", "(", "Criteria", "<", "T", ",", "T", ">", "criteria", ")", "{", "SingularAttribute", "<", "?", "super", "T", ",", "PK", ">", "id", "=", "getEntityManager", "(", ")", ".", "getMetamodel", "(", ")", ".", "entity", "(", "entit...
Count using a pre populated criteria @param criteria @return
[ "Count", "using", "a", "pre", "populated", "criteria" ]
fe065eed73781d01f14a4eb11910acc6a4150b9e
https://github.com/adminfaces/admin-persistence/blob/fe065eed73781d01f14a4eb11910acc6a4150b9e/src/main/java/com/github/adminfaces/persistence/service/CrudService.java#L192-L196
102,628
adminfaces/admin-persistence
src/main/java/com/github/adminfaces/persistence/bean/CrudMB.java
CrudMB.init
public void init() { if (FacesContext.getCurrentInstance().getPartialViewContext().isAjaxRequest()) { return; } if (id != null && !"".equals(id)) { entity = crudService.findById(id); if (entity == null) { log.info(String.format("Entity not fou...
java
public void init() { if (FacesContext.getCurrentInstance().getPartialViewContext().isAjaxRequest()) { return; } if (id != null && !"".equals(id)) { entity = crudService.findById(id); if (entity == null) { log.info(String.format("Entity not fou...
[ "public", "void", "init", "(", ")", "{", "if", "(", "FacesContext", ".", "getCurrentInstance", "(", ")", ".", "getPartialViewContext", "(", ")", ".", "isAjaxRequest", "(", ")", ")", "{", "return", ";", "}", "if", "(", "id", "!=", "null", "&&", "!", "...
called via preRenderView or viewAction
[ "called", "via", "preRenderView", "or", "viewAction" ]
fe065eed73781d01f14a4eb11910acc6a4150b9e
https://github.com/adminfaces/admin-persistence/blob/fe065eed73781d01f14a4eb11910acc6a4150b9e/src/main/java/com/github/adminfaces/persistence/bean/CrudMB.java#L86-L99
102,629
jeremiehuchet/nominatim-java-api
src/main/java/fr/dudie/nominatim/client/request/paramhelper/ListSerializer.java
ListSerializer.handle
@Override public String handle(final Object value) { final StringBuilder s = new StringBuilder(); if (value instanceof List) { final List<?> l = (List<?>) value; for (final Object o : l) { if (s.length() > 0) { s.append(','); ...
java
@Override public String handle(final Object value) { final StringBuilder s = new StringBuilder(); if (value instanceof List) { final List<?> l = (List<?>) value; for (final Object o : l) { if (s.length() > 0) { s.append(','); ...
[ "@", "Override", "public", "String", "handle", "(", "final", "Object", "value", ")", "{", "final", "StringBuilder", "s", "=", "new", "StringBuilder", "(", ")", ";", "if", "(", "value", "instanceof", "List", ")", "{", "final", "List", "<", "?", ">", "l"...
Converts the list to a comma separated representation. @return a comma separated list of values @see fr.dudie.nominatim.client.request.paramhelper.QueryParameterSerializer#handle(java.lang.Object)
[ "Converts", "the", "list", "to", "a", "comma", "separated", "representation", "." ]
faf3ff1003a9989eb5cc48f449b3a22c567843bf
https://github.com/jeremiehuchet/nominatim-java-api/blob/faf3ff1003a9989eb5cc48f449b3a22c567843bf/src/main/java/fr/dudie/nominatim/client/request/paramhelper/ListSerializer.java#L40-L55
102,630
jeremiehuchet/nominatim-java-api
src/main/java/fr/dudie/nominatim/client/NominatimOptions.java
NominatimOptions.mergeTo
void mergeTo(final NominatimSearchRequest request) { if (null == request.getBounded() && null != bounded) { request.setBounded(bounded); } if (null == request.getViewBox()) { request.setViewBox(viewBox); } if (null == request.getPolygonFormat()) { ...
java
void mergeTo(final NominatimSearchRequest request) { if (null == request.getBounded() && null != bounded) { request.setBounded(bounded); } if (null == request.getViewBox()) { request.setViewBox(viewBox); } if (null == request.getPolygonFormat()) { ...
[ "void", "mergeTo", "(", "final", "NominatimSearchRequest", "request", ")", "{", "if", "(", "null", "==", "request", ".", "getBounded", "(", ")", "&&", "null", "!=", "bounded", ")", "{", "request", ".", "setBounded", "(", "bounded", ")", ";", "}", "if", ...
Merge this default options to the given request. @param request the request where the result is merged
[ "Merge", "this", "default", "options", "to", "the", "given", "request", "." ]
faf3ff1003a9989eb5cc48f449b3a22c567843bf
https://github.com/jeremiehuchet/nominatim-java-api/blob/faf3ff1003a9989eb5cc48f449b3a22c567843bf/src/main/java/fr/dudie/nominatim/client/NominatimOptions.java#L132-L145
102,631
jeremiehuchet/nominatim-java-api
src/main/java/fr/dudie/nominatim/client/request/QueryParameterAnnotationHandler.java
QueryParameterAnnotationHandler.getValue
private static Object getValue(final Object o, final Field f) { try { f.setAccessible(true); return f.get(o); } catch (final IllegalArgumentException e) { LOGGER.error("failure accessing field value {}", new Object[] { f.getName(), e }); } catch (final Illegal...
java
private static Object getValue(final Object o, final Field f) { try { f.setAccessible(true); return f.get(o); } catch (final IllegalArgumentException e) { LOGGER.error("failure accessing field value {}", new Object[] { f.getName(), e }); } catch (final Illegal...
[ "private", "static", "Object", "getValue", "(", "final", "Object", "o", ",", "final", "Field", "f", ")", "{", "try", "{", "f", ".", "setAccessible", "(", "true", ")", ";", "return", "f", ".", "get", "(", "o", ")", ";", "}", "catch", "(", "final", ...
Gets a field value regardless of reflection errors. @param o the object instance @param f the field @return the field value or null if a reflection error occurred
[ "Gets", "a", "field", "value", "regardless", "of", "reflection", "errors", "." ]
faf3ff1003a9989eb5cc48f449b3a22c567843bf
https://github.com/jeremiehuchet/nominatim-java-api/blob/faf3ff1003a9989eb5cc48f449b3a22c567843bf/src/main/java/fr/dudie/nominatim/client/request/QueryParameterAnnotationHandler.java#L149-L159
102,632
jeremiehuchet/nominatim-java-api
src/main/java/fr/dudie/nominatim/client/request/NominatimSearchRequest.java
NominatimSearchRequest.addExcludedlaceId
public void addExcludedlaceId(final String placeId) { if (null == this.countryCodes) { this.excludePlaceIds = new ArrayList<String>(); } this.excludePlaceIds.add(placeId); }
java
public void addExcludedlaceId(final String placeId) { if (null == this.countryCodes) { this.excludePlaceIds = new ArrayList<String>(); } this.excludePlaceIds.add(placeId); }
[ "public", "void", "addExcludedlaceId", "(", "final", "String", "placeId", ")", "{", "if", "(", "null", "==", "this", ".", "countryCodes", ")", "{", "this", ".", "excludePlaceIds", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "}", "this", ...
If you do not want certain openstreetmap objects to appear in the search result, give a list of the place_id's you want to skip. @param placeId the place id to exclude
[ "If", "you", "do", "not", "want", "certain", "openstreetmap", "objects", "to", "appear", "in", "the", "search", "result", "give", "a", "list", "of", "the", "place_id", "s", "you", "want", "to", "skip", "." ]
faf3ff1003a9989eb5cc48f449b3a22c567843bf
https://github.com/jeremiehuchet/nominatim-java-api/blob/faf3ff1003a9989eb5cc48f449b3a22c567843bf/src/main/java/fr/dudie/nominatim/client/request/NominatimSearchRequest.java#L329-L334
102,633
hammock-project/hammock
core/src/main/java/ws/ament/hammock/core/config/CLIPropertySource.java
CLIPropertySource.parseMainArgs
public static ConfigSource parseMainArgs(String...args) { Map<String, String> result; if (args == null) { result = Collections.emptyMap(); } else { result = new HashMap<>(); String prefix = System.getProperty("main.args.prefix",""); String key = nu...
java
public static ConfigSource parseMainArgs(String...args) { Map<String, String> result; if (args == null) { result = Collections.emptyMap(); } else { result = new HashMap<>(); String prefix = System.getProperty("main.args.prefix",""); String key = nu...
[ "public", "static", "ConfigSource", "parseMainArgs", "(", "String", "...", "args", ")", "{", "Map", "<", "String", ",", "String", ">", "result", ";", "if", "(", "args", "==", "null", ")", "{", "result", "=", "Collections", ".", "emptyMap", "(", ")", ";...
Configure the main arguments, herby parsing and mapping the main arguments into configuration properties. @return the parsed main arguments as key/value pairs.
[ "Configure", "the", "main", "arguments", "herby", "parsing", "and", "mapping", "the", "main", "arguments", "into", "configuration", "properties", "." ]
0bed53f5ded295f020d74861645954abfbd69a4b
https://github.com/hammock-project/hammock/blob/0bed53f5ded295f020d74861645954abfbd69a4b/core/src/main/java/ws/ament/hammock/core/config/CLIPropertySource.java#L49-L81
102,634
federkasten/appbundle-maven-plugin
src/main/java/sh/tak/appbundler/CreateApplicationBundleMojo.java
CreateApplicationBundleMojo.addPath
private List<String> addPath(List<String> filenames, String additionalPath) { ArrayList<String> newFilenames = new ArrayList<String>(filenames.size()); for (String filename : filenames) { newFilenames.add(additionalPath + '/' + filename); } return newFilenames; }
java
private List<String> addPath(List<String> filenames, String additionalPath) { ArrayList<String> newFilenames = new ArrayList<String>(filenames.size()); for (String filename : filenames) { newFilenames.add(additionalPath + '/' + filename); } return newFilenames; }
[ "private", "List", "<", "String", ">", "addPath", "(", "List", "<", "String", ">", "filenames", ",", "String", "additionalPath", ")", "{", "ArrayList", "<", "String", ">", "newFilenames", "=", "new", "ArrayList", "<", "String", ">", "(", "filenames", ".", ...
Modifies a String list of filenames to include an additional path. @param filenames @param additionalPath @return
[ "Modifies", "a", "String", "list", "of", "filenames", "to", "include", "an", "additional", "path", "." ]
4cdaf7e0da95c83bc8a045ba40cb3eef45d25a5f
https://github.com/federkasten/appbundle-maven-plugin/blob/4cdaf7e0da95c83bc8a045ba40cb3eef45d25a5f/src/main/java/sh/tak/appbundler/CreateApplicationBundleMojo.java#L576-L583
102,635
federkasten/appbundle-maven-plugin
src/main/java/sh/tak/appbundler/CreateApplicationBundleMojo.java
CreateApplicationBundleMojo.scanFileSet
private List<String> scanFileSet(File sourceDirectory, FileSet fileSet) { final String[] emptyStringArray = {}; DirectoryScanner scanner = new DirectoryScanner(); scanner.setBasedir(sourceDirectory); if (fileSet.getIncludes() != null && !fileSet.getIncludes().isEmpty()) { s...
java
private List<String> scanFileSet(File sourceDirectory, FileSet fileSet) { final String[] emptyStringArray = {}; DirectoryScanner scanner = new DirectoryScanner(); scanner.setBasedir(sourceDirectory); if (fileSet.getIncludes() != null && !fileSet.getIncludes().isEmpty()) { s...
[ "private", "List", "<", "String", ">", "scanFileSet", "(", "File", "sourceDirectory", ",", "FileSet", "fileSet", ")", "{", "final", "String", "[", "]", "emptyStringArray", "=", "{", "}", ";", "DirectoryScanner", "scanner", "=", "new", "DirectoryScanner", "(", ...
Scan a fileset and get a list of files which it contains. @param fileset @return list of files contained within a fileset. @throws FileNotFoundException
[ "Scan", "a", "fileset", "and", "get", "a", "list", "of", "files", "which", "it", "contains", "." ]
4cdaf7e0da95c83bc8a045ba40cb3eef45d25a5f
https://github.com/federkasten/appbundle-maven-plugin/blob/4cdaf7e0da95c83bc8a045ba40cb3eef45d25a5f/src/main/java/sh/tak/appbundler/CreateApplicationBundleMojo.java#L709-L732
102,636
atomix/copycat
client/src/main/java/io/atomix/copycat/client/session/ClientSessionManager.java
ClientSessionManager.open
public CompletableFuture<Void> open() { CompletableFuture<Void> future = new CompletableFuture<>(); context.executor().execute(() -> register(new RegisterAttempt(1, future))); return future; }
java
public CompletableFuture<Void> open() { CompletableFuture<Void> future = new CompletableFuture<>(); context.executor().execute(() -> register(new RegisterAttempt(1, future))); return future; }
[ "public", "CompletableFuture", "<", "Void", ">", "open", "(", ")", "{", "CompletableFuture", "<", "Void", ">", "future", "=", "new", "CompletableFuture", "<>", "(", ")", ";", "context", ".", "executor", "(", ")", ".", "execute", "(", "(", ")", "->", "r...
Opens the session manager. @return A completable future to be called once the session manager is opened.
[ "Opens", "the", "session", "manager", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/client/src/main/java/io/atomix/copycat/client/session/ClientSessionManager.java#L59-L63
102,637
atomix/copycat
client/src/main/java/io/atomix/copycat/client/session/ClientSessionManager.java
ClientSessionManager.expire
public CompletableFuture<Void> expire() { CompletableFuture<Void> future = new CompletableFuture<>(); context.executor().execute(() -> { if (keepAlive != null) keepAlive.cancel(); state.setState(Session.State.EXPIRED); future.complete(null); }); return future; }
java
public CompletableFuture<Void> expire() { CompletableFuture<Void> future = new CompletableFuture<>(); context.executor().execute(() -> { if (keepAlive != null) keepAlive.cancel(); state.setState(Session.State.EXPIRED); future.complete(null); }); return future; }
[ "public", "CompletableFuture", "<", "Void", ">", "expire", "(", ")", "{", "CompletableFuture", "<", "Void", ">", "future", "=", "new", "CompletableFuture", "<>", "(", ")", ";", "context", ".", "executor", "(", ")", ".", "execute", "(", "(", ")", "->", ...
Expires the manager. @return A completable future to be completed once the session has been expired.
[ "Expires", "the", "manager", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/client/src/main/java/io/atomix/copycat/client/session/ClientSessionManager.java#L70-L79
102,638
atomix/copycat
client/src/main/java/io/atomix/copycat/client/session/ClientSessionManager.java
ClientSessionManager.unregister
private void unregister(boolean retryOnFailure, CompletableFuture<Void> future) { long sessionId = state.getSessionId(); // If the session is already closed, skip the unregister attempt. if (state.getState() == Session.State.CLOSED) { future.complete(null); return; } state.getLogger()....
java
private void unregister(boolean retryOnFailure, CompletableFuture<Void> future) { long sessionId = state.getSessionId(); // If the session is already closed, skip the unregister attempt. if (state.getState() == Session.State.CLOSED) { future.complete(null); return; } state.getLogger()....
[ "private", "void", "unregister", "(", "boolean", "retryOnFailure", ",", "CompletableFuture", "<", "Void", ">", "future", ")", "{", "long", "sessionId", "=", "state", ".", "getSessionId", "(", ")", ";", "// If the session is already closed, skip the unregister attempt.",...
Unregisters the session. @param future A completable future to be completed once the session is unregistered.
[ "Unregisters", "the", "session", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/client/src/main/java/io/atomix/copycat/client/session/ClientSessionManager.java#L224-L290
102,639
atomix/copycat
client/src/main/java/io/atomix/copycat/client/session/ClientSessionManager.java
ClientSessionManager.kill
public CompletableFuture<Void> kill() { return CompletableFuture.runAsync(() -> { if (keepAlive != null) keepAlive.cancel(); state.setState(Session.State.CLOSED); }, context.executor()); }
java
public CompletableFuture<Void> kill() { return CompletableFuture.runAsync(() -> { if (keepAlive != null) keepAlive.cancel(); state.setState(Session.State.CLOSED); }, context.executor()); }
[ "public", "CompletableFuture", "<", "Void", ">", "kill", "(", ")", "{", "return", "CompletableFuture", ".", "runAsync", "(", "(", ")", "->", "{", "if", "(", "keepAlive", "!=", "null", ")", "keepAlive", ".", "cancel", "(", ")", ";", "state", ".", "setSt...
Kills the client session manager. @return A completable future to be completed once the session manager is killed.
[ "Kills", "the", "client", "session", "manager", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/client/src/main/java/io/atomix/copycat/client/session/ClientSessionManager.java#L297-L303
102,640
atomix/copycat
server/src/main/java/io/atomix/copycat/server/state/PassiveState.java
PassiveState.handleAppend
protected AppendResponse handleAppend(AppendRequest request) { // If the request term is less than the current term then immediately // reply false and return our current term. The leader will receive // the updated term and step down. if (request.term() < context.getTerm()) { LOGGER.debug("{} - R...
java
protected AppendResponse handleAppend(AppendRequest request) { // If the request term is less than the current term then immediately // reply false and return our current term. The leader will receive // the updated term and step down. if (request.term() < context.getTerm()) { LOGGER.debug("{} - R...
[ "protected", "AppendResponse", "handleAppend", "(", "AppendRequest", "request", ")", "{", "// If the request term is less than the current term then immediately", "// reply false and return our current term. The leader will receive", "// the updated term and step down.", "if", "(", "reques...
Handles an append request.
[ "Handles", "an", "append", "request", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/state/PassiveState.java#L120-L135
102,641
atomix/copycat
server/src/main/java/io/atomix/copycat/server/state/PassiveState.java
PassiveState.checkGlobalIndex
protected AppendResponse checkGlobalIndex(AppendRequest request) { // If the globalIndex has changed and is not present in the local log, truncate the log. // This ensures that if major compaction progressed on any server beyond the entries in this // server's log that this server receives all entries after...
java
protected AppendResponse checkGlobalIndex(AppendRequest request) { // If the globalIndex has changed and is not present in the local log, truncate the log. // This ensures that if major compaction progressed on any server beyond the entries in this // server's log that this server receives all entries after...
[ "protected", "AppendResponse", "checkGlobalIndex", "(", "AppendRequest", "request", ")", "{", "// If the globalIndex has changed and is not present in the local log, truncate the log.", "// This ensures that if major compaction progressed on any server beyond the entries in this", "// server's l...
Checks whether the log needs to be truncated based on the globalIndex.
[ "Checks", "whether", "the", "log", "needs", "to", "be", "truncated", "based", "on", "the", "globalIndex", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/state/PassiveState.java#L140-L161
102,642
atomix/copycat
server/src/main/java/io/atomix/copycat/server/state/PassiveState.java
PassiveState.checkPreviousEntry
protected AppendResponse checkPreviousEntry(AppendRequest request) { if (request.logIndex() != 0 && context.getLog().isEmpty()) { LOGGER.debug("{} - Rejected {}: Previous index ({}) is greater than the local log's last index ({})", context.getCluster().member().address(), request, request.logIndex(), context....
java
protected AppendResponse checkPreviousEntry(AppendRequest request) { if (request.logIndex() != 0 && context.getLog().isEmpty()) { LOGGER.debug("{} - Rejected {}: Previous index ({}) is greater than the local log's last index ({})", context.getCluster().member().address(), request, request.logIndex(), context....
[ "protected", "AppendResponse", "checkPreviousEntry", "(", "AppendRequest", "request", ")", "{", "if", "(", "request", ".", "logIndex", "(", ")", "!=", "0", "&&", "context", ".", "getLog", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "LOGGER", ".", "debu...
Checks the previous entry in the append request for consistency.
[ "Checks", "the", "previous", "entry", "in", "the", "append", "request", "for", "consistency", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/state/PassiveState.java#L166-L185
102,643
atomix/copycat
server/src/main/java/io/atomix/copycat/server/state/PassiveState.java
PassiveState.appendEntries
protected AppendResponse appendEntries(AppendRequest request) { // Get the last entry index or default to the request log index. long lastEntryIndex = request.logIndex(); if (!request.entries().isEmpty()) { lastEntryIndex = request.entries().get(request.entries().size() - 1).getIndex(); } // ...
java
protected AppendResponse appendEntries(AppendRequest request) { // Get the last entry index or default to the request log index. long lastEntryIndex = request.logIndex(); if (!request.entries().isEmpty()) { lastEntryIndex = request.entries().get(request.entries().size() - 1).getIndex(); } // ...
[ "protected", "AppendResponse", "appendEntries", "(", "AppendRequest", "request", ")", "{", "// Get the last entry index or default to the request log index.", "long", "lastEntryIndex", "=", "request", ".", "logIndex", "(", ")", ";", "if", "(", "!", "request", ".", "entr...
Appends entries to the local log.
[ "Appends", "entries", "to", "the", "local", "log", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/state/PassiveState.java#L190-L228
102,644
atomix/copycat
server/src/main/java/io/atomix/copycat/server/state/PassiveState.java
PassiveState.queryLocal
protected CompletableFuture<QueryResponse> queryLocal(QueryEntry entry) { CompletableFuture<QueryResponse> future = new CompletableFuture<>(); sequenceQuery(entry, future); return future; }
java
protected CompletableFuture<QueryResponse> queryLocal(QueryEntry entry) { CompletableFuture<QueryResponse> future = new CompletableFuture<>(); sequenceQuery(entry, future); return future; }
[ "protected", "CompletableFuture", "<", "QueryResponse", ">", "queryLocal", "(", "QueryEntry", "entry", ")", "{", "CompletableFuture", "<", "QueryResponse", ">", "future", "=", "new", "CompletableFuture", "<>", "(", ")", ";", "sequenceQuery", "(", "entry", ",", "...
Performs a local query.
[ "Performs", "a", "local", "query", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/state/PassiveState.java#L290-L294
102,645
atomix/copycat
server/src/main/java/io/atomix/copycat/server/state/ServerCommitPool.java
ServerCommitPool.acquire
public ServerCommit acquire(OperationEntry entry, ServerSessionContext session, long timestamp) { ServerCommit commit = pool.poll(); if (commit == null) { commit = new ServerCommit(this, log); } commit.reset(entry, session, timestamp); return commit; }
java
public ServerCommit acquire(OperationEntry entry, ServerSessionContext session, long timestamp) { ServerCommit commit = pool.poll(); if (commit == null) { commit = new ServerCommit(this, log); } commit.reset(entry, session, timestamp); return commit; }
[ "public", "ServerCommit", "acquire", "(", "OperationEntry", "entry", ",", "ServerSessionContext", "session", ",", "long", "timestamp", ")", "{", "ServerCommit", "commit", "=", "pool", ".", "poll", "(", ")", ";", "if", "(", "commit", "==", "null", ")", "{", ...
Acquires a commit from the pool. @param entry The entry for which to acquire the commit. @return The commit to acquire.
[ "Acquires", "a", "commit", "from", "the", "pool", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/state/ServerCommitPool.java#L49-L56
102,646
atomix/copycat
server/src/main/java/io/atomix/copycat/server/state/ClusterState.java
ClusterState.getReserveMemberStates
List<MemberState> getReserveMemberStates(Comparator<MemberState> comparator) { List<MemberState> reserveMembers = new ArrayList<>(getReserveMemberStates()); Collections.sort(reserveMembers, comparator); return reserveMembers; }
java
List<MemberState> getReserveMemberStates(Comparator<MemberState> comparator) { List<MemberState> reserveMembers = new ArrayList<>(getReserveMemberStates()); Collections.sort(reserveMembers, comparator); return reserveMembers; }
[ "List", "<", "MemberState", ">", "getReserveMemberStates", "(", "Comparator", "<", "MemberState", ">", "comparator", ")", "{", "List", "<", "MemberState", ">", "reserveMembers", "=", "new", "ArrayList", "<>", "(", "getReserveMemberStates", "(", ")", ")", ";", ...
Returns a list of reserve members. @param comparator A comparator with which to sort the members list. @return The sorted members list.
[ "Returns", "a", "list", "of", "reserve", "members", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/state/ClusterState.java#L281-L285
102,647
atomix/copycat
server/src/main/java/io/atomix/copycat/server/state/ClusterState.java
ClusterState.identify
CompletableFuture<Void> identify() { Member leader = context.getLeader(); if (joinFuture != null && leader != null) { if (context.getLeader().equals(member())) { if (context.getState() == CopycatServer.State.LEADER && !((LeaderState) context.getServerState()).configuring()) { if (joinFut...
java
CompletableFuture<Void> identify() { Member leader = context.getLeader(); if (joinFuture != null && leader != null) { if (context.getLeader().equals(member())) { if (context.getState() == CopycatServer.State.LEADER && !((LeaderState) context.getServerState()).configuring()) { if (joinFut...
[ "CompletableFuture", "<", "Void", ">", "identify", "(", ")", "{", "Member", "leader", "=", "context", ".", "getLeader", "(", ")", ";", "if", "(", "joinFuture", "!=", "null", "&&", "leader", "!=", "null", ")", "{", "if", "(", "context", ".", "getLeader"...
Identifies this server to the leader.
[ "Identifies", "this", "server", "to", "the", "leader", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/state/ClusterState.java#L436-L480
102,648
atomix/copycat
server/src/main/java/io/atomix/copycat/server/state/ClusterState.java
ClusterState.cancelJoinTimer
private void cancelJoinTimer() { if (joinTimeout != null) { LOGGER.trace("{} - Cancelling join timeout", member().address()); joinTimeout.cancel(); joinTimeout = null; } }
java
private void cancelJoinTimer() { if (joinTimeout != null) { LOGGER.trace("{} - Cancelling join timeout", member().address()); joinTimeout.cancel(); joinTimeout = null; } }
[ "private", "void", "cancelJoinTimer", "(", ")", "{", "if", "(", "joinTimeout", "!=", "null", ")", "{", "LOGGER", ".", "trace", "(", "\"{} - Cancelling join timeout\"", ",", "member", "(", ")", ".", "address", "(", ")", ")", ";", "joinTimeout", ".", "cancel...
Cancels the join timeout.
[ "Cancels", "the", "join", "timeout", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/state/ClusterState.java#L495-L501
102,649
atomix/copycat
server/src/main/java/io/atomix/copycat/server/state/ClusterState.java
ClusterState.cancelLeaveTimer
private void cancelLeaveTimer() { if (leaveTimeout != null) { LOGGER.trace("{} - Cancelling leave timeout", member().address()); leaveTimeout.cancel(); leaveTimeout = null; } }
java
private void cancelLeaveTimer() { if (leaveTimeout != null) { LOGGER.trace("{} - Cancelling leave timeout", member().address()); leaveTimeout.cancel(); leaveTimeout = null; } }
[ "private", "void", "cancelLeaveTimer", "(", ")", "{", "if", "(", "leaveTimeout", "!=", "null", ")", "{", "LOGGER", ".", "trace", "(", "\"{} - Cancelling leave timeout\"", ",", "member", "(", ")", ".", "address", "(", ")", ")", ";", "leaveTimeout", ".", "ca...
Cancels the leave timeout.
[ "Cancels", "the", "leave", "timeout", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/state/ClusterState.java#L570-L576
102,650
atomix/copycat
server/src/main/java/io/atomix/copycat/server/state/ClusterState.java
ClusterState.reassign
private void reassign() { if (member.type() == Member.Type.ACTIVE && !member.equals(context.getLeader())) { // Calculate this server's index within the collection of active members, excluding the leader. // This is done in a deterministic way by sorting the list of active members by ID. int index ...
java
private void reassign() { if (member.type() == Member.Type.ACTIVE && !member.equals(context.getLeader())) { // Calculate this server's index within the collection of active members, excluding the leader. // This is done in a deterministic way by sorting the list of active members by ID. int index ...
[ "private", "void", "reassign", "(", ")", "{", "if", "(", "member", ".", "type", "(", ")", "==", "Member", ".", "Type", ".", "ACTIVE", "&&", "!", "member", ".", "equals", "(", "context", ".", "getLeader", "(", ")", ")", ")", "{", "// Calculate this se...
Rebuilds assigned member states.
[ "Rebuilds", "assigned", "member", "states", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/state/ClusterState.java#L716-L737
102,651
atomix/copycat
server/src/main/java/io/atomix/copycat/server/state/ClusterState.java
ClusterState.assignMembers
private List<MemberState> assignMembers(int index, List<MemberState> sortedMembers) { List<MemberState> members = new ArrayList<>(sortedMembers.size()); for (int i = 0; i < sortedMembers.size(); i++) { if ((i + 1) % index == 0) { members.add(sortedMembers.get(i)); } } return members;...
java
private List<MemberState> assignMembers(int index, List<MemberState> sortedMembers) { List<MemberState> members = new ArrayList<>(sortedMembers.size()); for (int i = 0; i < sortedMembers.size(); i++) { if ((i + 1) % index == 0) { members.add(sortedMembers.get(i)); } } return members;...
[ "private", "List", "<", "MemberState", ">", "assignMembers", "(", "int", "index", ",", "List", "<", "MemberState", ">", "sortedMembers", ")", "{", "List", "<", "MemberState", ">", "members", "=", "new", "ArrayList", "<>", "(", "sortedMembers", ".", "size", ...
Assigns members using consistent hashing.
[ "Assigns", "members", "using", "consistent", "hashing", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/state/ClusterState.java#L742-L750
102,652
atomix/copycat
server/src/main/java/io/atomix/copycat/server/storage/compaction/MajorCompactionTask.java
MajorCompactionTask.copyPredicates
private void copyPredicates() { predicates = new ArrayList<>(groups.size()); for (List<Segment> group : groups) { List<OffsetPredicate> groupPredicates = new ArrayList<>(group.size()); for (Segment segment : group) { groupPredicates.add(segment.offsetPredicate().copy()); } predic...
java
private void copyPredicates() { predicates = new ArrayList<>(groups.size()); for (List<Segment> group : groups) { List<OffsetPredicate> groupPredicates = new ArrayList<>(group.size()); for (Segment segment : group) { groupPredicates.add(segment.offsetPredicate().copy()); } predic...
[ "private", "void", "copyPredicates", "(", ")", "{", "predicates", "=", "new", "ArrayList", "<>", "(", "groups", ".", "size", "(", ")", ")", ";", "for", "(", "List", "<", "Segment", ">", "group", ":", "groups", ")", "{", "List", "<", "OffsetPredicate", ...
Creates a copy of offset predicates prior to compacting segments to prevent race conditions.
[ "Creates", "a", "copy", "of", "offset", "predicates", "prior", "to", "compacting", "segments", "to", "prevent", "race", "conditions", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/storage/compaction/MajorCompactionTask.java#L119-L128
102,653
atomix/copycat
server/src/main/java/io/atomix/copycat/server/storage/compaction/MajorCompactionTask.java
MajorCompactionTask.compactGroup
private Segment compactGroup(List<Segment> segments, List<OffsetPredicate> predicates) { // Get the first segment which contains the first index being compacted. The compact segment will be written // as a newer version of the earliest segment being rewritten. Segment firstSegment = segments.iterator().next...
java
private Segment compactGroup(List<Segment> segments, List<OffsetPredicate> predicates) { // Get the first segment which contains the first index being compacted. The compact segment will be written // as a newer version of the earliest segment being rewritten. Segment firstSegment = segments.iterator().next...
[ "private", "Segment", "compactGroup", "(", "List", "<", "Segment", ">", "segments", ",", "List", "<", "OffsetPredicate", ">", "predicates", ")", "{", "// Get the first segment which contains the first index being compacted. The compact segment will be written", "// as a newer ver...
Compacts a group.
[ "Compacts", "a", "group", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/storage/compaction/MajorCompactionTask.java#L146-L166
102,654
atomix/copycat
server/src/main/java/io/atomix/copycat/server/storage/compaction/MajorCompactionTask.java
MajorCompactionTask.compactGroup
private void compactGroup(List<Segment> segments, List<OffsetPredicate> predicates, Segment compactSegment) { // Iterate through all segments being compacted and write entries to a single compact segment. for (int i = 0; i < segments.size(); i++) { compactSegment(segments.get(i), predicates.get(i), compac...
java
private void compactGroup(List<Segment> segments, List<OffsetPredicate> predicates, Segment compactSegment) { // Iterate through all segments being compacted and write entries to a single compact segment. for (int i = 0; i < segments.size(); i++) { compactSegment(segments.get(i), predicates.get(i), compac...
[ "private", "void", "compactGroup", "(", "List", "<", "Segment", ">", "segments", ",", "List", "<", "OffsetPredicate", ">", "predicates", ",", "Segment", "compactSegment", ")", "{", "// Iterate through all segments being compacted and write entries to a single compact segment....
Compacts segments in a group sequentially. @param segments The segments to compact. @param compactSegment The compact segment.
[ "Compacts", "segments", "in", "a", "group", "sequentially", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/storage/compaction/MajorCompactionTask.java#L174-L179
102,655
atomix/copycat
server/src/main/java/io/atomix/copycat/server/storage/compaction/MajorCompactionTask.java
MajorCompactionTask.compactSegment
private void compactSegment(Segment segment, OffsetPredicate predicate, Segment compactSegment) { for (long i = segment.firstIndex(); i <= segment.lastIndex(); i++) { checkEntry(i, segment, predicate, compactSegment); } }
java
private void compactSegment(Segment segment, OffsetPredicate predicate, Segment compactSegment) { for (long i = segment.firstIndex(); i <= segment.lastIndex(); i++) { checkEntry(i, segment, predicate, compactSegment); } }
[ "private", "void", "compactSegment", "(", "Segment", "segment", ",", "OffsetPredicate", "predicate", ",", "Segment", "compactSegment", ")", "{", "for", "(", "long", "i", "=", "segment", ".", "firstIndex", "(", ")", ";", "i", "<=", "segment", ".", "lastIndex"...
Compacts the given segment. @param segment The segment to compact. @param compactSegment The segment to which to write the compacted segment.
[ "Compacts", "the", "given", "segment", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/storage/compaction/MajorCompactionTask.java#L187-L191
102,656
atomix/copycat
server/src/main/java/io/atomix/copycat/server/storage/compaction/MajorCompactionTask.java
MajorCompactionTask.compactEntry
private void compactEntry(long index, Segment segment, Segment compactSegment) { compactSegment.skip(1); LOGGER.trace("Compacted entry {} from segment {}", index, segment.descriptor().id()); }
java
private void compactEntry(long index, Segment segment, Segment compactSegment) { compactSegment.skip(1); LOGGER.trace("Compacted entry {} from segment {}", index, segment.descriptor().id()); }
[ "private", "void", "compactEntry", "(", "long", "index", ",", "Segment", "segment", ",", "Segment", "compactSegment", ")", "{", "compactSegment", ".", "skip", "(", "1", ")", ";", "LOGGER", ".", "trace", "(", "\"Compacted entry {} from segment {}\"", ",", "index"...
Compacts an entry from the given segment.
[ "Compacts", "an", "entry", "from", "the", "given", "segment", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/storage/compaction/MajorCompactionTask.java#L274-L277
102,657
atomix/copycat
server/src/main/java/io/atomix/copycat/server/storage/compaction/MajorCompactionTask.java
MajorCompactionTask.isLive
private boolean isLive(long index, Segment segment, OffsetPredicate predicate) { long offset = segment.offset(index); return offset != -1 && predicate.test(offset); }
java
private boolean isLive(long index, Segment segment, OffsetPredicate predicate) { long offset = segment.offset(index); return offset != -1 && predicate.test(offset); }
[ "private", "boolean", "isLive", "(", "long", "index", ",", "Segment", "segment", ",", "OffsetPredicate", "predicate", ")", "{", "long", "offset", "=", "segment", ".", "offset", "(", "index", ")", ";", "return", "offset", "!=", "-", "1", "&&", "predicate", ...
Returns a boolean value indicating whether the given index is release.
[ "Returns", "a", "boolean", "value", "indicating", "whether", "the", "given", "index", "is", "release", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/storage/compaction/MajorCompactionTask.java#L289-L292
102,658
atomix/copycat
server/src/main/java/io/atomix/copycat/server/storage/compaction/MajorCompactionTask.java
MajorCompactionTask.mergeReleased
private void mergeReleased(List<Segment> segments, List<OffsetPredicate> predicates, Segment compactSegment) { for (int i = 0; i < segments.size(); i++) { mergeReleasedEntries(segments.get(i), predicates.get(i), compactSegment); } }
java
private void mergeReleased(List<Segment> segments, List<OffsetPredicate> predicates, Segment compactSegment) { for (int i = 0; i < segments.size(); i++) { mergeReleasedEntries(segments.get(i), predicates.get(i), compactSegment); } }
[ "private", "void", "mergeReleased", "(", "List", "<", "Segment", ">", "segments", ",", "List", "<", "OffsetPredicate", ">", "predicates", ",", "Segment", "compactSegment", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "segments", ".", "size"...
Updates the new compact segment with entries that were released during compaction.
[ "Updates", "the", "new", "compact", "segment", "with", "entries", "that", "were", "released", "during", "compaction", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/storage/compaction/MajorCompactionTask.java#L297-L301
102,659
atomix/copycat
server/src/main/java/io/atomix/copycat/server/storage/compaction/MajorCompactionTask.java
MajorCompactionTask.mergeReleasedEntries
private void mergeReleasedEntries(Segment segment, OffsetPredicate predicate, Segment compactSegment) { for (long i = segment.firstIndex(); i <= segment.lastIndex(); i++) { long offset = segment.offset(i); if (offset != -1 && !predicate.test(offset)) { compactSegment.release(i); } } ...
java
private void mergeReleasedEntries(Segment segment, OffsetPredicate predicate, Segment compactSegment) { for (long i = segment.firstIndex(); i <= segment.lastIndex(); i++) { long offset = segment.offset(i); if (offset != -1 && !predicate.test(offset)) { compactSegment.release(i); } } ...
[ "private", "void", "mergeReleasedEntries", "(", "Segment", "segment", ",", "OffsetPredicate", "predicate", ",", "Segment", "compactSegment", ")", "{", "for", "(", "long", "i", "=", "segment", ".", "firstIndex", "(", ")", ";", "i", "<=", "segment", ".", "last...
Updates the new compact segment with entries that were released in the given segment during compaction.
[ "Updates", "the", "new", "compact", "segment", "with", "entries", "that", "were", "released", "in", "the", "given", "segment", "during", "compaction", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/storage/compaction/MajorCompactionTask.java#L306-L313
102,660
atomix/copycat
server/src/main/java/io/atomix/copycat/server/storage/compaction/MajorCompactionTask.java
MajorCompactionTask.deleteGroup
private void deleteGroup(List<Segment> group) { // Delete the old segments. for (Segment oldSegment : group) { oldSegment.close(); oldSegment.delete(); } }
java
private void deleteGroup(List<Segment> group) { // Delete the old segments. for (Segment oldSegment : group) { oldSegment.close(); oldSegment.delete(); } }
[ "private", "void", "deleteGroup", "(", "List", "<", "Segment", ">", "group", ")", "{", "// Delete the old segments.", "for", "(", "Segment", "oldSegment", ":", "group", ")", "{", "oldSegment", ".", "close", "(", ")", ";", "oldSegment", ".", "delete", "(", ...
Completes compaction by deleting old segments.
[ "Completes", "compaction", "by", "deleting", "old", "segments", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/storage/compaction/MajorCompactionTask.java#L318-L324
102,661
atomix/copycat
client/src/main/java/io/atomix/copycat/client/util/ClientConnection.java
ClientConnection.reset
public ClientConnection reset(Address leader, Collection<Address> servers) { selector.reset(leader, servers); return this; }
java
public ClientConnection reset(Address leader, Collection<Address> servers) { selector.reset(leader, servers); return this; }
[ "public", "ClientConnection", "reset", "(", "Address", "leader", ",", "Collection", "<", "Address", ">", "servers", ")", "{", "selector", ".", "reset", "(", "leader", ",", "servers", ")", ";", "return", "this", ";", "}" ]
Resets the client connection. @param leader The current cluster leader. @param servers The current servers. @return The client connection.
[ "Resets", "the", "client", "connection", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/client/src/main/java/io/atomix/copycat/client/util/ClientConnection.java#L99-L102
102,662
atomix/copycat
client/src/main/java/io/atomix/copycat/client/util/ClientConnection.java
ClientConnection.sendRequest
private <T extends Request, U> void sendRequest(T request, BiFunction<Request, Connection, CompletableFuture<U>> sender, Connection connection, Throwable error, CompletableFuture<U> future) { if (open) { if (error == null) { if (connection != null) { LOGGER.trace("{} - Sending {}", id, reque...
java
private <T extends Request, U> void sendRequest(T request, BiFunction<Request, Connection, CompletableFuture<U>> sender, Connection connection, Throwable error, CompletableFuture<U> future) { if (open) { if (error == null) { if (connection != null) { LOGGER.trace("{} - Sending {}", id, reque...
[ "private", "<", "T", "extends", "Request", ",", "U", ">", "void", "sendRequest", "(", "T", "request", ",", "BiFunction", "<", "Request", ",", "Connection", ",", "CompletableFuture", "<", "U", ">", ">", "sender", ",", "Connection", "connection", ",", "Throw...
Sends the given request attempt to the cluster via the given connection if connected.
[ "Sends", "the", "given", "request", "attempt", "to", "the", "cluster", "via", "the", "given", "connection", "if", "connected", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/client/src/main/java/io/atomix/copycat/client/util/ClientConnection.java#L130-L150
102,663
atomix/copycat
client/src/main/java/io/atomix/copycat/client/util/ClientConnection.java
ClientConnection.connect
private void connect(CompletableFuture<Connection> future) { if (!selector.hasNext()) { LOGGER.debug("{} - Failed to connect to the cluster", id); future.complete(null); } else { Address address = selector.next(); LOGGER.debug("{} - Connecting to {}", id, address); client.connect(a...
java
private void connect(CompletableFuture<Connection> future) { if (!selector.hasNext()) { LOGGER.debug("{} - Failed to connect to the cluster", id); future.complete(null); } else { Address address = selector.next(); LOGGER.debug("{} - Connecting to {}", id, address); client.connect(a...
[ "private", "void", "connect", "(", "CompletableFuture", "<", "Connection", ">", "future", ")", "{", "if", "(", "!", "selector", ".", "hasNext", "(", ")", ")", "{", "LOGGER", ".", "debug", "(", "\"{} - Failed to connect to the cluster\"", ",", "id", ")", ";",...
Attempts to connect to the cluster.
[ "Attempts", "to", "connect", "to", "the", "cluster", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/client/src/main/java/io/atomix/copycat/client/util/ClientConnection.java#L238-L247
102,664
atomix/copycat
client/src/main/java/io/atomix/copycat/client/util/ClientConnection.java
ClientConnection.handleConnection
private void handleConnection(Address address, Connection connection, Throwable error, CompletableFuture<Connection> future) { if (open) { if (error == null) { setupConnection(address, connection, future); } else { LOGGER.debug("{} - Failed to connect! Reason: {}", id, error); co...
java
private void handleConnection(Address address, Connection connection, Throwable error, CompletableFuture<Connection> future) { if (open) { if (error == null) { setupConnection(address, connection, future); } else { LOGGER.debug("{} - Failed to connect! Reason: {}", id, error); co...
[ "private", "void", "handleConnection", "(", "Address", "address", ",", "Connection", "connection", ",", "Throwable", "error", ",", "CompletableFuture", "<", "Connection", ">", "future", ")", "{", "if", "(", "open", ")", "{", "if", "(", "error", "==", "null",...
Handles a connection to a server.
[ "Handles", "a", "connection", "to", "a", "server", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/client/src/main/java/io/atomix/copycat/client/util/ClientConnection.java#L252-L261
102,665
atomix/copycat
client/src/main/java/io/atomix/copycat/client/util/ClientConnection.java
ClientConnection.handleConnectResponse
private void handleConnectResponse(ConnectResponse response, Throwable error, CompletableFuture<Connection> future) { if (open) { if (error == null) { LOGGER.trace("{} - Received {}", id, response); // If the connection was successfully created, immediately send a keep-alive request //...
java
private void handleConnectResponse(ConnectResponse response, Throwable error, CompletableFuture<Connection> future) { if (open) { if (error == null) { LOGGER.trace("{} - Received {}", id, response); // If the connection was successfully created, immediately send a keep-alive request //...
[ "private", "void", "handleConnectResponse", "(", "ConnectResponse", "response", ",", "Throwable", "error", ",", "CompletableFuture", "<", "Connection", ">", "future", ")", "{", "if", "(", "open", ")", "{", "if", "(", "error", "==", "null", ")", "{", "LOGGER"...
Handles a connect response.
[ "Handles", "a", "connect", "response", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/client/src/main/java/io/atomix/copycat/client/util/ClientConnection.java#L302-L319
102,666
atomix/copycat
server/src/main/java/io/atomix/copycat/server/storage/compaction/MinorCompactionManager.java
MinorCompactionManager.getCompactableSegments
private Iterable<Segment> getCompactableSegments(Storage storage, SegmentManager manager) { List<Segment> segments = new ArrayList<>(manager.segments().size()); Iterator<Segment> iterator = manager.segments().iterator(); Segment segment = iterator.next(); while (iterator.hasNext()) { Segment nextS...
java
private Iterable<Segment> getCompactableSegments(Storage storage, SegmentManager manager) { List<Segment> segments = new ArrayList<>(manager.segments().size()); Iterator<Segment> iterator = manager.segments().iterator(); Segment segment = iterator.next(); while (iterator.hasNext()) { Segment nextS...
[ "private", "Iterable", "<", "Segment", ">", "getCompactableSegments", "(", "Storage", "storage", ",", "SegmentManager", "manager", ")", "{", "List", "<", "Segment", ">", "segments", "=", "new", "ArrayList", "<>", "(", "manager", ".", "segments", "(", ")", "....
Returns a list of compactable segments. @return A list of compactable segments.
[ "Returns", "a", "list", "of", "compactable", "segments", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/storage/compaction/MinorCompactionManager.java#L80-L104
102,667
atomix/copycat
server/src/main/java/io/atomix/copycat/server/StateMachine.java
StateMachine.init
public void init(StateMachineExecutor executor) { this.executor = Assert.notNull(executor, "executor"); this.context = executor.context(); this.clock = context.clock(); this.sessions = context.sessions(); if (this instanceof SessionListener) { executor.context().sessions().addListener((Session...
java
public void init(StateMachineExecutor executor) { this.executor = Assert.notNull(executor, "executor"); this.context = executor.context(); this.clock = context.clock(); this.sessions = context.sessions(); if (this instanceof SessionListener) { executor.context().sessions().addListener((Session...
[ "public", "void", "init", "(", "StateMachineExecutor", "executor", ")", "{", "this", ".", "executor", "=", "Assert", ".", "notNull", "(", "executor", ",", "\"executor\"", ")", ";", "this", ".", "context", "=", "executor", ".", "context", "(", ")", ";", "...
Initializes the state machine. @param executor The state machine executor. @throws NullPointerException if {@code context} is null
[ "Initializes", "the", "state", "machine", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/StateMachine.java#L231-L240
102,668
atomix/copycat
server/src/main/java/io/atomix/copycat/server/StateMachine.java
StateMachine.registerOperations
private void registerOperations() { Class<?> type = getClass(); for (Method method : type.getMethods()) { if (isOperationMethod(method)) { registerMethod(method); } } }
java
private void registerOperations() { Class<?> type = getClass(); for (Method method : type.getMethods()) { if (isOperationMethod(method)) { registerMethod(method); } } }
[ "private", "void", "registerOperations", "(", ")", "{", "Class", "<", "?", ">", "type", "=", "getClass", "(", ")", ";", "for", "(", "Method", "method", ":", "type", ".", "getMethods", "(", ")", ")", "{", "if", "(", "isOperationMethod", "(", "method", ...
Registers operations for the class.
[ "Registers", "operations", "for", "the", "class", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/StateMachine.java#L266-L273
102,669
atomix/copycat
server/src/main/java/io/atomix/copycat/server/StateMachine.java
StateMachine.isOperationMethod
private boolean isOperationMethod(Method method) { Class<?>[] paramTypes = method.getParameterTypes(); return paramTypes.length == 1 && paramTypes[0] == Commit.class; }
java
private boolean isOperationMethod(Method method) { Class<?>[] paramTypes = method.getParameterTypes(); return paramTypes.length == 1 && paramTypes[0] == Commit.class; }
[ "private", "boolean", "isOperationMethod", "(", "Method", "method", ")", "{", "Class", "<", "?", ">", "[", "]", "paramTypes", "=", "method", ".", "getParameterTypes", "(", ")", ";", "return", "paramTypes", ".", "length", "==", "1", "&&", "paramTypes", "[",...
Returns a boolean value indicating whether the given method is an operation method.
[ "Returns", "a", "boolean", "value", "indicating", "whether", "the", "given", "method", "is", "an", "operation", "method", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/StateMachine.java#L278-L281
102,670
atomix/copycat
server/src/main/java/io/atomix/copycat/server/StateMachine.java
StateMachine.registerMethod
private void registerMethod(Method method) { Type genericType = method.getGenericParameterTypes()[0]; Class<?> argumentType = resolveArgument(genericType); if (argumentType != null && Operation.class.isAssignableFrom(argumentType)) { registerMethod(argumentType, method); } }
java
private void registerMethod(Method method) { Type genericType = method.getGenericParameterTypes()[0]; Class<?> argumentType = resolveArgument(genericType); if (argumentType != null && Operation.class.isAssignableFrom(argumentType)) { registerMethod(argumentType, method); } }
[ "private", "void", "registerMethod", "(", "Method", "method", ")", "{", "Type", "genericType", "=", "method", ".", "getGenericParameterTypes", "(", ")", "[", "0", "]", ";", "Class", "<", "?", ">", "argumentType", "=", "resolveArgument", "(", "genericType", "...
Registers an operation for the given method.
[ "Registers", "an", "operation", "for", "the", "given", "method", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/StateMachine.java#L286-L292
102,671
atomix/copycat
server/src/main/java/io/atomix/copycat/server/StateMachine.java
StateMachine.resolveArgument
private Class<?> resolveArgument(Type type) { if (type instanceof ParameterizedType) { ParameterizedType paramType = (ParameterizedType) type; return resolveClass(paramType.getActualTypeArguments()[0]); } else if (type instanceof TypeVariable) { return resolveClass(type); } else if (type i...
java
private Class<?> resolveArgument(Type type) { if (type instanceof ParameterizedType) { ParameterizedType paramType = (ParameterizedType) type; return resolveClass(paramType.getActualTypeArguments()[0]); } else if (type instanceof TypeVariable) { return resolveClass(type); } else if (type i...
[ "private", "Class", "<", "?", ">", "resolveArgument", "(", "Type", "type", ")", "{", "if", "(", "type", "instanceof", "ParameterizedType", ")", "{", "ParameterizedType", "paramType", "=", "(", "ParameterizedType", ")", "type", ";", "return", "resolveClass", "(...
Resolves the generic argument for the given type.
[ "Resolves", "the", "generic", "argument", "for", "the", "given", "type", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/StateMachine.java#L297-L308
102,672
atomix/copycat
server/src/main/java/io/atomix/copycat/server/StateMachine.java
StateMachine.resolveClass
private Class<?> resolveClass(Type type) { if (type instanceof Class) { return (Class<?>) type; } else if (type instanceof ParameterizedType) { return resolveClass(((ParameterizedType) type).getRawType()); } else if (type instanceof WildcardType) { Type[] bounds = ((WildcardType) type).get...
java
private Class<?> resolveClass(Type type) { if (type instanceof Class) { return (Class<?>) type; } else if (type instanceof ParameterizedType) { return resolveClass(((ParameterizedType) type).getRawType()); } else if (type instanceof WildcardType) { Type[] bounds = ((WildcardType) type).get...
[ "private", "Class", "<", "?", ">", "resolveClass", "(", "Type", "type", ")", "{", "if", "(", "type", "instanceof", "Class", ")", "{", "return", "(", "Class", "<", "?", ">", ")", "type", ";", "}", "else", "if", "(", "type", "instanceof", "Parameterize...
Resolves the generic class for the given type.
[ "Resolves", "the", "generic", "class", "for", "the", "given", "type", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/StateMachine.java#L313-L325
102,673
atomix/copycat
server/src/main/java/io/atomix/copycat/server/StateMachine.java
StateMachine.registerMethod
private void registerMethod(Class<?> type, Method method) { Class<?> returnType = method.getReturnType(); if (returnType == void.class || returnType == Void.class) { registerVoidMethod(type, method); } else { registerValueMethod(type, method); } }
java
private void registerMethod(Class<?> type, Method method) { Class<?> returnType = method.getReturnType(); if (returnType == void.class || returnType == Void.class) { registerVoidMethod(type, method); } else { registerValueMethod(type, method); } }
[ "private", "void", "registerMethod", "(", "Class", "<", "?", ">", "type", ",", "Method", "method", ")", "{", "Class", "<", "?", ">", "returnType", "=", "method", ".", "getReturnType", "(", ")", ";", "if", "(", "returnType", "==", "void", ".", "class", ...
Registers the given method for the given operation type.
[ "Registers", "the", "given", "method", "for", "the", "given", "operation", "type", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/StateMachine.java#L330-L337
102,674
atomix/copycat
server/src/main/java/io/atomix/copycat/server/StateMachine.java
StateMachine.registerVoidMethod
@SuppressWarnings("unchecked") private void registerVoidMethod(Class type, Method method) { executor.register(type, wrapVoidMethod(method)); }
java
@SuppressWarnings("unchecked") private void registerVoidMethod(Class type, Method method) { executor.register(type, wrapVoidMethod(method)); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "void", "registerVoidMethod", "(", "Class", "type", ",", "Method", "method", ")", "{", "executor", ".", "register", "(", "type", ",", "wrapVoidMethod", "(", "method", ")", ")", ";", "}" ]
Registers an operation with a void return value.
[ "Registers", "an", "operation", "with", "a", "void", "return", "value", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/StateMachine.java#L342-L345
102,675
atomix/copycat
server/src/main/java/io/atomix/copycat/server/StateMachine.java
StateMachine.wrapVoidMethod
private Consumer wrapVoidMethod(Method method) { return c -> { try { method.invoke(this, c); } catch (InvocationTargetException e) { throw new CommandException(e); } catch (IllegalAccessException e) { throw new AssertionError(e); } }; }
java
private Consumer wrapVoidMethod(Method method) { return c -> { try { method.invoke(this, c); } catch (InvocationTargetException e) { throw new CommandException(e); } catch (IllegalAccessException e) { throw new AssertionError(e); } }; }
[ "private", "Consumer", "wrapVoidMethod", "(", "Method", "method", ")", "{", "return", "c", "->", "{", "try", "{", "method", ".", "invoke", "(", "this", ",", "c", ")", ";", "}", "catch", "(", "InvocationTargetException", "e", ")", "{", "throw", "new", "...
Wraps a void method.
[ "Wraps", "a", "void", "method", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/StateMachine.java#L350-L360
102,676
atomix/copycat
server/src/main/java/io/atomix/copycat/server/StateMachine.java
StateMachine.registerValueMethod
@SuppressWarnings("unchecked") private void registerValueMethod(Class type, Method method) { executor.register(type, wrapValueMethod(method)); }
java
@SuppressWarnings("unchecked") private void registerValueMethod(Class type, Method method) { executor.register(type, wrapValueMethod(method)); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "void", "registerValueMethod", "(", "Class", "type", ",", "Method", "method", ")", "{", "executor", ".", "register", "(", "type", ",", "wrapValueMethod", "(", "method", ")", ")", ";", "}" ]
Registers an operation with a non-void return value.
[ "Registers", "an", "operation", "with", "a", "non", "-", "void", "return", "value", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/StateMachine.java#L365-L368
102,677
atomix/copycat
server/src/main/java/io/atomix/copycat/server/StateMachine.java
StateMachine.wrapValueMethod
private Function wrapValueMethod(Method method) { return c -> { try { return method.invoke(this, c); } catch (InvocationTargetException e) { throw new CommandException(e); } catch (IllegalAccessException e) { throw new AssertionError(e); } }; }
java
private Function wrapValueMethod(Method method) { return c -> { try { return method.invoke(this, c); } catch (InvocationTargetException e) { throw new CommandException(e); } catch (IllegalAccessException e) { throw new AssertionError(e); } }; }
[ "private", "Function", "wrapValueMethod", "(", "Method", "method", ")", "{", "return", "c", "->", "{", "try", "{", "return", "method", ".", "invoke", "(", "this", ",", "c", ")", ";", "}", "catch", "(", "InvocationTargetException", "e", ")", "{", "throw",...
Wraps a value method.
[ "Wraps", "a", "value", "method", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/StateMachine.java#L373-L383
102,678
atomix/copycat
server/src/main/java/io/atomix/copycat/server/storage/SegmentFile.java
SegmentFile.id
public long id() { return Long.valueOf(file.getName().substring(file.getName().lastIndexOf(PART_SEPARATOR, file.getName().lastIndexOf(PART_SEPARATOR) - 1) + 1, file.getName().lastIndexOf(PART_SEPARATOR))); }
java
public long id() { return Long.valueOf(file.getName().substring(file.getName().lastIndexOf(PART_SEPARATOR, file.getName().lastIndexOf(PART_SEPARATOR) - 1) + 1, file.getName().lastIndexOf(PART_SEPARATOR))); }
[ "public", "long", "id", "(", ")", "{", "return", "Long", ".", "valueOf", "(", "file", ".", "getName", "(", ")", ".", "substring", "(", "file", ".", "getName", "(", ")", ".", "lastIndexOf", "(", "PART_SEPARATOR", ",", "file", ".", "getName", "(", ")",...
Returns the segment identifier.
[ "Returns", "the", "segment", "identifier", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/storage/SegmentFile.java#L89-L91
102,679
atomix/copycat
server/src/main/java/io/atomix/copycat/server/storage/SegmentFile.java
SegmentFile.version
public long version() { return Long.valueOf(file.getName().substring(file.getName().lastIndexOf(PART_SEPARATOR) + 1, file.getName().lastIndexOf(EXTENSION_SEPARATOR))); }
java
public long version() { return Long.valueOf(file.getName().substring(file.getName().lastIndexOf(PART_SEPARATOR) + 1, file.getName().lastIndexOf(EXTENSION_SEPARATOR))); }
[ "public", "long", "version", "(", ")", "{", "return", "Long", ".", "valueOf", "(", "file", ".", "getName", "(", ")", ".", "substring", "(", "file", ".", "getName", "(", ")", ".", "lastIndexOf", "(", "PART_SEPARATOR", ")", "+", "1", ",", "file", ".", ...
Returns the segment version.
[ "Returns", "the", "segment", "version", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/storage/SegmentFile.java#L96-L98
102,680
atomix/copycat
client/src/main/java/io/atomix/copycat/client/DefaultCopycatClient.java
DefaultCopycatClient.setState
private void setState(State state) { if (this.state != state) { this.state = state; LOGGER.debug("State changed: {}", state); changeListeners.forEach(l -> l.accept(state)); } }
java
private void setState(State state) { if (this.state != state) { this.state = state; LOGGER.debug("State changed: {}", state); changeListeners.forEach(l -> l.accept(state)); } }
[ "private", "void", "setState", "(", "State", "state", ")", "{", "if", "(", "this", ".", "state", "!=", "state", ")", "{", "this", ".", "state", "=", "state", ";", "LOGGER", ".", "debug", "(", "\"State changed: {}\"", ",", "state", ")", ";", "changeList...
Updates the client state.
[ "Updates", "the", "client", "state", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/client/src/main/java/io/atomix/copycat/client/DefaultCopycatClient.java#L92-L98
102,681
atomix/copycat
client/src/main/java/io/atomix/copycat/client/DefaultCopycatClient.java
DefaultCopycatClient.newSession
private ClientSession newSession() { ClientSession session = new ClientSession(clientId, transport.client(), selector, ioContext, connectionStrategy, sessionTimeout, unstabilityTimeout ); // Update the session change listener. if (changeListener != null) ...
java
private ClientSession newSession() { ClientSession session = new ClientSession(clientId, transport.client(), selector, ioContext, connectionStrategy, sessionTimeout, unstabilityTimeout ); // Update the session change listener. if (changeListener != null) ...
[ "private", "ClientSession", "newSession", "(", ")", "{", "ClientSession", "session", "=", "new", "ClientSession", "(", "clientId", ",", "transport", ".", "client", "(", ")", ",", "selector", ",", "ioContext", ",", "connectionStrategy", ",", "sessionTimeout", ","...
Creates a new child session.
[ "Creates", "a", "new", "child", "session", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/client/src/main/java/io/atomix/copycat/client/DefaultCopycatClient.java#L129-L142
102,682
atomix/copycat
client/src/main/java/io/atomix/copycat/client/DefaultCopycatClient.java
DefaultCopycatClient.onStateChange
private void onStateChange(Session.State state) { switch (state) { // When the session is opened, transition the state to CONNECTED. case OPEN: setState(State.CONNECTED); break; // When the session becomes unstable, transition the state to SUSPENDED. case UNSTABLE: se...
java
private void onStateChange(Session.State state) { switch (state) { // When the session is opened, transition the state to CONNECTED. case OPEN: setState(State.CONNECTED); break; // When the session becomes unstable, transition the state to SUSPENDED. case UNSTABLE: se...
[ "private", "void", "onStateChange", "(", "Session", ".", "State", "state", ")", "{", "switch", "(", "state", ")", "{", "// When the session is opened, transition the state to CONNECTED.", "case", "OPEN", ":", "setState", "(", "State", ".", "CONNECTED", ")", ";", "...
Handles a session state change.
[ "Handles", "a", "session", "state", "change", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/client/src/main/java/io/atomix/copycat/client/DefaultCopycatClient.java#L147-L173
102,683
atomix/copycat
client/src/main/java/io/atomix/copycat/client/DefaultCopycatClient.java
DefaultCopycatClient.kill
public synchronized CompletableFuture<Void> kill() { if (state == State.CLOSED) return CompletableFuture.completedFuture(null); if (closeFuture == null) { closeFuture = session.kill() .whenComplete((result, error) -> { setState(State.CLOSED); CompletableFuture.runAsync((...
java
public synchronized CompletableFuture<Void> kill() { if (state == State.CLOSED) return CompletableFuture.completedFuture(null); if (closeFuture == null) { closeFuture = session.kill() .whenComplete((result, error) -> { setState(State.CLOSED); CompletableFuture.runAsync((...
[ "public", "synchronized", "CompletableFuture", "<", "Void", ">", "kill", "(", ")", "{", "if", "(", "state", "==", "State", ".", "CLOSED", ")", "return", "CompletableFuture", ".", "completedFuture", "(", "null", ")", ";", "if", "(", "closeFuture", "==", "nu...
Kills the client. @return A completable future to be completed once the client's session has been killed.
[ "Kills", "the", "client", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/client/src/main/java/io/atomix/copycat/client/DefaultCopycatClient.java#L306-L322
102,684
atomix/copycat
examples/value-client/src/main/java/io/atomix/copycat/examples/ValueClientExample.java
ValueClientExample.main
public static void main(String[] args) throws Exception { if (args.length < 1) throw new IllegalArgumentException("must supply a set of host:port tuples"); // Build a list of all member addresses to which to connect. List<Address> members = new ArrayList<>(); for (String arg : args) { Strin...
java
public static void main(String[] args) throws Exception { if (args.length < 1) throw new IllegalArgumentException("must supply a set of host:port tuples"); // Build a list of all member addresses to which to connect. List<Address> members = new ArrayList<>(); for (String arg : args) { Strin...
[ "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "throws", "Exception", "{", "if", "(", "args", ".", "length", "<", "1", ")", "throw", "new", "IllegalArgumentException", "(", "\"must supply a set of host:port tuples\"", ")", ";", "// B...
Starts the client.
[ "Starts", "the", "client", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/examples/value-client/src/main/java/io/atomix/copycat/examples/ValueClientExample.java#L46-L80
102,685
atomix/copycat
examples/value-client/src/main/java/io/atomix/copycat/examples/ValueClientExample.java
ValueClientExample.recursiveSet
private static void recursiveSet(CopycatClient client) { client.submit(new SetCommand(UUID.randomUUID().toString())).whenComplete((result, error) -> { client.context().schedule(Duration.ofSeconds(5), () -> recursiveSet(client)); }); }
java
private static void recursiveSet(CopycatClient client) { client.submit(new SetCommand(UUID.randomUUID().toString())).whenComplete((result, error) -> { client.context().schedule(Duration.ofSeconds(5), () -> recursiveSet(client)); }); }
[ "private", "static", "void", "recursiveSet", "(", "CopycatClient", "client", ")", "{", "client", ".", "submit", "(", "new", "SetCommand", "(", "UUID", ".", "randomUUID", "(", ")", ".", "toString", "(", ")", ")", ")", ".", "whenComplete", "(", "(", "resul...
Recursively sets state machine values.
[ "Recursively", "sets", "state", "machine", "values", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/examples/value-client/src/main/java/io/atomix/copycat/examples/ValueClientExample.java#L85-L89
102,686
atomix/copycat
server/src/main/java/io/atomix/copycat/server/state/ServerStateMachineExecutor.java
ServerStateMachineExecutor.init
void init(long index, Instant instant, ServerStateMachineContext.Type type) { context.update(index, instant, type); }
java
void init(long index, Instant instant, ServerStateMachineContext.Type type) { context.update(index, instant, type); }
[ "void", "init", "(", "long", "index", ",", "Instant", "instant", ",", "ServerStateMachineContext", ".", "Type", "type", ")", "{", "context", ".", "update", "(", "index", ",", "instant", ",", "type", ")", ";", "}" ]
Initializes the execution of a task.
[ "Initializes", "the", "execution", "of", "a", "task", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/state/ServerStateMachineExecutor.java#L103-L105
102,687
atomix/copycat
server/src/main/java/io/atomix/copycat/server/state/ServerStateMachineExecutor.java
ServerStateMachineExecutor.executeOperation
@SuppressWarnings("unchecked") <T extends Operation<U>, U> U executeOperation(Commit commit) { // If the commit operation is a no-op command, complete the operation. if (commit.operation() instanceof NoOpCommand) { commit.close(); return null; } // Get the function registered for the oper...
java
@SuppressWarnings("unchecked") <T extends Operation<U>, U> U executeOperation(Commit commit) { // If the commit operation is a no-op command, complete the operation. if (commit.operation() instanceof NoOpCommand) { commit.close(); return null; } // Get the function registered for the oper...
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "<", "T", "extends", "Operation", "<", "U", ">", ",", "U", ">", "U", "executeOperation", "(", "Commit", "commit", ")", "{", "// If the commit operation is a no-op command, complete the operation.", "if", "(", "comm...
Executes an operation.
[ "Executes", "an", "operation", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/state/ServerStateMachineExecutor.java#L110-L150
102,688
atomix/copycat
server/src/main/java/io/atomix/copycat/server/storage/index/SearchableOffsetIndex.java
SearchableOffsetIndex.findAfter
private long findAfter(long offset) { if (size == 0) { return -1; } int low = 0; int high = size-1; while (low <= high) { int mid = low + ((high - low) / 2); long i = buffer.readLong(mid * ENTRY_SIZE); if (i < offset) { low = mid + 1; } else if (i > offset) ...
java
private long findAfter(long offset) { if (size == 0) { return -1; } int low = 0; int high = size-1; while (low <= high) { int mid = low + ((high - low) / 2); long i = buffer.readLong(mid * ENTRY_SIZE); if (i < offset) { low = mid + 1; } else if (i > offset) ...
[ "private", "long", "findAfter", "(", "long", "offset", ")", "{", "if", "(", "size", "==", "0", ")", "{", "return", "-", "1", ";", "}", "int", "low", "=", "0", ";", "int", "high", "=", "size", "-", "1", ";", "while", "(", "low", "<=", "high", ...
Returns the real offset for the given relative offset.
[ "Returns", "the", "real", "offset", "for", "the", "given", "relative", "offset", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/storage/index/SearchableOffsetIndex.java#L139-L161
102,689
atomix/copycat
server/src/main/java/io/atomix/copycat/server/storage/snapshot/SnapshotFile.java
SnapshotFile.index
public long index() { return Long.valueOf(file.getName().substring(file.getName().lastIndexOf(PART_SEPARATOR, file.getName().lastIndexOf(PART_SEPARATOR) - 1) + 1, file.getName().lastIndexOf(PART_SEPARATOR))); }
java
public long index() { return Long.valueOf(file.getName().substring(file.getName().lastIndexOf(PART_SEPARATOR, file.getName().lastIndexOf(PART_SEPARATOR) - 1) + 1, file.getName().lastIndexOf(PART_SEPARATOR))); }
[ "public", "long", "index", "(", ")", "{", "return", "Long", ".", "valueOf", "(", "file", ".", "getName", "(", ")", ".", "substring", "(", "file", ".", "getName", "(", ")", ".", "lastIndexOf", "(", "PART_SEPARATOR", ",", "file", ".", "getName", "(", "...
Returns the snapshot index. @return The snapshot index.
[ "Returns", "the", "snapshot", "index", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/storage/snapshot/SnapshotFile.java#L94-L96
102,690
atomix/copycat
client/src/main/java/io/atomix/copycat/client/util/AddressSelector.java
AddressSelector.reset
public AddressSelector reset() { if (selectionsIterator != null) { this.selections = strategy.selectConnections(leader, new ArrayList<>(servers)); this.selectionsIterator = null; } return this; }
java
public AddressSelector reset() { if (selectionsIterator != null) { this.selections = strategy.selectConnections(leader, new ArrayList<>(servers)); this.selectionsIterator = null; } return this; }
[ "public", "AddressSelector", "reset", "(", ")", "{", "if", "(", "selectionsIterator", "!=", "null", ")", "{", "this", ".", "selections", "=", "strategy", ".", "selectConnections", "(", "leader", ",", "new", "ArrayList", "<>", "(", "servers", ")", ")", ";",...
Resets the addresses. @return The address selector.
[ "Resets", "the", "addresses", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/client/src/main/java/io/atomix/copycat/client/util/AddressSelector.java#L103-L109
102,691
atomix/copycat
client/src/main/java/io/atomix/copycat/client/util/AddressSelector.java
AddressSelector.reset
public AddressSelector reset(Address leader, Collection<Address> servers) { if (changed(leader, servers)) { this.leader = leader; this.servers = servers; this.selections = strategy.selectConnections(leader, new ArrayList<>(servers)); this.selectionsIterator = null; } return this; }
java
public AddressSelector reset(Address leader, Collection<Address> servers) { if (changed(leader, servers)) { this.leader = leader; this.servers = servers; this.selections = strategy.selectConnections(leader, new ArrayList<>(servers)); this.selectionsIterator = null; } return this; }
[ "public", "AddressSelector", "reset", "(", "Address", "leader", ",", "Collection", "<", "Address", ">", "servers", ")", "{", "if", "(", "changed", "(", "leader", ",", "servers", ")", ")", "{", "this", ".", "leader", "=", "leader", ";", "this", ".", "se...
Resets the connection addresses. @param servers The collection of server addresses. @return The address selector.
[ "Resets", "the", "connection", "addresses", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/client/src/main/java/io/atomix/copycat/client/util/AddressSelector.java#L117-L125
102,692
atomix/copycat
client/src/main/java/io/atomix/copycat/client/util/AddressSelector.java
AddressSelector.matches
private boolean matches(Collection<Address> left, Collection<Address> right) { if (left.size() != right.size()) return false; for (Address address : left) { if (!right.contains(address)) { return false; } } return true; }
java
private boolean matches(Collection<Address> left, Collection<Address> right) { if (left.size() != right.size()) return false; for (Address address : left) { if (!right.contains(address)) { return false; } } return true; }
[ "private", "boolean", "matches", "(", "Collection", "<", "Address", ">", "left", ",", "Collection", "<", "Address", ">", "right", ")", "{", "if", "(", "left", ".", "size", "(", ")", "!=", "right", ".", "size", "(", ")", ")", "return", "false", ";", ...
Returns a boolean value indicating whether the servers in the first list match the servers in the second list.
[ "Returns", "a", "boolean", "value", "indicating", "whether", "the", "servers", "in", "the", "first", "list", "match", "the", "servers", "in", "the", "second", "list", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/client/src/main/java/io/atomix/copycat/client/util/AddressSelector.java#L150-L160
102,693
atomix/copycat
server/src/main/java/io/atomix/copycat/server/storage/compaction/Compactor.java
Compactor.withDefaultCompactionMode
public Compactor withDefaultCompactionMode(Compaction.Mode mode) { Assert.notNull(mode, "mode"); Assert.argNot(mode, mode == Compaction.Mode.DEFAULT, "DEFAULT cannot be the default compaction mode"); this.defaultCompactionMode = mode; return this; }
java
public Compactor withDefaultCompactionMode(Compaction.Mode mode) { Assert.notNull(mode, "mode"); Assert.argNot(mode, mode == Compaction.Mode.DEFAULT, "DEFAULT cannot be the default compaction mode"); this.defaultCompactionMode = mode; return this; }
[ "public", "Compactor", "withDefaultCompactionMode", "(", "Compaction", ".", "Mode", "mode", ")", "{", "Assert", ".", "notNull", "(", "mode", ",", "\"mode\"", ")", ";", "Assert", ".", "argNot", "(", "mode", ",", "mode", "==", "Compaction", ".", "Mode", ".",...
Sets the default compaction mode. @param mode The default compaction mode. @return The compactor. @throws NullPointerException if the compaction mode is {@code null} @throws IllegalArgumentException if the compaction mode is {@link Compaction.Mode#DEFAULT}
[ "Sets", "the", "default", "compaction", "mode", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/storage/compaction/Compactor.java#L82-L87
102,694
atomix/copycat
server/src/main/java/io/atomix/copycat/server/storage/compaction/Compactor.java
Compactor.minorIndex
public Compactor minorIndex(long index) { this.minorIndex = Math.max(this.minorIndex, index); Segment segment = segments.segment(minorIndex); if (segment != null) { compactIndex = segment.firstIndex(); } return this; }
java
public Compactor minorIndex(long index) { this.minorIndex = Math.max(this.minorIndex, index); Segment segment = segments.segment(minorIndex); if (segment != null) { compactIndex = segment.firstIndex(); } return this; }
[ "public", "Compactor", "minorIndex", "(", "long", "index", ")", "{", "this", ".", "minorIndex", "=", "Math", ".", "max", "(", "this", ".", "minorIndex", ",", "index", ")", ";", "Segment", "segment", "=", "segments", ".", "segment", "(", "minorIndex", ")"...
Sets the maximum compaction index for minor compaction. @param index The maximum compaction index for minor compaction. @return The log compactor.
[ "Sets", "the", "maximum", "compaction", "index", "for", "minor", "compaction", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/storage/compaction/Compactor.java#L104-L111
102,695
atomix/copycat
server/src/main/java/io/atomix/copycat/server/storage/compaction/Compactor.java
Compactor.compact
private synchronized CompletableFuture<Void> compact(Compaction compaction, CompletableFuture<Void> future, ThreadContext context) { CompactionManager manager = compaction.manager(this); AtomicInteger counter = new AtomicInteger(); Collection<CompactionTask> tasks = manager.buildTasks(storage, segments); ...
java
private synchronized CompletableFuture<Void> compact(Compaction compaction, CompletableFuture<Void> future, ThreadContext context) { CompactionManager manager = compaction.manager(this); AtomicInteger counter = new AtomicInteger(); Collection<CompactionTask> tasks = manager.buildTasks(storage, segments); ...
[ "private", "synchronized", "CompletableFuture", "<", "Void", ">", "compact", "(", "Compaction", "compaction", ",", "CompletableFuture", "<", "Void", ">", "future", ",", "ThreadContext", "context", ")", "{", "CompactionManager", "manager", "=", "compaction", ".", "...
Compacts the log.
[ "Compacts", "the", "log", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/storage/compaction/Compactor.java#L201-L227
102,696
atomix/copycat
server/src/main/java/io/atomix/copycat/server/state/ServerCommit.java
ServerCommit.reset
void reset(OperationEntry<?> entry, ServerSessionContext session, long timestamp) { if (references.compareAndSet(0, 1)) { this.index = entry.getIndex(); this.session = session; this.instant = Instant.ofEpochMilli(timestamp); this.operation = entry.getOperation(); session.acquire(); ...
java
void reset(OperationEntry<?> entry, ServerSessionContext session, long timestamp) { if (references.compareAndSet(0, 1)) { this.index = entry.getIndex(); this.session = session; this.instant = Instant.ofEpochMilli(timestamp); this.operation = entry.getOperation(); session.acquire(); ...
[ "void", "reset", "(", "OperationEntry", "<", "?", ">", "entry", ",", "ServerSessionContext", "session", ",", "long", "timestamp", ")", "{", "if", "(", "references", ".", "compareAndSet", "(", "0", ",", "1", ")", ")", "{", "this", ".", "index", "=", "en...
Resets the commit. @param entry The entry.
[ "Resets", "the", "commit", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/state/ServerCommit.java#L53-L64
102,697
atomix/copycat
server/src/main/java/io/atomix/copycat/server/state/ServerCommit.java
ServerCommit.cleanup
private void cleanup() { if (operation instanceof Command && log.isOpen()) { try { log.release(index); } catch (IllegalStateException e) { } } session.release(); index = 0; session = null; instant = null; operation = null; pool.release(this); }
java
private void cleanup() { if (operation instanceof Command && log.isOpen()) { try { log.release(index); } catch (IllegalStateException e) { } } session.release(); index = 0; session = null; instant = null; operation = null; pool.release(this); }
[ "private", "void", "cleanup", "(", ")", "{", "if", "(", "operation", "instanceof", "Command", "&&", "log", ".", "isOpen", "(", ")", ")", "{", "try", "{", "log", ".", "release", "(", "index", ")", ";", "}", "catch", "(", "IllegalStateException", "e", ...
Cleans up the commit.
[ "Cleans", "up", "the", "commit", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/state/ServerCommit.java#L135-L151
102,698
atomix/copycat
server/src/main/java/io/atomix/copycat/server/CopycatServer.java
CopycatServer.listen
private CompletableFuture<Void> listen() { CompletableFuture<Void> future = new CompletableFuture<>(); context.getThreadContext().executor().execute(() -> { internalServer.listen(cluster().member().serverAddress(), context::connectServer).whenComplete((internalResult, internalError) -> { if (inter...
java
private CompletableFuture<Void> listen() { CompletableFuture<Void> future = new CompletableFuture<>(); context.getThreadContext().executor().execute(() -> { internalServer.listen(cluster().member().serverAddress(), context::connectServer).whenComplete((internalResult, internalError) -> { if (inter...
[ "private", "CompletableFuture", "<", "Void", ">", "listen", "(", ")", "{", "CompletableFuture", "<", "Void", ">", "future", "=", "new", "CompletableFuture", "<>", "(", ")", ";", "context", ".", "getThreadContext", "(", ")", ".", "executor", "(", ")", ".", ...
Starts listening the server.
[ "Starts", "listening", "the", "server", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/CopycatServer.java#L694-L716
102,699
atomix/copycat
server/src/main/java/io/atomix/copycat/server/storage/Segment.java
Segment.buildIndex
private void buildIndex() { // Read the current buffer position. long position = buffer.mark().position(); // Read the first entry length. int length = buffer.readInt(); // While the length is non-zero... while (length != 0) { // Read the full entry into memory. buffer.read(memory....
java
private void buildIndex() { // Read the current buffer position. long position = buffer.mark().position(); // Read the first entry length. int length = buffer.readInt(); // While the length is non-zero... while (length != 0) { // Read the full entry into memory. buffer.read(memory....
[ "private", "void", "buildIndex", "(", ")", "{", "// Read the current buffer position.", "long", "position", "=", "buffer", ".", "mark", "(", ")", ".", "position", "(", ")", ";", "// Read the first entry length.", "int", "length", "=", "buffer", ".", "readInt", "...
Builds the index from the segment bytes.
[ "Builds", "the", "index", "from", "the", "segment", "bytes", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/storage/Segment.java#L97-L151