forked from opensearch-project/OpenSearch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIngestionSource.java
128 lines (109 loc) · 3.57 KB
/
IngestionSource.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/
package org.opensearch.cluster.metadata;
import org.opensearch.common.annotation.ExperimentalApi;
import org.opensearch.indices.pollingingest.IngestionErrorStrategy;
import org.opensearch.indices.pollingingest.StreamPoller;
import java.util.Map;
import java.util.Objects;
/**
* Class encapsulating the configuration of an ingestion source.
*/
@ExperimentalApi
public class IngestionSource {
private String type;
private PointerInitReset pointerInitReset;
private IngestionErrorStrategy.ErrorStrategy errorStrategy;
private Map<String, Object> params;
public IngestionSource(
String type,
PointerInitReset pointerInitReset,
IngestionErrorStrategy.ErrorStrategy errorStrategy,
Map<String, Object> params
) {
this.type = type;
this.pointerInitReset = pointerInitReset;
this.params = params;
this.errorStrategy = errorStrategy;
}
public String getType() {
return type;
}
public PointerInitReset getPointerInitReset() {
return pointerInitReset;
}
public IngestionErrorStrategy.ErrorStrategy getErrorStrategy() {
return errorStrategy;
}
public Map<String, Object> params() {
return params;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
IngestionSource ingestionSource = (IngestionSource) o;
return Objects.equals(type, ingestionSource.type)
&& Objects.equals(pointerInitReset, ingestionSource.pointerInitReset)
&& Objects.equals(errorStrategy, ingestionSource.errorStrategy)
&& Objects.equals(params, ingestionSource.params);
}
@Override
public int hashCode() {
return Objects.hash(type, pointerInitReset, params, errorStrategy);
}
@Override
public String toString() {
return "IngestionSource{"
+ "type='"
+ type
+ '\''
+ ",pointer_init_reset='"
+ pointerInitReset
+ '\''
+ ",error_strategy='"
+ errorStrategy
+ '\''
+ ", params="
+ params
+ '}';
}
/**
* Class encapsulating the configuration of a pointer initialization.
*/
@ExperimentalApi
public static class PointerInitReset {
private final StreamPoller.ResetState type;
private final String value;
public PointerInitReset(StreamPoller.ResetState type, String value) {
this.type = type;
this.value = value;
}
public StreamPoller.ResetState getType() {
return type;
}
public String getValue() {
return value;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
PointerInitReset pointerInitReset = (PointerInitReset) o;
return Objects.equals(type, pointerInitReset.type) && Objects.equals(value, pointerInitReset.value);
}
@Override
public int hashCode() {
return Objects.hash(type, value);
}
@Override
public String toString() {
return "PointerInitReset{" + "type='" + type + '\'' + ", value=" + value + '}';
}
}
}