Addendum to YARN-3863. Deleted files that were added incorrectly.
This commit is contained in:
parent
c2efdc415a
commit
fba7532c56
@ -1,62 +0,0 @@
|
|||||||
/**
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.apache.hadoop.yarn.server.timelineservice.reader.filter;
|
|
||||||
|
|
||||||
import org.apache.hadoop.classification.InterfaceAudience.Private;
|
|
||||||
import org.apache.hadoop.classification.InterfaceStability.Unstable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Filter class which represents filter to be applied based on existence of a
|
|
||||||
* value.
|
|
||||||
*/
|
|
||||||
@Private
|
|
||||||
@Unstable
|
|
||||||
public class TimelineExistsFilter extends TimelineFilter {
|
|
||||||
|
|
||||||
private final TimelineCompareOp compareOp;
|
|
||||||
private final String value;
|
|
||||||
|
|
||||||
public TimelineExistsFilter(TimelineCompareOp op, String value) {
|
|
||||||
this.value = value;
|
|
||||||
if (op != TimelineCompareOp.EQUAL && op != TimelineCompareOp.NOT_EQUAL) {
|
|
||||||
throw new IllegalArgumentException("CompareOp for exists filter should " +
|
|
||||||
"be EQUAL or NOT_EQUAL");
|
|
||||||
}
|
|
||||||
this.compareOp = op;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TimelineFilterType getFilterType() {
|
|
||||||
return TimelineFilterType.EXISTS;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getValue() {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TimelineCompareOp getCompareOp() {
|
|
||||||
return compareOp;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return String.format("%s (%s %s)",
|
|
||||||
this.getClass().getSimpleName(), this.compareOp.name(), this.value);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,48 +0,0 @@
|
|||||||
/**
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.apache.hadoop.yarn.server.timelineservice.reader.filter;
|
|
||||||
|
|
||||||
import org.apache.hadoop.classification.InterfaceAudience.Private;
|
|
||||||
import org.apache.hadoop.classification.InterfaceStability.Unstable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Filter class which represents filter to be applied based on key-value pair
|
|
||||||
* being equal or not to the values in back-end store.
|
|
||||||
*/
|
|
||||||
@Private
|
|
||||||
@Unstable
|
|
||||||
public class TimelineKeyValueFilter extends TimelineCompareFilter {
|
|
||||||
public TimelineKeyValueFilter(TimelineCompareOp op, String key, Object val,
|
|
||||||
boolean keyMustExistFlag) {
|
|
||||||
super(op, key, val, keyMustExistFlag);
|
|
||||||
if (op != TimelineCompareOp.EQUAL && op != TimelineCompareOp.NOT_EQUAL) {
|
|
||||||
throw new IllegalArgumentException("TimelineCompareOp for equality"
|
|
||||||
+ " filter should be EQUAL or NOT_EQUAL");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public TimelineKeyValueFilter(TimelineCompareOp op, String key, Object val) {
|
|
||||||
this(op, key, val, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TimelineFilterType getFilterType() {
|
|
||||||
return TimelineFilterType.KEY_VALUE;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,71 +0,0 @@
|
|||||||
/**
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.apache.hadoop.yarn.server.timelineservice.reader.filter;
|
|
||||||
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.apache.hadoop.classification.InterfaceAudience.Private;
|
|
||||||
import org.apache.hadoop.classification.InterfaceStability.Unstable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Filter class which represents filter to be applied based on multiple values
|
|
||||||
* for a key and these values being equal or not equal to values in back-end
|
|
||||||
* store.
|
|
||||||
*/
|
|
||||||
@Private
|
|
||||||
@Unstable
|
|
||||||
public class TimelineKeyValuesFilter extends TimelineFilter {
|
|
||||||
private final TimelineCompareOp compareOp;
|
|
||||||
private final String key;
|
|
||||||
private final Set<Object> values;
|
|
||||||
public TimelineKeyValuesFilter(TimelineCompareOp op, String key,
|
|
||||||
Set<Object> values) {
|
|
||||||
if (op != TimelineCompareOp.EQUAL && op != TimelineCompareOp.NOT_EQUAL) {
|
|
||||||
throw new IllegalArgumentException("TimelineCompareOp for multi value "
|
|
||||||
+ "equality filter should be EQUAL or NOT_EQUAL");
|
|
||||||
}
|
|
||||||
this.compareOp = op;
|
|
||||||
this.key = key;
|
|
||||||
this.values = values;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TimelineFilterType getFilterType() {
|
|
||||||
return TimelineFilterType.KEY_VALUES;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getKey() {
|
|
||||||
return key;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Set<Object> getValues() {
|
|
||||||
return values;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TimelineCompareOp getCompareOp() {
|
|
||||||
return compareOp;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return String.format("%s (%s, %s:%s)",
|
|
||||||
this.getClass().getSimpleName(), this.compareOp.name(),
|
|
||||||
this.key, (values == null) ? "" : values.toString());
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,71 +0,0 @@
|
|||||||
/**
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.apache.hadoop.yarn.server.timelineservice.storage.common;
|
|
||||||
|
|
||||||
import org.apache.hadoop.yarn.server.timelineservice.reader.filter.TimelineFilter.TimelineFilterType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Used to define which filter to match.
|
|
||||||
*/
|
|
||||||
enum TimelineEntityFiltersType {
|
|
||||||
CONFIG {
|
|
||||||
boolean isValidFilter(TimelineFilterType filterType) {
|
|
||||||
return filterType == TimelineFilterType.LIST ||
|
|
||||||
filterType == TimelineFilterType.KEY_VALUE;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
INFO {
|
|
||||||
boolean isValidFilter(TimelineFilterType filterType) {
|
|
||||||
return filterType == TimelineFilterType.LIST ||
|
|
||||||
filterType == TimelineFilterType.KEY_VALUE;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
METRIC {
|
|
||||||
boolean isValidFilter(TimelineFilterType filterType) {
|
|
||||||
return filterType == TimelineFilterType.LIST ||
|
|
||||||
filterType == TimelineFilterType.COMPARE;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
EVENT {
|
|
||||||
boolean isValidFilter(TimelineFilterType filterType) {
|
|
||||||
return filterType == TimelineFilterType.LIST ||
|
|
||||||
filterType == TimelineFilterType.EXISTS;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
IS_RELATED_TO {
|
|
||||||
boolean isValidFilter(TimelineFilterType filterType) {
|
|
||||||
return filterType == TimelineFilterType.LIST ||
|
|
||||||
filterType == TimelineFilterType.KEY_VALUES;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
RELATES_TO {
|
|
||||||
boolean isValidFilter(TimelineFilterType filterType) {
|
|
||||||
return filterType == TimelineFilterType.LIST ||
|
|
||||||
filterType == TimelineFilterType.KEY_VALUES;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks whether filter type is valid for the filter being matched.
|
|
||||||
*
|
|
||||||
* @param filterType filter type.
|
|
||||||
* @return true, if its a valid filter, false otherwise.
|
|
||||||
*/
|
|
||||||
abstract boolean isValidFilter(TimelineFilterType filterType);
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user