proj_name
stringclasses
131 values
relative_path
stringlengths
30
228
class_name
stringlengths
1
68
func_name
stringlengths
1
48
masked_class
stringlengths
78
9.82k
func_body
stringlengths
46
9.61k
len_input
int64
29
2.01k
len_output
int64
14
1.94k
total
int64
55
2.05k
relevant_context
stringlengths
0
38.4k
crate_crate
crate/server/src/main/java/io/crate/role/RoleManagerService.java
RoleManagerService
ensureDropRoleTargetIsNotSuperUser
class RoleManagerService implements RoleManager { private static final void ensureDropRoleTargetIsNotSuperUser(Role user) {<FILL_FUNCTION_BODY>} private static final void ensureAlterPrivilegeTargetIsNotSuperuser(Role user) { if (user != null && user.isSuperUser()) { throw new UnsupportedOp...
if (user != null && user.isSuperUser()) { throw new UnsupportedOperationException(String.format( Locale.ENGLISH, "Cannot drop a superuser '%s'", user.name())); }
1,337
58
1,395
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/role/UserActions.java
UserActions
getUserPasswordProperty
class UserActions { private UserActions() { } @Nullable public static SecureHash generateSecureHash(Map<String, Object> properties) throws GeneralSecurityException, IllegalArgumentException { try (SecureString pw = getUserPasswordProperty(properties)) { if (pw != null) { ...
String value = DataTypes.STRING.sanitizeValue(properties.get(CreateRolePlan.PASSWORD_PROPERTY_KEY)); if (value != null) { return new SecureString(value.toCharArray()); } return null;
176
68
244
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/role/metadata/UsersMetadata.java
UsersMetadata
fromXContent
class UsersMetadata extends AbstractNamedDiffable<Metadata.Custom> implements Metadata.Custom { public static final String TYPE = "users"; private final Map<String, SecureHash> users; public UsersMetadata() { this.users = new HashMap<>(); } public UsersMetadata(Map<String, SecureHash> us...
Map<String, SecureHash> users = new HashMap<>(); XContentParser.Token token = parser.nextToken(); if (token == XContentParser.Token.FIELD_NAME && parser.currentName().equals(TYPE)) { token = parser.nextToken(); if (token == XContentParser.Token.START_OBJECT) { ...
961
465
1,426
<methods>public non-sealed void <init>() ,public Diff<org.elasticsearch.cluster.metadata.Metadata.Custom> diff(org.elasticsearch.cluster.metadata.Metadata.Custom) ,public org.elasticsearch.cluster.metadata.Metadata.Custom get() ,public static NamedDiff<T> readDiffFrom(Class<? extends T>, java.lang.String, org.elasticse...
crate_crate
crate/server/src/main/java/io/crate/role/scalar/UserFunction.java
UserFunction
evaluate
class UserFunction extends Scalar<String, Object> { public static final String CURRENT_USER_FUNCTION_NAME = "current_user"; public static final String SESSION_USER_FUNCTION_NAME = "session_user"; public static void register(Functions.Builder builder) { builder.add( Signature.scalar( ...
assert args.length == 0 : "number of args must be 0"; return txnCtx.sessionSettings().userName();
351
35
386
<methods>public BoundSignature boundSignature() ,public Scalar<java.lang.String,java.lang.Object> compile(List<io.crate.expression.symbol.Symbol>, java.lang.String, io.crate.role.Roles) ,public transient abstract java.lang.String evaluate(io.crate.metadata.TransactionContext, io.crate.metadata.NodeContext, Input<java.l...
crate_crate
crate/server/src/main/java/io/crate/server/cli/EnvironmentAwareCommand.java
EnvironmentAwareCommand
createEnv
class EnvironmentAwareCommand extends Command { private final OptionSpec<KeyValuePair> settingOption; /** * Construct the command with the specified command description. This command will have logging configured without reading Elasticsearch * configuration files. * * @param description th...
String pathConf = settings.get("path.conf"); if (pathConf == null) { throw new UserException(ExitCodes.CONFIG, "the system property [path.conf] must be set. Specify with -Cpath.conf=<path>"); } return InternalSettingsPreparer.prepareEnvironment(baseSettings, settings, ...
925
134
1,059
<methods>public void <init>(java.lang.String, java.lang.Runnable) ,public void close() throws java.io.IOException,public final int main(java.lang.String[], org.elasticsearch.cli.Terminal) throws java.lang.Exception,public void mainWithoutErrorHandling(java.lang.String[], org.elasticsearch.cli.Terminal) throws java.lang...
crate_crate
crate/server/src/main/java/io/crate/server/xcontent/LoggingDeprecationHandler.java
LoggingDeprecationHandler
usedDeprecatedName
class LoggingDeprecationHandler implements DeprecationHandler { public static final LoggingDeprecationHandler INSTANCE = new LoggingDeprecationHandler(); /** * The logger to which to send deprecation messages. * * This uses ParseField's logger because that is the logger that * we have been...
DEPRECATION_LOGGER.deprecatedAndMaybeLog( "deprecated_field", "Deprecated field [{}] used, expected [{}] instead", usedName, modernName);
277
46
323
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/server/xcontent/XContentParserUtils.java
XContentParserUtils
throwUnknownField
class XContentParserUtils { private XContentParserUtils() { } /** * Makes sure that current token is of type {@link Token#FIELD_NAME} and the field name is equal to the provided one * @throws ParsingException if the token is not of type {@link Token#FIELD_NAME} or is not equal to the given field...
String message = "Failed to parse object: unknown field [%s] found"; throw new ParsingException(location, String.format(Locale.ROOT, message, field));
548
47
595
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/statistics/SketchRamAccounting.java
SketchRamAccounting
addBytes
class SketchRamAccounting implements AutoCloseable { private static final int BLOCK_SIZE = 1024; private static final int SHIFTED_BLOCK_SIZE = 32; private final RamAccounting ramAccounting; private final RateLimiter rateLimiter; private long blockCache; private long bytesSinceLastPause; ...
this.blockCache += bytes; boolean checklimit = false; while (this.blockCache > BLOCK_SIZE) { this.blockCache -= BLOCK_SIZE; ramAccounting.addBytes(SHIFTED_BLOCK_SIZE); checklimit = true; } if (checklimit) { checkRateLimit(bytes); ...
357
96
453
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/types/CharacterType.java
CharacterType
explicitCast
class CharacterType extends StringType { public static final String NAME = "character"; public static final int ID = 27; public static final CharacterType INSTANCE = new CharacterType(); public static CharacterType of(List<Integer> parameters) { if (parameters.size() != 1) { throw ...
if (value == null) { return null; } var string = cast(value); if (string.length() <= lengthLimit()) { return string; } else { return string.substring(0, lengthLimit()); }
937
68
1,005
<methods>public void <init>(org.elasticsearch.common.io.stream.StreamInput) throws java.io.IOException,public void addMappingOptions(Map<java.lang.String,java.lang.Object>) ,public java.lang.Integer characterMaximumLength() ,public ColumnStatsSupport<java.lang.String> columnStatsSupport() ,public int compare(java.lang....
crate_crate
crate/server/src/main/java/io/crate/types/GeoShapeType.java
GeoShapeType
compare
class GeoShapeType extends DataType<Map<String, Object>> implements Streamer<Map<String, Object>> { public static final int ID = 14; public static final GeoShapeType INSTANCE = new GeoShapeType(); private static final StorageSupport<Map<String, Object>> STORAGE = new StorageSupport<>(false, false, null) { ...
// TODO: compare without converting to shape Shape shape1 = GeoJSONUtils.map2Shape(val1); Shape shape2 = GeoJSONUtils.map2Shape(val2); return switch (shape1.relate(shape2)) { case WITHIN -> -1; case CONTAINS -> 1; default -> Double.compare(shape1.getA...
866
128
994
<methods>public non-sealed void <init>() ,public void addMappingOptions(Map<java.lang.String,java.lang.Object>) ,public java.lang.Integer characterMaximumLength() ,public ColumnStatsSupport<Map<java.lang.String,java.lang.Object>> columnStatsSupport() ,public int compareTo(DataType<?>) ,public boolean equals(java.lang.O...
crate_crate
crate/server/src/main/java/io/crate/types/IntEqQuery.java
IntEqQuery
rangeQuery
class IntEqQuery implements EqQuery<Number> { @Override public Query termQuery(String field, Number value, boolean hasDocValues, boolean isIndexed) { if (isIndexed) { return IntPoint.newExactQuery(field, value.intValue()); } if (hasDocValues) { return SortedNumer...
int lower = Integer.MIN_VALUE; if (lowerTerm != null) { lower = includeLower ? lowerTerm.intValue() : lowerTerm.intValue() + 1; } int upper = Integer.MAX_VALUE; if (upperTerm != null) { upper = includeUpper ? upperTerm.intValue() : upperTerm.intValue() - ...
318
169
487
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/types/JsonType.java
JsonType
explicitCast
class JsonType extends DataType<String> implements Streamer<String> { public static final int ID = 26; public static final JsonType INSTANCE = new JsonType(); @Override public int compare(String o1, String o2) { return o1.compareTo(o2); } @Override public int id() { return...
if (value instanceof Map<?, ?> map) { try { return Strings.toString(JsonXContent.builder().map((Map<String, ?>) map)); } catch (IOException e) { throw new UncheckedIOException(e); } } return (String) value;
396
80
476
<methods>public non-sealed void <init>() ,public void addMappingOptions(Map<java.lang.String,java.lang.Object>) ,public java.lang.Integer characterMaximumLength() ,public ColumnStatsSupport<java.lang.String> columnStatsSupport() ,public int compareTo(DataType<?>) ,public boolean equals(java.lang.Object) ,public java.la...
crate_crate
crate/server/src/main/java/io/crate/types/LongType.java
LongType
sanitizeValue
class LongType extends DataType<Long> implements FixedWidthType, Streamer<Long> { public static final LongType INSTANCE = new LongType(); public static final int ID = 10; public static final int PRECISION = 64; public static final int LONG_SIZE = (int) RamUsageEstimator.shallowSizeOfInstance(Long.class...
if (value == null) { return null; } else if (value instanceof Long l) { return l; } else { return ((Number) value).longValue(); }
892
53
945
<methods>public non-sealed void <init>() ,public void addMappingOptions(Map<java.lang.String,java.lang.Object>) ,public java.lang.Integer characterMaximumLength() ,public ColumnStatsSupport<java.lang.Long> columnStatsSupport() ,public int compareTo(DataType<?>) ,public boolean equals(java.lang.Object) ,public java.lang...
crate_crate
crate/server/src/main/java/io/crate/types/Regclass.java
Regclass
relationOid
class Regclass implements Comparable<Regclass>, Writeable { private final int oid; private final String name; public static Regclass relationOid(RelationInfo relation) {<FILL_FUNCTION_BODY>} public static Regclass primaryOid(RelationInfo relation) { return new Regclass( OidHash.p...
return new Regclass( OidHash.relationOid( OidHash.Type.fromRelationType(relation.relationType()), relation.ident() ), relation.ident().fqn() );
508
60
568
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/types/TimestampType.java
TimestampType
implicitCast
class TimestampType extends DataType<Long> implements FixedWidthType, Streamer<Long> { public static final int ID_WITH_TZ = 11; public static final int ID_WITHOUT_TZ = 15; public static final TimestampType INSTANCE_WITH_TZ = new TimestampType( ID_WITH_TZ, "timestamp with time zone", ...
if (value == null) { return null; } else if (value instanceof Long l) { return l; } else if (value instanceof String str) { return parse.apply(str); } else if (value instanceof Double) { // we treat float and double values as seconds with ...
1,568
197
1,765
<methods>public non-sealed void <init>() ,public void addMappingOptions(Map<java.lang.String,java.lang.Object>) ,public java.lang.Integer characterMaximumLength() ,public ColumnStatsSupport<java.lang.Long> columnStatsSupport() ,public int compareTo(DataType<?>) ,public boolean equals(java.lang.Object) ,public java.lang...
crate_crate
crate/server/src/main/java/io/crate/types/TypeSignaturesASTVisitor.java
TypeSignaturesASTVisitor
getIdentifier
class TypeSignaturesASTVisitor extends TypeSignaturesBaseVisitor<TypeSignature> { @Override public TypeSignature visitDoublePrecision(TypeSignaturesParser.DoublePrecisionContext context) { return new TypeSignature(DataTypes.DOUBLE.getName(), List.of()); } @Override public TypeSignature vis...
if (context != null) { if (context.QUOTED_INDENTIFIER() != null) { var token = context.QUOTED_INDENTIFIER().getText(); return token.substring(1, token.length() - 1); } if (context.UNQUOTED_INDENTIFIER() != null) { return conte...
770
122
892
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/udc/ping/PingTask.java
PingTask
run
class PingTask extends TimerTask { private static final TimeValue HTTP_TIMEOUT = new TimeValue(5, TimeUnit.SECONDS); private static final Logger LOGGER = LogManager.getLogger(PingTask.class); private final ClusterService clusterService; private final ExtendedNodeInfo extendedNodeInfo; private fina...
try { URL url = buildPingUrl(); if (LOGGER.isDebugEnabled()) { LOGGER.debug("Sending UDC information to {}...", url); } HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setConnectTimeout((int) HTTP_TIMEOUT.millis...
847
328
1,175
<methods>public boolean cancel() ,public abstract void run() ,public long scheduledExecutionTime() <variables>static final int CANCELLED,static final int EXECUTED,static final int SCHEDULED,static final int VIRGIN,final java.lang.Object lock,long nextExecutionTime,long period,int state
crate_crate
crate/server/src/main/java/io/crate/udc/service/UDCService.java
UDCService
doStart
class UDCService extends AbstractLifecycleComponent { private static final Logger LOGGER = LogManager.getLogger(UDCService.class); public static final Setting<Boolean> UDC_ENABLED_SETTING = Setting.boolSetting( "udc.enabled", true, Property.NodeScope, Property.Exposed); // Explicit generic is req...
String url = UDC_URL_SETTING.get(settings); TimeValue initialDelay = UDC_INITIAL_DELAY_SETTING.get(settings); TimeValue interval = UDC_INTERVAL_SETTING.get(settings); if (LOGGER.isDebugEnabled()) { LOGGER.debug("Starting with delay {} and period {}.", initialDelay.seconds()...
519
153
672
<methods>public void addLifecycleListener(org.elasticsearch.common.component.LifecycleListener) ,public void close() ,public org.elasticsearch.common.component.Lifecycle.State lifecycleState() ,public void removeLifecycleListener(org.elasticsearch.common.component.LifecycleListener) ,public void start() ,public void st...
crate_crate
crate/server/src/main/java/org/elasticsearch/action/UnavailableShardsException.java
UnavailableShardsException
buildMessage
class UnavailableShardsException extends ElasticsearchException { public UnavailableShardsException(@Nullable ShardId shardId, String message, Object... args) { super(buildMessage(shardId, message), args); } public UnavailableShardsException(String index, int shardId, String message, Object... arg...
return "[" + index + "][" + shardId + "] " + message;
259
25
284
<methods>public void <init>(java.lang.Throwable) ,public transient void <init>(java.lang.String, java.lang.Object[]) ,public transient void <init>(java.lang.String, java.lang.Throwable, java.lang.Object[]) ,public void <init>(org.elasticsearch.common.io.stream.StreamInput) throws java.io.IOException,public void addHead...
crate_crate
crate/server/src/main/java/org/elasticsearch/action/admin/cluster/configuration/TransportClearVotingConfigExclusionsAction.java
TransportClearVotingConfigExclusionsAction
submitClearVotingConfigExclusionsTask
class TransportClearVotingConfigExclusionsAction extends TransportMasterNodeAction<ClearVotingConfigExclusionsRequest, ClearVotingConfigExclusionsResponse> { @Inject public TransportClearVotingConfigExclusionsAction(TransportService transportService, Cl...
clusterService.submitStateUpdateTask("clear-voting-config-exclusions", new ClusterStateUpdateTask(Priority.URGENT) { @Override public ClusterState execute(ClusterState currentState) { CoordinationMetadata newCoordinationMetadata = CoordinationMetadata ...
767
292
1,059
<methods><variables>protected final non-sealed org.elasticsearch.cluster.service.ClusterService clusterService,private final non-sealed java.lang.String executor,protected final non-sealed org.elasticsearch.threadpool.ThreadPool threadPool,protected final non-sealed org.elasticsearch.transport.TransportService transpor...
crate_crate
crate/server/src/main/java/org/elasticsearch/action/admin/cluster/repositories/put/PutRepositoryRequest.java
PutRepositoryRequest
settings
class PutRepositoryRequest extends AcknowledgedRequest<PutRepositoryRequest> implements ToXContentObject { private String name; private String type; private boolean verify = true; private Settings settings = EMPTY_SETTINGS; public PutRepositoryRequest() { } /** * Constructs a new ...
try { XContentBuilder builder = JsonXContent.builder(); builder.map(source); settings(Strings.toString(builder), builder.contentType()); } catch (IOException e) { throw new ElasticsearchGenerationException("Failed to generate [" + source + "]", e); ...
1,204
84
1,288
<methods>public void <init>(org.elasticsearch.common.io.stream.StreamInput) throws java.io.IOException,public io.crate.common.unit.TimeValue ackTimeout() ,public final org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryRequest timeout(java.lang.String) ,public final org.elasticsearch.action.admin.clus...
crate_crate
crate/server/src/main/java/org/elasticsearch/action/admin/cluster/reroute/TransportClusterRerouteAction.java
ClusterRerouteResponseAckedClusterStateUpdateTask
onFailure
class ClusterRerouteResponseAckedClusterStateUpdateTask extends AckedClusterStateUpdateTask<ClusterRerouteResponse> { private final ClusterRerouteRequest request; private final ActionListener<ClusterRerouteResponse> listener; private final Logger logger; private final AllocationService ...
logger.debug(() -> new ParameterizedMessage("failed to perform [{}]", source), e); super.onFailure(source, e);
447
39
486
<methods><variables>protected final non-sealed org.elasticsearch.cluster.service.ClusterService clusterService,private final non-sealed java.lang.String executor,protected final non-sealed org.elasticsearch.threadpool.ThreadPool threadPool,protected final non-sealed org.elasticsearch.transport.TransportService transpor...
crate_crate
crate/server/src/main/java/org/elasticsearch/action/admin/cluster/settings/ClusterUpdateSettingsResponse.java
ClusterUpdateSettingsResponse
equals
class ClusterUpdateSettingsResponse extends AcknowledgedResponse { private final Settings transientSettings; private final Settings persistentSettings; ClusterUpdateSettingsResponse(boolean acknowledged, Settings transientSettings, Settings persistentSettings) { super(acknowledged); this.p...
if (super.equals(o)) { ClusterUpdateSettingsResponse that = (ClusterUpdateSettingsResponse) o; return Objects.equals(transientSettings, that.transientSettings) && Objects.equals(persistentSettings, that.persistentSettings); } return false;
303
75
378
<methods>public void <init>(boolean) ,public void <init>(org.elasticsearch.common.io.stream.StreamInput) throws java.io.IOException,public boolean equals(java.lang.Object) ,public int hashCode() ,public final boolean isAcknowledged() ,public void writeTo(org.elasticsearch.common.io.stream.StreamOutput) throws java.io.I...
crate_crate
crate/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/create/CreateSnapshotResponse.java
CreateSnapshotResponse
toXContent
class CreateSnapshotResponse extends TransportResponse implements ToXContentObject { @Nullable private SnapshotInfo snapshotInfo; CreateSnapshotResponse(@Nullable SnapshotInfo snapshotInfo) { this.snapshotInfo = snapshotInfo; } CreateSnapshotResponse() { } /** * Returns snap...
builder.startObject(); if (snapshotInfo != null) { builder.field("snapshot"); snapshotInfo.toXContent(builder, params); } else { builder.field("accepted", true); } builder.endObject(); return builder;
538
75
613
<methods>public non-sealed void <init>() <variables>
crate_crate
crate/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/delete/DeleteSnapshotRequest.java
DeleteSnapshotRequest
writeTo
class DeleteSnapshotRequest extends MasterNodeRequest<DeleteSnapshotRequest> { private String repository; private String[] snapshots; /** * Constructs a new delete snapshots request */ public DeleteSnapshotRequest() { } /** * Constructs a new delete snapshots request with repo...
super.writeTo(out); out.writeString(repository); if (out.getVersion().onOrAfter(SnapshotsService.MULTI_DELETE_VERSION)) { out.writeStringArray(snapshots); } else { if (snapshots.length != 1) { throw new IllegalArgumentException( ...
436
129
565
<methods>public final org.elasticsearch.action.admin.cluster.snapshots.delete.DeleteSnapshotRequest masterNodeTimeout(io.crate.common.unit.TimeValue) ,public final org.elasticsearch.action.admin.cluster.snapshots.delete.DeleteSnapshotRequest masterNodeTimeout(java.lang.String) ,public final io.crate.common.unit.TimeVal...
crate_crate
crate/server/src/main/java/org/elasticsearch/action/admin/cluster/state/ClusterStateResponse.java
ClusterStateResponse
writeTo
class ClusterStateResponse extends TransportResponse { private final ClusterName clusterName; private final ClusterState clusterState; private boolean waitForTimedOut = false; public ClusterStateResponse(ClusterName clusterName, ClusterState clusterState, boolean waitForTimedOut) { this.cluste...
clusterName.writeTo(out); if (out.getVersion().onOrAfter(Version.V_4_4_0)) { out.writeOptionalWriteable(clusterState); out.writeBoolean(waitForTimedOut); } else { clusterState.writeTo(out); }
819
80
899
<methods>public non-sealed void <init>() <variables>
crate_crate
crate/server/src/main/java/org/elasticsearch/action/admin/indices/create/CreatePartitionsRequest.java
CreatePartitionsRequest
writeTo
class CreatePartitionsRequest extends AcknowledgedRequest<CreatePartitionsRequest> { private final Collection<String> indices; /** * Constructs a new request to create indices with the specified names. */ public CreatePartitionsRequest(Collection<String> indices) { this.indices = indices...
super.writeTo(out); if (out.getVersion().before(Version.V_5_3_0)) { // Nodes < 5.3.0 still expect 2 longs. // They are used to construct an UUID but last time they were actually used in CrateDB 0.55.0. // Hence, sending dummy values. out.writeLong(0L); ...
370
150
520
<methods>public void <init>(org.elasticsearch.common.io.stream.StreamInput) throws java.io.IOException,public io.crate.common.unit.TimeValue ackTimeout() ,public final org.elasticsearch.action.admin.indices.create.CreatePartitionsRequest timeout(java.lang.String) ,public final org.elasticsearch.action.admin.indices.cre...
crate_crate
crate/server/src/main/java/org/elasticsearch/action/admin/indices/flush/FlushRequest.java
FlushRequest
toString
class FlushRequest extends BroadcastRequest<FlushRequest> { private boolean force = false; private boolean waitIfOngoing = true; /** * Constructs a new flush request against one or more indices. If nothing is provided, all indices will * be flushed. */ public FlushRequest(String... indi...
return "FlushRequest{" + "waitIfOngoing=" + waitIfOngoing + ", force=" + force + "}";
477
43
520
<methods>public void <init>() ,public void <init>(org.elasticsearch.common.io.stream.StreamInput) throws java.io.IOException,public java.lang.String[] indices() ,public final transient org.elasticsearch.action.admin.indices.flush.FlushRequest indices(java.lang.String[]) ,public org.elasticsearch.action.support.IndicesO...
crate_crate
crate/server/src/main/java/org/elasticsearch/action/admin/indices/settings/put/UpdateSettingsRequest.java
UpdateSettingsRequest
fromXContent
class UpdateSettingsRequest extends AcknowledgedRequest<UpdateSettingsRequest> implements IndicesRequest.Replaceable, ToXContentObject { private String[] indices; private IndicesOptions indicesOptions = IndicesOptions.fromOptions(false, false, true, true); private Settings settings = EMPTY_SETTINGS...
Map<String, Object> settings = new HashMap<>(); Map<String, Object> bodySettings = parser.map(); Object innerBodySettings = bodySettings.get("settings"); // clean up in case the body is wrapped with "settings" : { ... } if (innerBodySettings instanceof Map) { @Suppre...
1,312
153
1,465
<methods>public void <init>(org.elasticsearch.common.io.stream.StreamInput) throws java.io.IOException,public io.crate.common.unit.TimeValue ackTimeout() ,public final org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsRequest timeout(java.lang.String) ,public final org.elasticsearch.action.admin.indices...
crate_crate
crate/server/src/main/java/org/elasticsearch/action/admin/indices/shrink/TransportResizeAction.java
TransportResizeAction
prepareCreateIndexRequest
class TransportResizeAction extends TransportMasterNodeAction<ResizeRequest, ResizeResponse> { private final MetadataCreateIndexService createIndexService; private final Client client; private final NodeContext nodeContext; @Inject public TransportResizeAction(TransportService transportService, ...
final CreateIndexRequest targetIndex = resizeRequest.getTargetIndexRequest(); final IndexMetadata metadata = state.metadata().index(sourceIndexName); if (metadata == null) { throw new IndexNotFoundException(sourceIndexName); } final Settings.Builder targetIndexSettin...
832
1,066
1,898
<methods><variables>protected final non-sealed org.elasticsearch.cluster.service.ClusterService clusterService,private final non-sealed java.lang.String executor,protected final non-sealed org.elasticsearch.threadpool.ThreadPool threadPool,protected final non-sealed org.elasticsearch.transport.TransportService transpor...
crate_crate
crate/server/src/main/java/org/elasticsearch/action/admin/indices/stats/IndexStats.java
IndexStats
getIndexShards
class IndexStats implements Iterable<IndexShardStats> { private final String index; private final String uuid; private final ShardStats[] shards; public IndexStats(String index, String uuid, ShardStats[] shards) { this.index = index; this.uuid = uuid; this.shards = shards; ...
if (indexShards != null) { return indexShards; } Map<Integer, List<ShardStats>> tmpIndexShards = new HashMap<>(); for (ShardStats shard : shards) { List<ShardStats> lst = tmpIndexShards.get(shard.getShardRouting().id()); if (lst == null) { ...
444
253
697
<no_super_class>
crate_crate
crate/server/src/main/java/org/elasticsearch/action/admin/indices/stats/IndicesStatsResponse.java
IndicesStatsResponse
getIndices
class IndicesStatsResponse extends BroadcastResponse { private final ShardStats[] shards; IndicesStatsResponse(ShardStats[] shards, int totalShards, int successfulShards, int failedShards, List<DefaultShardOperationFailedException> shardFailures) { super(totalShards, successfu...
if (indicesStats != null) { return indicesStats; } Map<String, IndexStats> indicesStats = new HashMap<>(); Set<Index> indices = new HashSet<>(); for (ShardStats shard : shards) { indices.add(shard.getShardRouting().index()); } for (Index...
288
240
528
<methods>public void <init>(int, int, int, List<org.elasticsearch.action.support.DefaultShardOperationFailedException>) ,public void <init>(org.elasticsearch.common.io.stream.StreamInput) throws java.io.IOException,public int getFailedShards() ,public org.elasticsearch.action.support.DefaultShardOperationFailedExceptio...
crate_crate
crate/server/src/main/java/org/elasticsearch/action/bulk/BackoffPolicy.java
ExponentialBackoffIterator
next
class ExponentialBackoffIterator implements Iterator<TimeValue> { private final int numberOfElements; private final int start; private int currentlyConsumed; private ExponentialBackoffIterator(int start, int numberOfElements) { this.start = start; this.numberOf...
if (!hasNext()) { throw new NoSuchElementException("Only up to " + numberOfElements + " elements"); } int result = start + 10 * ((int) Math.exp(0.8d * (currentlyConsumed)) - 1); currentlyConsumed++; return TimeValue.timeValueMillis(result); ...
140
89
229
<no_super_class>
crate_crate
crate/server/src/main/java/org/elasticsearch/action/support/ActiveShardsObserver.java
ActiveShardsObserver
waitForActiveShards
class ActiveShardsObserver { private static final Logger LOGGER = LogManager.getLogger(ActiveShardsObserver.class); private final ClusterService clusterService; public ActiveShardsObserver(final ClusterService clusterService) { this.clusterService = clusterService; } /** * Waits on ...
// wait for the configured number of active shards to be allocated before executing the result consumer if (activeShardCount == ActiveShardCount.NONE) { // not waiting, so just run whatever we were to run when the waiting is onResult.accept(true); return; } ...
277
363
640
<no_super_class>
crate_crate
crate/server/src/main/java/org/elasticsearch/action/support/ChannelActionListener.java
ChannelActionListener
onFailure
class ChannelActionListener< Response extends TransportResponse, Request extends TransportRequest> implements ActionListener<Response> { private static final Logger LOGGER = LogManager.getLogger(ChannelActionListener.class); private final TransportChannel channel; private final Request request; pri...
try { channel.sendResponse(e); } catch (Exception e1) { e1.addSuppressed(e); LOGGER.warn(() -> new ParameterizedMessage( "Failed to send error response for action [{}] and request [{}]", actionName, request), e1); }
201
82
283
<no_super_class>
crate_crate
crate/server/src/main/java/org/elasticsearch/action/support/DefaultShardOperationFailedException.java
DefaultShardOperationFailedException
toString
class DefaultShardOperationFailedException extends ShardOperationFailedException { private static final String INDEX = "index"; private static final String SHARD_ID = "shard"; private static final String REASON = "reason"; private static final ConstructingObjectParser<DefaultShardOperationFailedExcept...
return "[" + index + "][" + shardId + "] failed, reason [" + reason() + "]";
726
32
758
<methods>public final java.lang.Throwable getCause() ,public final java.lang.String index() ,public final java.lang.String reason() ,public final int shardId() ,public final org.elasticsearch.rest.RestStatus status() <variables>protected java.lang.Throwable cause,protected java.lang.String index,protected java.lang.Str...
crate_crate
crate/server/src/main/java/org/elasticsearch/action/support/DestructiveOperations.java
DestructiveOperations
failDestructive
class DestructiveOperations { /** * Setting which controls whether wildcard usage (*, prefix*, _all) is allowed. */ public static final Setting<Boolean> REQUIRES_NAME_SETTING = Setting.boolSetting("action.destructive_requires_name", false, Property.Dynamic, Property.NodeScope); private vo...
if (!destructiveRequiresName) { return; } if (aliasesOrIndices == null || aliasesOrIndices.length == 0) { throw new IllegalArgumentException("Wildcard expressions or all indices are not allowed"); } else if (aliasesOrIndices.length == 1) { if (hasWil...
320
186
506
<no_super_class>
crate_crate
crate/server/src/main/java/org/elasticsearch/action/support/TransportAction.java
TransportAction
execute
class TransportAction<Request extends TransportRequest, Response extends TransportResponse> { protected final String actionName; protected TransportAction(String actionName) { this.actionName = actionName; } public final CompletableFuture<Response> execute(Request request) { return ex...
FutureActionListener<Response> listener = new FutureActionListener<>(); try { doExecute(request, listener); } catch (Exception e) { listener.onFailure(e); } return listener.thenApply(mapper);
148
64
212
<no_super_class>
crate_crate
crate/server/src/main/java/org/elasticsearch/action/support/master/AcknowledgedRequest.java
AcknowledgedRequest
timeout
class AcknowledgedRequest<Request extends MasterNodeRequest<Request>> extends MasterNodeRequest<Request> implements AckedRequest { public static final TimeValue DEFAULT_ACK_TIMEOUT = timeValueSeconds(30); protected TimeValue timeout = DEFAULT_ACK_TIMEOUT; protected AcknowledgedRequest() { } ...
this.timeout = TimeValue.parseTimeValue(timeout, this.timeout, getClass().getSimpleName() + ".timeout"); return (Request)this;
389
41
430
<methods>public final Request masterNodeTimeout(io.crate.common.unit.TimeValue) ,public final Request masterNodeTimeout(java.lang.String) ,public final io.crate.common.unit.TimeValue masterNodeTimeout() ,public void writeTo(org.elasticsearch.common.io.stream.StreamOutput) throws java.io.IOException<variables>public sta...
crate_crate
crate/server/src/main/java/org/elasticsearch/action/support/master/ShardsAcknowledgedResponse.java
ShardsAcknowledgedResponse
equals
class ShardsAcknowledgedResponse extends AcknowledgedResponse { private final boolean shardsAcknowledged; protected ShardsAcknowledgedResponse(boolean acknowledged, boolean shardsAcknowledged) { super(acknowledged); assert acknowledged || shardsAcknowledged == false; // if it's not acknowledge...
if (super.equals(o)) { ShardsAcknowledgedResponse that = (ShardsAcknowledgedResponse) o; return shardsAcknowledged == that.shardsAcknowledged; } return false;
349
63
412
<methods>public void <init>(boolean) ,public void <init>(org.elasticsearch.common.io.stream.StreamInput) throws java.io.IOException,public boolean equals(java.lang.Object) ,public int hashCode() ,public final boolean isAcknowledged() ,public void writeTo(org.elasticsearch.common.io.stream.StreamOutput) throws java.io.I...
crate_crate
crate/server/src/main/java/org/elasticsearch/action/support/single/shard/SingleShardRequest.java
SingleShardRequest
validateNonNullIndex
class SingleShardRequest<Request extends SingleShardRequest<Request>> extends TransportRequest implements IndicesRequest { public static final IndicesOptions INDICES_OPTIONS = IndicesOptions.strictSingleIndexNoExpandForbidClosed(); /** * The concrete index name * * Whether index property is opt...
if (index == null) { throw new IllegalArgumentException("index is missing"); }
553
26
579
<methods>public void <init>() ,public void <init>(org.elasticsearch.common.io.stream.StreamInput) throws java.io.IOException,public org.elasticsearch.tasks.TaskId getParentTask() ,public void setParentTask(org.elasticsearch.tasks.TaskId) ,public void writeTo(org.elasticsearch.common.io.stream.StreamOutput) throws java....
crate_crate
crate/server/src/main/java/org/elasticsearch/action/support/single/shard/TransportSingleShardAction.java
AsyncSingleAction
perform
class AsyncSingleAction { private final ActionListener<Response> listener; private final ShardsIterator shardIt; private final InternalRequest internalRequest; private final DiscoveryNodes nodes; private volatile Exception lastFailure; private AsyncSingleAction(Request ...
Exception lastFailure = this.lastFailure; if (lastFailure == null || TransportActions.isReadOverrideException(currentFailure)) { lastFailure = currentFailure; this.lastFailure = currentFailure; } final ShardRouting shardRouting = shardIt.n...
662
551
1,213
<methods>public final CompletableFuture<Response> execute(Request) ,public final CompletableFuture<T> execute(Request, Function<? super Response,? extends T>) <variables>protected final non-sealed java.lang.String actionName
crate_crate
crate/server/src/main/java/org/elasticsearch/bootstrap/ElasticsearchUncaughtExceptionHandler.java
ElasticsearchUncaughtExceptionHandler
halt
class ElasticsearchUncaughtExceptionHandler implements Thread.UncaughtExceptionHandler { private static final Logger LOGGER = LogManager.getLogger(ElasticsearchUncaughtExceptionHandler.class); @Override public void uncaughtException(Thread t, Throwable e) { if (isFatalUncaught(e)) { tr...
// we halt to prevent shutdown hooks from running Runtime.getRuntime().halt(status);
465
27
492
<no_super_class>
crate_crate
crate/server/src/main/java/org/elasticsearch/bootstrap/Natives.java
Natives
tryMlockall
class Natives { /** no instantiation */ private Natives() { } private static final Logger LOGGER = LogManager.getLogger(Natives.class); // marker to determine if the JNA class files are available to the JVM static final boolean JNA_AVAILABLE; static { boolean v = false; t...
if (!JNA_AVAILABLE) { LOGGER.warn("cannot mlockall because JNA is not available"); return; } JNANatives.tryMlockall();
742
53
795
<no_super_class>
crate_crate
crate/server/src/main/java/org/elasticsearch/client/node/NodeClient.java
NodeClient
transportAction
class NodeClient extends AbstractClient { @SuppressWarnings("rawtypes") private Map<ActionType, TransportAction> actions; public NodeClient(Settings settings, ThreadPool threadPool) { super(settings, threadPool); } @SuppressWarnings("rawtypes") public void initialize(Map<ActionType, T...
if (actions == null) { throw new IllegalStateException("NodeClient has not been initialized"); } TransportAction<Request, Response> transportAction = actions.get(action); if (transportAction == null) { throw new IllegalStateException("failed to find action [" + a...
277
88
365
<methods>public void <init>(org.elasticsearch.common.settings.Settings, org.elasticsearch.threadpool.ThreadPool) ,public final org.elasticsearch.client.AdminClient admin() ,public final org.elasticsearch.common.settings.Settings settings() ,public final org.elasticsearch.threadpool.ThreadPool threadPool() <variables>pr...
crate_crate
crate/server/src/main/java/org/elasticsearch/cluster/ClusterInfo.java
ReservedSpace
writeTo
class ReservedSpace implements Writeable { public static final ReservedSpace EMPTY = new ReservedSpace(0, new ObjectHashSet<>()); private final long total; private final ObjectHashSet<ShardId> shardIds; private ReservedSpace(long total, ObjectHashSet<ShardId> shardIds) { t...
out.writeVLong(total); out.writeVInt(shardIds.size()); for (ObjectCursor<ShardId> shardIdCursor : shardIds) { shardIdCursor.value.writeTo(out); }
576
65
641
<no_super_class>
crate_crate
crate/server/src/main/java/org/elasticsearch/cluster/ClusterName.java
ClusterName
equals
class ClusterName implements Writeable { public static final Setting<ClusterName> CLUSTER_NAME_SETTING = new Setting<>( "cluster.name", "crate", (s) -> { if (s.isEmpty()) { throw new IllegalArgumentException("[cluster.name] must not be empty"); } ...
if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ClusterName that = (ClusterName) o; if (value != null ? !value.equals(that.value) : that.value != null) return false; return true;
440
85
525
<no_super_class>
crate_crate
crate/server/src/main/java/org/elasticsearch/cluster/ClusterStateUpdateTask.java
ClusterStateUpdateTask
clusterStatePublished
class ClusterStateUpdateTask implements ClusterStateTaskConfig, ClusterStateTaskExecutor<ClusterStateUpdateTask>, ClusterStateTaskListener { private final Priority priority; public ClusterStateUpdateTask() { this(Priority.NORMAL); } public ClusterStateUpdateTask(Priority priority) { t...
// final, empty implementation here as this method should only be defined in combination // with a batching executor as it will always be executed within the system context.
489
40
529
<no_super_class>
crate_crate
crate/server/src/main/java/org/elasticsearch/cluster/DiffableUtils.java
ImmutableOpenMapDiff
apply
class ImmutableOpenMapDiff<K, T> extends MapDiff<K, T, ImmutableOpenMap<K, T>> { protected ImmutableOpenMapDiff(StreamInput in, KeySerializer<K> keySerializer, ValueSerializer<K, T> valueSerializer) throws IOException { super(in, keySerializer, valueSerializer); } public ImmutableO...
ImmutableOpenMap.Builder<K, T> builder = ImmutableOpenMap.builder(); builder.putAll(map); for (K part : deletes) { builder.remove(part); } for (Map.Entry<K, Diff<T>> diff : diffs.entrySet()) { builder.put(diff.getKey(), diff....
406
164
570
<no_super_class>
crate_crate
crate/server/src/main/java/org/elasticsearch/cluster/MasterNodeChangePredicate.java
MasterNodeChangePredicate
build
class MasterNodeChangePredicate { private MasterNodeChangePredicate() { } /** * builds a predicate that will accept a cluster state only if it was generated after the current has * (re-)joined the master */ public static Predicate<ClusterState> build(ClusterState currentState) {<FILL_F...
final long currentVersion = currentState.version(); final DiscoveryNode masterNode = currentState.nodes().getMasterNode(); final String currentMasterId = masterNode == null ? null : masterNode.getEphemeralId(); return newState -> { final DiscoveryNode newMaster = newState.no...
93
167
260
<no_super_class>
crate_crate
crate/server/src/main/java/org/elasticsearch/cluster/NodeConnectionsService.java
ConnectionTarget
addListenerAndStartActivity
class ConnectionTarget { private final DiscoveryNode discoveryNode; private CompletableFuture<Void> future = new CompletableFuture<>(); private ActivityType activityType = ActivityType.IDLE; // indicates what any listeners are awaiting private final AtomicInteger consecutiveFailureCoun...
assert Thread.holdsLock(mutex) : "mutex not held"; assert newActivityType.equals(ActivityType.IDLE) == false; if (activityType == ActivityType.IDLE) { activityType = newActivityType; addListener(listener); return activity; ...
1,821
173
1,994
<methods>public void addLifecycleListener(org.elasticsearch.common.component.LifecycleListener) ,public void close() ,public org.elasticsearch.common.component.Lifecycle.State lifecycleState() ,public void removeLifecycleListener(org.elasticsearch.common.component.LifecycleListener) ,public void start() ,public void st...
crate_crate
crate/server/src/main/java/org/elasticsearch/cluster/action/index/NodeMappingRefreshAction.java
NodeMappingRefreshAction
nodeMappingRefresh
class NodeMappingRefreshAction { private static final Logger LOGGER = LogManager.getLogger(NodeMappingRefreshAction.class); public static final String ACTION_NAME = "internal:cluster/node/mapping/refresh"; private final TransportService transportService; private final MetadataMappingService metadataM...
if (masterNode == null) { LOGGER.warn("can't send mapping refresh for [{}], no master known.", request.index()); return; } transportService.sendRequest(masterNode, ACTION_NAME, request, EmptyTransportResponseHandler.INSTANCE_SAME);
627
75
702
<no_super_class>
crate_crate
crate/server/src/main/java/org/elasticsearch/cluster/action/shard/ShardStateAction.java
FailedShardEntry
shardStarted
class FailedShardEntry extends TransportRequest { final ShardId shardId; final String allocationId; final long primaryTerm; final String message; final Exception failure; final boolean markAsStale; FailedShardEntry(StreamInput in) throws IOException { ...
StartedShardEntry entry = new StartedShardEntry(shardRouting.shardId(), shardRouting.allocationId().getId(), primaryTerm, message); sendShardAction(SHARD_STARTED_ACTION_NAME, currentState, entry, listener);
871
69
940
<no_super_class>
crate_crate
crate/server/src/main/java/org/elasticsearch/cluster/block/ClusterBlockException.java
ClusterBlockException
writeTo
class ClusterBlockException extends ElasticsearchException { private final Set<ClusterBlock> blocks; public ClusterBlockException(Set<ClusterBlock> blocks) { super(buildMessage(blocks)); this.blocks = blocks; } public ClusterBlockException(StreamInput in) throws IOException { s...
super.writeTo(out); if (blocks != null) { out.writeCollection(blocks); } else { out.writeVInt(0); }
393
49
442
<methods>public void <init>(java.lang.Throwable) ,public transient void <init>(java.lang.String, java.lang.Object[]) ,public transient void <init>(java.lang.String, java.lang.Throwable, java.lang.Object[]) ,public void <init>(org.elasticsearch.common.io.stream.StreamInput) throws java.io.IOException,public void addHead...
crate_crate
crate/server/src/main/java/org/elasticsearch/cluster/coordination/DetachClusterCommand.java
DetachClusterCommand
processNodePaths
class DetachClusterCommand extends ElasticsearchNodeCommand { public static final String NODE_DETACHED_MSG = "Node was successfully detached from the cluster"; public static final String CONFIRMATION_MSG = DELIMITER + "\n" + "You should only run this tool if you have permanently...
final PersistedClusterStateService persistedClusterStateService = createPersistedClusterStateService(env.settings(), dataPaths); terminal.println(Terminal.Verbosity.VERBOSE, "Loading cluster state"); final ClusterState oldClusterState = loadTermAndClusterState(persistedClusterStateService, env...
486
240
726
<methods>public void <init>(java.lang.String) ,public static org.elasticsearch.cluster.ClusterState clusterState(org.elasticsearch.env.Environment, org.elasticsearch.gateway.PersistedClusterStateService.OnDiskState) ,public static org.elasticsearch.gateway.PersistedClusterStateService createPersistedClusterStateService...
crate_crate
crate/server/src/main/java/org/elasticsearch/cluster/coordination/Join.java
Join
hashCode
class Join implements Writeable { private final DiscoveryNode sourceNode; private final DiscoveryNode targetNode; private final long term; private final long lastAcceptedTerm; private final long lastAcceptedVersion; public Join(DiscoveryNode sourceNode, DiscoveryNode targetNode, long term, long...
int result = (int) (lastAcceptedVersion ^ (lastAcceptedVersion >>> 32)); result = 31 * result + sourceNode.hashCode(); result = 31 * result + targetNode.hashCode(); result = 31 * result + (int) (term ^ (term >>> 32)); result = 31 * result + (int) (lastAcceptedTerm ^ (lastAccepte...
730
115
845
<no_super_class>
crate_crate
crate/server/src/main/java/org/elasticsearch/cluster/coordination/JoinRequest.java
JoinRequest
equals
class JoinRequest extends TransportRequest { /** * The sending (i.e. joining) node. */ private final DiscoveryNode sourceNode; /** * The minimum term for which the joining node will accept any cluster state publications. If the joining node is in a strictly greater * term than the mast...
if (this == o) return true; if (!(o instanceof JoinRequest)) return false; JoinRequest that = (JoinRequest) o; if (minimumTerm != that.minimumTerm) return false; if (!sourceNode.equals(that.sourceNode)) return false; return optionalJoin.equals(that.optionalJoin);
855
87
942
<methods>public void <init>() ,public void <init>(org.elasticsearch.common.io.stream.StreamInput) throws java.io.IOException,public org.elasticsearch.tasks.TaskId getParentTask() ,public void setParentTask(org.elasticsearch.tasks.TaskId) ,public void writeTo(org.elasticsearch.common.io.stream.StreamOutput) throws java....
crate_crate
crate/server/src/main/java/org/elasticsearch/cluster/coordination/LagDetector.java
LagDetector
startLagDetector
class LagDetector { private static final Logger LOGGER = LogManager.getLogger(LagDetector.class); // the timeout for each node to apply a cluster state update after the leader has applied it, before being removed from the cluster public static final Setting<TimeValue> CLUSTER_FOLLOWER_LAG_TIMEOUT_SETTING ...
final List<NodeAppliedStateTracker> laggingTrackers = appliedStateTrackersByNode.values().stream().filter(t -> t.appliedVersionLessThan(version)).collect(Collectors.toList()); if (laggingTrackers.isEmpty()) { LOGGER.trace("lag detection for version {} is unnecessary: {}", versi...
1,219
238
1,457
<no_super_class>
crate_crate
crate/server/src/main/java/org/elasticsearch/cluster/coordination/PreVoteRequest.java
PreVoteRequest
equals
class PreVoteRequest extends TransportRequest { private final DiscoveryNode sourceNode; private final long currentTerm; public PreVoteRequest(DiscoveryNode sourceNode, long currentTerm) { this.sourceNode = sourceNode; this.currentTerm = currentTerm; } public PreVoteRequest(StreamI...
if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; PreVoteRequest that = (PreVoteRequest) o; return currentTerm == that.currentTerm && Objects.equals(sourceNode, that.sourceNode);
322
77
399
<methods>public void <init>() ,public void <init>(org.elasticsearch.common.io.stream.StreamInput) throws java.io.IOException,public org.elasticsearch.tasks.TaskId getParentTask() ,public void setParentTask(org.elasticsearch.tasks.TaskId) ,public void writeTo(org.elasticsearch.common.io.stream.StreamOutput) throws java....
crate_crate
crate/server/src/main/java/org/elasticsearch/cluster/coordination/PublicationTransportHandler.java
PublicationContext
sendApplyCommit
class PublicationContext { private final DiscoveryNodes discoveryNodes; private final ClusterState newState; private final ClusterState previousState; private final boolean sendFullVersion; private final Map<Version, BytesReference> serializedStates = new HashMap<>(); pr...
transportService.sendRequest(destination, COMMIT_STATE_ACTION_NAME, applyCommitRequest, stateRequestOptions, new TransportResponseHandler<TransportResponse.Empty>() { @Override public TransportResponse.Empty read(StreamInput in) { ...
1,735
172
1,907
<no_super_class>
crate_crate
crate/server/src/main/java/org/elasticsearch/cluster/coordination/PublishClusterStateStats.java
PublishClusterStateStats
toXContent
class PublishClusterStateStats implements Writeable, ToXContentObject { private final long fullClusterStateReceivedCount; private final long incompatibleClusterStateDiffReceivedCount; private final long compatibleClusterStateDiffReceivedCount; /** * @param fullClusterStateReceivedCount the number...
builder.startObject("published_cluster_states"); { builder.field("full_states", fullClusterStateReceivedCount); builder.field("incompatible_diffs", incompatibleClusterStateDiffReceivedCount); builder.field("compatible_diffs", compatibleClusterStateDiffReceivedCount);...
593
91
684
<no_super_class>
crate_crate
crate/server/src/main/java/org/elasticsearch/cluster/coordination/PublishResponse.java
PublishResponse
toString
class PublishResponse implements Writeable { private final long term; private final long version; public PublishResponse(long term, long version) { assert term >= 0; assert version >= 0; this.term = term; this.version = version; } public PublishResponse(StreamInpu...
return "PublishResponse{" + "term=" + term + ", version=" + version + '}';
358
35
393
<no_super_class>
crate_crate
crate/server/src/main/java/org/elasticsearch/cluster/coordination/RemoveCustomsCommand.java
RemoveCustomsCommand
processNodePaths
class RemoveCustomsCommand extends ElasticsearchNodeCommand { static final String CUSTOMS_REMOVED_MSG = "Customs were successfully removed from the cluster state"; static final String CONFIRMATION_MSG = DELIMITER + "\n" + "You should only run this tool if you have broken custom ...
final List<String> customsToRemove = arguments.values(options); if (customsToRemove.isEmpty()) { throw new UserException(ExitCodes.USAGE, "Must supply at least one custom metadata name to remove"); } final PersistedClusterStateService persistedClusterStateService = createPe...
251
565
816
<methods>public void <init>(java.lang.String) ,public static org.elasticsearch.cluster.ClusterState clusterState(org.elasticsearch.env.Environment, org.elasticsearch.gateway.PersistedClusterStateService.OnDiskState) ,public static org.elasticsearch.gateway.PersistedClusterStateService createPersistedClusterStateService...
crate_crate
crate/server/src/main/java/org/elasticsearch/cluster/coordination/RemoveSettingsCommand.java
RemoveSettingsCommand
processNodePaths
class RemoveSettingsCommand extends ElasticsearchNodeCommand { static final String SETTINGS_REMOVED_MSG = "Settings were successfully removed from the cluster state"; static final String CONFIRMATION_MSG = DELIMITER + "\n" + "You should only run this tool if you have incompatible settin...
final List<String> settingsToRemove = arguments.values(options); if (settingsToRemove.isEmpty()) { throw new UserException(ExitCodes.USAGE, "Must supply at least one setting to remove"); } final PersistedClusterStateService persistedClusterStateService = createPersistedClus...
244
594
838
<methods>public void <init>(java.lang.String) ,public static org.elasticsearch.cluster.ClusterState clusterState(org.elasticsearch.env.Environment, org.elasticsearch.gateway.PersistedClusterStateService.OnDiskState) ,public static org.elasticsearch.gateway.PersistedClusterStateService createPersistedClusterStateService...
crate_crate
crate/server/src/main/java/org/elasticsearch/cluster/coordination/StartJoinRequest.java
StartJoinRequest
hashCode
class StartJoinRequest extends TransportRequest { private final DiscoveryNode sourceNode; private final long term; public StartJoinRequest(DiscoveryNode sourceNode, long term) { this.sourceNode = sourceNode; this.term = term; } public StartJoinRequest(StreamInput input) throws IO...
int result = sourceNode.hashCode(); result = 31 * result + (int) (term ^ (term >>> 32)); return result;
364
42
406
<methods>public void <init>() ,public void <init>(org.elasticsearch.common.io.stream.StreamInput) throws java.io.IOException,public org.elasticsearch.tasks.TaskId getParentTask() ,public void setParentTask(org.elasticsearch.tasks.TaskId) ,public void writeTo(org.elasticsearch.common.io.stream.StreamOutput) throws java....
crate_crate
crate/server/src/main/java/org/elasticsearch/cluster/node/DiscoveryNodeRole.java
UnknownRole
roleSetting
class UnknownRole extends DiscoveryNodeRole { /** * Construct an unknown role with the specified role name and role name abbreviation. * * @param roleName the role name * @param roleNameAbbreviation the role name abbreviation */ UnknownRole(final...
// since this setting is not registered, it will always return false when testing if the local node has the role assert false; return Setting.boolSetting("node. " + roleName(), false, Setting.Property.NodeScope);
131
56
187
<no_super_class>
crate_crate
crate/server/src/main/java/org/elasticsearch/cluster/routing/DelayedAllocationService.java
DelayedRerouteTask
onFailure
class DelayedRerouteTask extends ClusterStateUpdateTask { final TimeValue nextDelay; // delay until submitting the reroute command final long baseTimestampNanos; // timestamp (in nanos) upon which delay was calculated volatile Scheduler.Cancellable cancellable; final AtomicBoolean cancel...
removeIfSameTask(this); LOGGER.warn("failed to schedule/execute reroute post unassigned shard", e);
605
35
640
<methods>public void addLifecycleListener(org.elasticsearch.common.component.LifecycleListener) ,public void close() ,public org.elasticsearch.common.component.Lifecycle.State lifecycleState() ,public void removeLifecycleListener(org.elasticsearch.common.component.LifecycleListener) ,public void start() ,public void st...
crate_crate
crate/server/src/main/java/org/elasticsearch/cluster/routing/GroupShardsIterator.java
GroupShardsIterator
totalSize
class GroupShardsIterator<ShardIt extends ShardIterator> implements Iterable<ShardIt> { private final List<ShardIt> iterators; /** * Constructs a new sorted GroupShardsIterator from the given list. Items are sorted based on their natural ordering. * @see PlainShardIterator#compareTo(ShardIterator) ...
int size = 0; for (ShardIterator shard : iterators) { size += shard.size(); } return size;
450
41
491
<no_super_class>
crate_crate
crate/server/src/main/java/org/elasticsearch/cluster/routing/allocation/AbstractAllocationDecision.java
AbstractAllocationDecision
writeTo
class AbstractAllocationDecision implements ToXContentFragment, Writeable { @Nullable protected final DiscoveryNode targetNode; @Nullable protected final List<NodeAllocationResult> nodeDecisions; protected AbstractAllocationDecision(@Nullable DiscoveryNode targetNode, @Nullable List<NodeAllocation...
out.writeOptionalWriteable(targetNode); if (nodeDecisions != null) { out.writeBoolean(true); out.writeList(nodeDecisions); } else { out.writeBoolean(false); }
1,416
64
1,480
<no_super_class>
crate_crate
crate/server/src/main/java/org/elasticsearch/cluster/routing/allocation/DiskThresholdSettings.java
FloodStageValidator
setFloodStageRaw
class FloodStageValidator implements Setting.Validator<String> { @Override public void validate(final String value) { } @Override public void validate(final String value, final Map<Setting<?>, Object> settings) { final String lowWatermarkRaw = (String) settings.get...
// Watermark is expressed in terms of used data, but we need "free" data watermark this.floodStageRaw = floodStageRaw; this.freeDiskThresholdFloodStage = 100.0 - thresholdPercentageFromWatermark(floodStageRaw); this.freeBytesThresholdFloodStage = thresholdBytesFromWatermark(floodStageRa...
1,523
137
1,660
<no_super_class>
crate_crate
crate/server/src/main/java/org/elasticsearch/cluster/routing/allocation/RoutingExplanations.java
RoutingExplanations
toXContent
class RoutingExplanations implements ToXContentFragment { private final List<RerouteExplanation> explanations; public RoutingExplanations() { this.explanations = new ArrayList<>(); } public RoutingExplanations add(RerouteExplanation explanation) { this.explanations.add(explanation); ...
builder.startArray("explanations"); for (RerouteExplanation explanation : explanations) { explanation.toXContent(builder, params); } builder.endArray(); return builder;
523
56
579
<no_super_class>
crate_crate
crate/server/src/main/java/org/elasticsearch/cluster/routing/allocation/ShardAllocationDecision.java
ShardAllocationDecision
toXContent
class ShardAllocationDecision implements ToXContentFragment, Writeable { public static final ShardAllocationDecision NOT_TAKEN = new ShardAllocationDecision(AllocateUnassignedDecision.NOT_TAKEN, MoveDecision.NOT_TAKEN); private final AllocateUnassignedDecision allocateDecision; private final MoveDe...
if (allocateDecision.isDecisionTaken()) { allocateDecision.toXContent(builder, params); } if (moveDecision.isDecisionTaken()) { moveDecision.toXContent(builder, params); } return builder;
608
74
682
<no_super_class>
crate_crate
crate/server/src/main/java/org/elasticsearch/cluster/routing/allocation/decider/ClusterRebalanceAllocationDecider.java
ClusterRebalanceAllocationDecider
canRebalance
class ClusterRebalanceAllocationDecider extends AllocationDecider { private static final Logger LOGGER = LogManager.getLogger(ClusterRebalanceAllocationDecider.class); public static final String NAME = "cluster_rebalance"; private static final String CLUSTER_ROUTING_ALLOCATION_ALLOW_REBALANCE = "cluster.r...
if (type == ClusterRebalanceType.INDICES_PRIMARIES_ACTIVE) { // check if there are unassigned primaries. if (allocation.routingNodes().hasUnassignedPrimaries()) { return allocation.decision( Decision.NO, NAME, "...
965
569
1,534
<methods>public org.elasticsearch.cluster.routing.allocation.decider.Decision canAllocate(org.elasticsearch.cluster.routing.ShardRouting, org.elasticsearch.cluster.routing.RoutingNode, org.elasticsearch.cluster.routing.allocation.RoutingAllocation) ,public org.elasticsearch.cluster.routing.allocation.decider.Decision c...
crate_crate
crate/server/src/main/java/org/elasticsearch/cluster/routing/allocation/decider/NodeVersionAllocationDecider.java
NodeVersionAllocationDecider
canAllocate
class NodeVersionAllocationDecider extends AllocationDecider { public static final String NAME = "node_version"; @Override public Decision canAllocate(ShardRouting shardRouting, RoutingNode node, RoutingAllocation allocation) {<FILL_FUNCTION_BODY>} private Decision isVersionCompatibleRelocatePrimary(...
if (shardRouting.primary()) { if (shardRouting.currentNodeId() == null) { if (shardRouting.recoverySource() != null && shardRouting.recoverySource().getType() == RecoverySource.Type.SNAPSHOT) { // restoring from a snapshot - check that the node can handle the ver...
778
358
1,136
<methods>public org.elasticsearch.cluster.routing.allocation.decider.Decision canAllocate(org.elasticsearch.cluster.routing.ShardRouting, org.elasticsearch.cluster.routing.RoutingNode, org.elasticsearch.cluster.routing.allocation.RoutingAllocation) ,public org.elasticsearch.cluster.routing.allocation.decider.Decision c...
crate_crate
crate/server/src/main/java/org/elasticsearch/cluster/routing/allocation/decider/ReplicaAfterPrimaryActiveAllocationDecider.java
ReplicaAfterPrimaryActiveAllocationDecider
canAllocate
class ReplicaAfterPrimaryActiveAllocationDecider extends AllocationDecider { private static final String NAME = "replica_after_primary_active"; @Override public Decision canAllocate(ShardRouting shardRouting, RoutingNode node, RoutingAllocation allocation) { return canAllocate(shardRouting, alloca...
if (shardRouting.primary()) { return allocation.decision(Decision.YES, NAME, "shard is primary and can be allocated"); } ShardRouting primary = allocation.routingNodes().activePrimary(shardRouting.shardId()); if (primary == null) { return allocation.decision(Deci...
132
136
268
<methods>public org.elasticsearch.cluster.routing.allocation.decider.Decision canAllocate(org.elasticsearch.cluster.routing.ShardRouting, org.elasticsearch.cluster.routing.RoutingNode, org.elasticsearch.cluster.routing.allocation.RoutingAllocation) ,public org.elasticsearch.cluster.routing.allocation.decider.Decision c...
crate_crate
crate/server/src/main/java/org/elasticsearch/cluster/service/ClusterApplierService.java
UpdateTask
state
class UpdateTask extends SourcePrioritizedRunnable implements UnaryOperator<ClusterState> { final ClusterApplyListener listener; final UnaryOperator<ClusterState> updateFunction; UpdateTask(Priority priority, String source, ClusterApplyListener listener, UnaryOperator<Cluster...
assert assertNotCalledFromClusterStateApplier("the applied cluster state is not yet available"); ClusterState clusterState = this.state.get(); assert clusterState != null : "initial cluster state not set yet"; return clusterState;
379
62
441
<methods>public void addLifecycleListener(org.elasticsearch.common.component.LifecycleListener) ,public void close() ,public org.elasticsearch.common.component.Lifecycle.State lifecycleState() ,public void removeLifecycleListener(org.elasticsearch.common.component.LifecycleListener) ,public void start() ,public void st...
crate_crate
crate/server/src/main/java/org/elasticsearch/cluster/service/ClusterService.java
ClusterService
assertClusterOrMasterStateThread
class ClusterService extends AbstractLifecycleComponent { private final MasterService masterService; private final ClusterApplierService clusterApplierService; public static final org.elasticsearch.common.settings.Setting.AffixSetting<String> USER_DEFINED_METADATA = Setting.prefixKeySetting("clust...
assert Thread.currentThread().getName().contains(ClusterApplierService.CLUSTER_UPDATE_THREAD_NAME) || Thread.currentThread().getName().contains(MasterService.MASTER_UPDATE_THREAD_NAME) : "not called from the master/cluster state update thread"; return true;
1,963
76
2,039
<methods>public void addLifecycleListener(org.elasticsearch.common.component.LifecycleListener) ,public void close() ,public org.elasticsearch.common.component.Lifecycle.State lifecycleState() ,public void removeLifecycleListener(org.elasticsearch.common.component.LifecycleListener) ,public void start() ,public void st...
crate_crate
crate/server/src/main/java/org/elasticsearch/common/Numbers.java
Numbers
toLongExact
class Numbers { private static final BigInteger MAX_LONG_VALUE = BigInteger.valueOf(Long.MAX_VALUE); private static final BigInteger MIN_LONG_VALUE = BigInteger.valueOf(Long.MIN_VALUE); private Numbers() { } public static long bytesToLong(BytesRef bytes) { int high = (bytes.bytes[bytes.o...
if (n instanceof Byte || n instanceof Short || n instanceof Integer || n instanceof Long) { return n.longValue(); } else if (n instanceof Float || n instanceof Double) { double d = n.doubleValue(); if (d != Math.round(d)) { throw new I...
961
206
1,167
<no_super_class>
crate_crate
crate/server/src/main/java/org/elasticsearch/common/Randomness.java
Randomness
get
class Randomness { private static final Method CURRENT_METHOD; private static final Method GET_RANDOM_METHOD; static { Method maybeCurrentMethod; Method maybeGetRandomMethod; try { Class<?> clazz = Class.forName("com.carrotsearch.randomizedtesting.RandomizedContext"); ...
if (CURRENT_METHOD != null && GET_RANDOM_METHOD != null) { try { Object randomizedContext = CURRENT_METHOD.invoke(null); return (Random) GET_RANDOM_METHOD.invoke(randomizedContext); } catch (ReflectiveOperationException e) { // unexpected,...
772
130
902
<no_super_class>
crate_crate
crate/server/src/main/java/org/elasticsearch/common/bytes/ByteBufferReference.java
ByteBufferReference
slice
class ByteBufferReference extends AbstractBytesReference { private final ByteBuffer buffer; private final int length; ByteBufferReference(ByteBuffer buffer) { this.buffer = buffer.slice(); this.length = buffer.remaining(); } @Override public byte get(int index) { retur...
Objects.checkFromIndexSize(from, length, this.length); buffer.position(from); buffer.limit(from + length); ByteBufferReference newByteBuffer = new ByteBufferReference(buffer); buffer.position(0); buffer.limit(this.length); return newByteBuffer;
333
80
413
<methods>public non-sealed void <init>() ,public int compareTo(org.elasticsearch.common.bytes.BytesReference) ,public boolean equals(java.lang.Object) ,public int getInt(int) ,public int hashCode() ,public int indexOf(byte, int) ,public BytesRefIterator iterator() ,public org.elasticsearch.common.io.stream.StreamInput ...
crate_crate
crate/server/src/main/java/org/elasticsearch/common/bytes/BytesReferenceStreamInput.java
BytesReferenceStreamInput
read
class BytesReferenceStreamInput extends StreamInput { private final BytesRefIterator iterator; private int sliceIndex; private BytesRef slice; private final int length; // the total size of the stream private int offset; // the current position of the stream BytesReferenceStreamInput(BytesRefIt...
if (offset >= length) { return -1; } final int numBytesToCopy = Math.min(len, length - offset); int remaining = numBytesToCopy; // copy the full length or the remaining part int destOffset = bOffset; while (remaining > 0) { maybeNextSlice(); ...
754
215
969
<methods>public non-sealed void <init>() ,public abstract int available() throws java.io.IOException,public abstract void close() throws java.io.IOException,public org.elasticsearch.Version getVersion() ,public T[] readArray(Reader<T>, IntFunction<T[]>) throws java.io.IOException,public final boolean readBoolean() thro...
crate_crate
crate/server/src/main/java/org/elasticsearch/common/bytes/PagedBytesReference.java
PagedBytesReference
iterator
class PagedBytesReference extends AbstractBytesReference { private static final int PAGE_SIZE = PageCacheRecycler.BYTE_PAGE_SIZE; private final ByteArray byteArray; private final int offset; private final int length; PagedBytesReference(ByteArray byteArray, int from, int length) { assert ...
final int offset = this.offset; final int length = this.length; // this iteration is page aligned to ensure we do NOT materialize the pages from the ByteArray // we calculate the initial fragment size here to ensure that if this reference is a slice we are still page aligned // ...
386
389
775
<methods>public non-sealed void <init>() ,public int compareTo(org.elasticsearch.common.bytes.BytesReference) ,public boolean equals(java.lang.Object) ,public int getInt(int) ,public int hashCode() ,public int indexOf(byte, int) ,public BytesRefIterator iterator() ,public org.elasticsearch.common.io.stream.StreamInput ...
crate_crate
crate/server/src/main/java/org/elasticsearch/common/component/AbstractLifecycleComponent.java
AbstractLifecycleComponent
start
class AbstractLifecycleComponent implements LifecycleComponent { protected final Lifecycle lifecycle = new Lifecycle(); private final List<LifecycleListener> listeners = new CopyOnWriteArrayList<>(); protected AbstractLifecycleComponent() { } @Override public Lifecycle.State lifecycleState()...
synchronized (lifecycle) { if (!lifecycle.canMoveToStarted()) { return; } for (LifecycleListener listener : listeners) { listener.beforeStart(); } doStart(); lifecycle.moveToStarted(); for (Lifec...
518
104
622
<no_super_class>
crate_crate
crate/server/src/main/java/org/elasticsearch/common/compress/CompressedXContent.java
CompressedXContent
crc32
class CompressedXContent { private static int crc32(BytesReference data) {<FILL_FUNCTION_BODY>} private final byte[] bytes; private final int crc32; // Used for serialization private CompressedXContent(byte[] compressed, int crc32) { this.bytes = compressed; this.crc32 = crc32; ...
CRC32 crc32 = new CRC32(); try { data.writeTo(new CheckedOutputStream(Streams.NULL_OUTPUT_STREAM, crc32)); } catch (IOException bogus) { // cannot happen throw new Error(bogus); } return (int) crc32.getValue();
1,106
95
1,201
<no_super_class>
crate_crate
crate/server/src/main/java/org/elasticsearch/common/hash/MessageDigests.java
MessageDigests
createThreadLocalMessageDigest
class MessageDigests { private static ThreadLocal<MessageDigest> createThreadLocalMessageDigest(String digest) {<FILL_FUNCTION_BODY>} private static final ThreadLocal<MessageDigest> MD5_DIGEST = createThreadLocalMessageDigest("MD5"); private static final ThreadLocal<MessageDigest> SHA_1_DIGEST = createThr...
return ThreadLocal.withInitial(() -> { try { return MessageDigest.getInstance(digest); } catch (NoSuchAlgorithmException e) { throw new IllegalStateException("unexpected exception creating MessageDigest instance for [" + digest + "]", e); } ...
365
76
441
<no_super_class>
crate_crate
crate/server/src/main/java/org/elasticsearch/common/io/PathUtils.java
PathUtils
get
class PathUtils { /** no instantiation */ private PathUtils() { } /** the actual JDK default */ static final FileSystem ACTUAL_DEFAULT = FileSystems.getDefault(); /** can be changed by tests */ static volatile FileSystem DEFAULT = ACTUAL_DEFAULT; /** * Returns a {@code Path} from...
for (Path root : roots) { Path normalizedRoot = root.normalize(); Path normalizedPath = normalizedRoot.resolve(path).normalize(); if (normalizedPath.startsWith(normalizedRoot)) { return normalizedPath; } } return null;
551
74
625
<no_super_class>
crate_crate
crate/server/src/main/java/org/elasticsearch/common/io/stream/ByteBufferStreamInput.java
ByteBufferStreamInput
readShort
class ByteBufferStreamInput extends StreamInput { private final ByteBuffer buffer; public ByteBufferStreamInput(ByteBuffer buffer) { this.buffer = buffer; } @Override public int read() throws IOException { if (!buffer.hasRemaining()) { return -1; } retu...
try { return buffer.getShort(); } catch (BufferUnderflowException ex) { EOFException eofException = new EOFException(); eofException.initCause(ex); throw eofException; }
749
63
812
<methods>public non-sealed void <init>() ,public abstract int available() throws java.io.IOException,public abstract void close() throws java.io.IOException,public org.elasticsearch.Version getVersion() ,public T[] readArray(Reader<T>, IntFunction<T[]>) throws java.io.IOException,public final boolean readBoolean() thro...
crate_crate
crate/server/src/main/java/org/elasticsearch/common/io/stream/NamedWriteableRegistry.java
Entry
getReader
class Entry { /** The superclass of a {@link NamedWriteable} which will be read by {@link #reader}. */ public final Class<?> categoryClass; /** A name for the writeable which is unique to the {@link #categoryClass}. */ public final String name; /** A reader capability of readi...
Map<String, Writeable.Reader<?>> readers = registry.get(categoryClass); if (readers == null) { throw new IllegalArgumentException("Unknown NamedWriteable category [" + categoryClass.getName() + "]"); } @SuppressWarnings("unchecked") Writeable.Reader<? extends T> read...
773
151
924
<no_super_class>
crate_crate
crate/server/src/main/java/org/elasticsearch/common/logging/DeprecationLogger.java
DeprecationLogger
deprecated
class DeprecationLogger { private static final ThreadLocal<RingBuffer<String>> RECENT_WARNINGS = ThreadLocal.withInitial(() -> new RingBuffer<String>(20)); private final Logger logger; /** * Creates a new deprecation logger based on the parent logger. Automatically * prefixes the logger name wi...
if (shouldLog) { logger.warn(message, params); var msg = LoggerMessageFormat.format(message, params); RECENT_WARNINGS.get().add(msg); }
628
55
683
<no_super_class>
crate_crate
crate/server/src/main/java/org/elasticsearch/common/lucene/MinimumScoreCollector.java
MinimumScoreCollector
setScorer
class MinimumScoreCollector<T extends Collector> extends SimpleCollector { private final T collector; private final float minimumScore; private Scorable scorer; private LeafCollector leafCollector; public MinimumScoreCollector(T collector, float minimumScore) { this.collector = collector;...
if (!(scorer instanceof ScoreCachingWrappingScorer)) { scorer = ScoreCachingWrappingScorer.wrap(scorer); } this.scorer = scorer; leafCollector.setScorer(scorer);
263
66
329
<no_super_class>
crate_crate
crate/server/src/main/java/org/elasticsearch/common/lucene/index/ElasticsearchLeafReader.java
ElasticsearchLeafReader
getElasticsearchLeafReader
class ElasticsearchLeafReader extends SequentialStoredFieldsLeafReader { private final ShardId shardId; /** * <p>Construct a FilterLeafReader based on the specified base reader. * <p>Note that base reader is closed if this FilterLeafReader is closed.</p> * * @param in specified base reader...
if (reader instanceof FilterLeafReader) { if (reader instanceof ElasticsearchLeafReader) { return (ElasticsearchLeafReader) reader; } else { // We need to use FilterLeafReader#getDelegate and not FilterLeafReader#unwrap, because // If ther...
279
172
451
<methods>public void <init>(LeafReader) ,public StoredFieldsReader getSequentialStoredFieldsReader() throws java.io.IOException<variables>
crate_crate
crate/server/src/main/java/org/elasticsearch/common/lucene/index/SequentialStoredFieldsLeafReader.java
SequentialStoredFieldsLeafReader
getSequentialStoredFieldsReader
class SequentialStoredFieldsLeafReader extends FilterLeafReader { /** * <p>Construct a StoredFieldsFilterLeafReader based on the specified base reader. * <p>Note that base reader is closed if this FilterLeafReader is closed.</p> * * @param in specified base reader. */ public SequentialS...
if (in instanceof CodecReader) { CodecReader reader = (CodecReader) in; return reader.getFieldsReader().getMergeInstance(); } else if (in instanceof SequentialStoredFieldsLeafReader) { SequentialStoredFieldsLeafReader reader = (SequentialStoredFieldsLeafReader) in; ...
176
141
317
<no_super_class>
crate_crate
crate/server/src/main/java/org/elasticsearch/common/lucene/search/Queries.java
Queries
applyMinimumShouldMatch
class Queries { public static Query newUnmappedFieldQuery(String field) { return new MatchNoDocsQuery("unmapped field [" + (field != null ? field : "null") + "]"); } public static Query newLenientFieldQuery(String field, RuntimeException e) { String message = ElasticsearchException.getExce...
if (minimumShouldMatch == null) { return query; } int optionalClauses = 0; for (BooleanClause c : query.clauses()) { if (c.getOccur() == BooleanClause.Occur.SHOULD) { optionalClauses++; } } int msm = calculateMinShould...
826
185
1,011
<no_super_class>
crate_crate
crate/server/src/main/java/org/elasticsearch/common/lucene/store/InputStreamIndexInput.java
InputStreamIndexInput
read
class InputStreamIndexInput extends InputStream { private final IndexInput indexInput; private final long limit; private final long actualSizeToRead; private long counter = 0; private long markPointer; private long markCounter; public InputStreamIndexInput(IndexInput indexInput, long l...
if (counter++ >= limit) { return -1; } return (indexInput.getFilePointer() < indexInput.length()) ? (indexInput.readByte() & 0xff) : -1;
528
57
585
<methods>public void <init>() ,public int available() throws java.io.IOException,public void close() throws java.io.IOException,public synchronized void mark(int) ,public boolean markSupported() ,public static java.io.InputStream nullInputStream() ,public abstract int read() throws java.io.IOException,public int read(b...
crate_crate
crate/server/src/main/java/org/elasticsearch/common/lucene/uid/PerThreadIDVersionAndSeqNoLookup.java
PerThreadIDVersionAndSeqNoLookup
lookupSeqNo
class PerThreadIDVersionAndSeqNoLookup { // TODO: do we really need to store all this stuff? some if it might not speed up anything. // we keep it around for now, to reduce the amount of e.g. hash lookups by field and stuff /** terms enum for uid field */ final String uidField; private final TermsE...
assert context.reader().getCoreCacheHelper().getKey().equals(readerKey) : "context's reader is not the same as the reader class was initialized on."; final int docID = getDocID(id, context); if (docID != DocIdSetIterator.NO_MORE_DOCS) { final long seqNo = readNumericDocV...
1,468
147
1,615
<no_super_class>
crate_crate
crate/server/src/main/java/org/elasticsearch/common/lucene/uid/VersionsAndSeqNoResolver.java
VersionsAndSeqNoResolver
getLookupState
class VersionsAndSeqNoResolver { static final ConcurrentMap<IndexReader.CacheKey, CloseableThreadLocal<PerThreadIDVersionAndSeqNoLookup[]>> LOOKUP_STATES = ConcurrentCollections.newConcurrentMapWithAggressiveConcurrency(); // Evict this reader from lookupStates once it's closed: private static fin...
// We cache on the top level // This means cache entries have a shorter lifetime, maybe as low as 1s with the // default refresh interval and a steady indexing rate, but on the other hand it // proved to be cheaper than having to perform a CHM and a TL get for every segment. // ...
1,102
584
1,686
<no_super_class>
crate_crate
crate/server/src/main/java/org/elasticsearch/common/network/IfConfig.java
IfConfig
formatFlags
class IfConfig { private static final Logger LOGGER = LogManager.getLogger(IfConfig.class); private static final String INDENT = " "; /** log interface configuration at debug level, if its enabled */ public static void logIfNecessary() { if (LOGGER.isDebugEnabled()) { try { ...
StringBuilder flags = new StringBuilder(); if (nic.isUp()) { flags.append("UP "); } if (nic.supportsMulticast()) { flags.append("MULTICAST "); } if (nic.isLoopback()) { flags.append("LOOPBACK "); } if (nic.isPointToPoin...
1,079
178
1,257
<no_super_class>
crate_crate
crate/server/src/main/java/org/elasticsearch/common/recycler/NoneRecycler.java
NV
close
class NV<T> implements Recycler.V<T> { T value; NV(T value) { this.value = value; } @Override public T v() { return value; } @Override public boolean isRecycled() { return false; } @Override ...
if (value == null) { throw new IllegalStateException("recycler entry already released..."); } value = null;
112
37
149
<methods><variables>protected final non-sealed C<T> c
crate_crate
crate/server/src/main/java/org/elasticsearch/common/regex/Regex.java
Regex
simpleMatch
class Regex { /** * This Regex / {@link Pattern} flag is supported from Java 7 on. * If set on a Java6 JVM the flag will be ignored. */ public static final int UNICODE_CHARACTER_CLASS = 0x100; // supported in JAVA7 /** * Is the str a simple match pattern. */ public static bool...
if (pattern == null || str == null) { return false; } int firstIndex = pattern.indexOf('*'); if (firstIndex == -1) { return pattern.equals(str); } if (firstIndex == 0) { if (pattern.length() == 1) { return true; ...
1,437
339
1,776
<no_super_class>
crate_crate
crate/server/src/main/java/org/elasticsearch/common/settings/SecureString.java
SecureString
ensureNotClosed
class SecureString implements CharSequence, Closeable { private char[] chars; /** * Constructs a new SecureString which controls the passed in char array. * * Note: When this instance is closed, the array will be zeroed out. */ public SecureString(char[] chars) { this.chars = O...
if (chars == null) { throw new IllegalStateException("SecureString has already been closed"); }
1,013
32
1,045
<no_super_class>