rename put to putEntries
The method name put is used too often so that eclipse has a hard time finding references.
This commit is contained in:
@@ -189,7 +189,7 @@ public class TcpIngestor implements Ingestor, AutoCloseable, DisposableBean {
|
||||
boolean finished = false;
|
||||
while (!finished) {
|
||||
try {
|
||||
db.put(new BlockingQueueIterator<>(queue, Entry.POISON));
|
||||
db.putEntries(new BlockingQueueIterator<>(queue, Entry.POISON));
|
||||
finished = true;
|
||||
} catch (final Exception e) {
|
||||
LOGGER.warn("Write to database failed. Will retry with the next element.", e);
|
||||
|
||||
@@ -37,21 +37,21 @@ public class PerformanceDb implements AutoCloseable {
|
||||
tagsToFile = new TagsToFile(dataStore);
|
||||
}
|
||||
|
||||
public void put(final Entry entry) throws WriteException {
|
||||
put(Arrays.asList(entry));
|
||||
public void putEntry(final Entry entry) throws WriteException {
|
||||
putEntries(Arrays.asList(entry));
|
||||
}
|
||||
|
||||
public void put(final Iterable<Entry> entries) throws WriteException {
|
||||
put(entries.iterator());
|
||||
public void putEntries(final Iterable<Entry> entries) throws WriteException {
|
||||
putEntries(entries.iterator());
|
||||
}
|
||||
|
||||
public void put(final Iterator<Entry> entries) throws WriteException {
|
||||
public void putEntries(final Iterator<Entry> entries) throws WriteException {
|
||||
|
||||
final BlockingIteratorIterator<Entry> iterator = new BlockingIteratorIterator<>(entries);
|
||||
put(iterator);
|
||||
putEntries(iterator);
|
||||
}
|
||||
|
||||
public void put(final BlockingIterator<Entry> entries) throws WriteException {
|
||||
public void putEntries(final BlockingIterator<Entry> entries) throws WriteException {
|
||||
|
||||
final Duration timeBetweenSyncs = Duration.ofSeconds(10);
|
||||
long count = 0;
|
||||
|
||||
@@ -44,7 +44,7 @@ public class PerformanceDbTest {
|
||||
final OffsetDateTime date = DateUtils.nowInUtc();
|
||||
final long value = 1;
|
||||
final Tags tags = Tags.create("myKey", "myValue");
|
||||
db.put(new Entry(date, value, tags));
|
||||
db.putEntry(new Entry(date, value, tags));
|
||||
|
||||
final Result result = db.get(Query.createQuery(tags));
|
||||
final LongList stream = result.singleGroup().flatMap();
|
||||
@@ -65,8 +65,8 @@ public class PerformanceDbTest {
|
||||
final long valueTwo = 2;
|
||||
final Tags tags = Tags.create("myKey", "myValue");
|
||||
|
||||
db.put(new Entry(dayOne, valueOne, tags));
|
||||
db.put(new Entry(dayTwo, valueTwo, tags));
|
||||
db.putEntry(new Entry(dayOne, valueOne, tags));
|
||||
db.putEntry(new Entry(dayTwo, valueTwo, tags));
|
||||
|
||||
final LongList stream = db.get(Query.createQuery(tags)).singleGroup().flatMap();
|
||||
|
||||
@@ -120,9 +120,7 @@ public class PerformanceDbTest {
|
||||
|
||||
printEntries(entries, "");
|
||||
|
||||
for (final Entry entry : entries) {
|
||||
db.put(entry);
|
||||
}
|
||||
db.putEntries(entries);
|
||||
|
||||
final LongList actualEntries = db.get(Query.createQuery(tags)).singleGroup().flatMap();
|
||||
Assert.assertEquals(actualEntries.size(), entries.size() * 2);
|
||||
@@ -162,7 +160,7 @@ public class PerformanceDbTest {
|
||||
final TimeRange timeRange = TimeRange.ofDay(DateUtils.getDate(year, month, day, 1, 1, 1));
|
||||
|
||||
final List<Entry> entries = generateEntries(timeRange, numberOfEntries, 0, tags);
|
||||
db.put(entries);
|
||||
db.putEntries(entries);
|
||||
expected.addAll(entries);
|
||||
}
|
||||
|
||||
@@ -174,7 +172,7 @@ public class PerformanceDbTest {
|
||||
final TimeRange timeRange = TimeRange.ofDay(DateUtils.getDate(year, month, day, 1, 1, 1));
|
||||
|
||||
final List<Entry> entries = generateEntries(timeRange, numberOfEntries, 0, tags);
|
||||
db.put(entries);
|
||||
db.putEntries(entries);
|
||||
expected.addAll(entries);
|
||||
|
||||
final LongList actualEntries = db.get(Query.createQuery(tags)).singleGroup().flatMap();
|
||||
@@ -196,18 +194,18 @@ public class PerformanceDbTest {
|
||||
final Tags tagsCommon = Tags.create("commonKey", "commonValue");
|
||||
final Tags tagsOne = Tags.create("myKey", "one", "commonKey", "commonValue");
|
||||
final List<Entry> entriesOne = generateEntries(timeRange, numberOfEntries, 1, tagsOne);
|
||||
db.put(entriesOne);
|
||||
db.putEntries(entriesOne);
|
||||
printEntries(entriesOne, "one");
|
||||
|
||||
final Tags tagsTwo = Tags.create("myKey", "two", "commonKey", "commonValue");
|
||||
final List<Entry> entriesTwo = generateEntries(timeRange, numberOfEntries, 2, tagsTwo);
|
||||
printEntries(entriesTwo, "two");
|
||||
db.put(entriesTwo);
|
||||
db.putEntries(entriesTwo);
|
||||
|
||||
final Tags tagsThree = Tags.create("myKey", "three", "commonKey", "commonValue");
|
||||
final List<Entry> entriesThree = generateEntries(timeRange, numberOfEntries, 3, tagsThree);
|
||||
printEntries(entriesThree, "three");
|
||||
db.put(entriesThree);
|
||||
db.putEntries(entriesThree);
|
||||
|
||||
final LongList actualEntriesOne = db.get(Query.createQuery(tagsOne)).singleGroup().flatMap();
|
||||
Assert.assertEquals(actualEntriesOne, toExpectedValues(entriesOne));
|
||||
@@ -319,7 +317,7 @@ public class PerformanceDbTest {
|
||||
private LongList storeEntries(final PerformanceDb performanceDb, final TimeRange timeRange,
|
||||
final long numberOfEntries, final Tags tags, final int addToDate) {
|
||||
final List<Entry> entries = generateEntries(timeRange, numberOfEntries, addToDate, tags);
|
||||
performanceDb.put(entries);
|
||||
performanceDb.putEntries(entries);
|
||||
|
||||
final LongList result = new LongList();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user