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:
2018-10-11 19:25:01 +02:00
parent 979e001efd
commit eaa234bfa5
3 changed files with 18 additions and 20 deletions

View File

@@ -189,7 +189,7 @@ public class TcpIngestor implements Ingestor, AutoCloseable, DisposableBean {
boolean finished = false; boolean finished = false;
while (!finished) { while (!finished) {
try { try {
db.put(new BlockingQueueIterator<>(queue, Entry.POISON)); db.putEntries(new BlockingQueueIterator<>(queue, Entry.POISON));
finished = true; finished = true;
} catch (final Exception e) { } catch (final Exception e) {
LOGGER.warn("Write to database failed. Will retry with the next element.", e); LOGGER.warn("Write to database failed. Will retry with the next element.", e);

View File

@@ -37,21 +37,21 @@ public class PerformanceDb implements AutoCloseable {
tagsToFile = new TagsToFile(dataStore); tagsToFile = new TagsToFile(dataStore);
} }
public void put(final Entry entry) throws WriteException { public void putEntry(final Entry entry) throws WriteException {
put(Arrays.asList(entry)); putEntries(Arrays.asList(entry));
} }
public void put(final Iterable<Entry> entries) throws WriteException { public void putEntries(final Iterable<Entry> entries) throws WriteException {
put(entries.iterator()); 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); 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); final Duration timeBetweenSyncs = Duration.ofSeconds(10);
long count = 0; long count = 0;

View File

@@ -44,7 +44,7 @@ public class PerformanceDbTest {
final OffsetDateTime date = DateUtils.nowInUtc(); final OffsetDateTime date = DateUtils.nowInUtc();
final long value = 1; final long value = 1;
final Tags tags = Tags.create("myKey", "myValue"); 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 Result result = db.get(Query.createQuery(tags));
final LongList stream = result.singleGroup().flatMap(); final LongList stream = result.singleGroup().flatMap();
@@ -65,8 +65,8 @@ public class PerformanceDbTest {
final long valueTwo = 2; final long valueTwo = 2;
final Tags tags = Tags.create("myKey", "myValue"); final Tags tags = Tags.create("myKey", "myValue");
db.put(new Entry(dayOne, valueOne, tags)); db.putEntry(new Entry(dayOne, valueOne, tags));
db.put(new Entry(dayTwo, valueTwo, tags)); db.putEntry(new Entry(dayTwo, valueTwo, tags));
final LongList stream = db.get(Query.createQuery(tags)).singleGroup().flatMap(); final LongList stream = db.get(Query.createQuery(tags)).singleGroup().flatMap();
@@ -120,9 +120,7 @@ public class PerformanceDbTest {
printEntries(entries, ""); printEntries(entries, "");
for (final Entry entry : entries) { db.putEntries(entries);
db.put(entry);
}
final LongList actualEntries = db.get(Query.createQuery(tags)).singleGroup().flatMap(); final LongList actualEntries = db.get(Query.createQuery(tags)).singleGroup().flatMap();
Assert.assertEquals(actualEntries.size(), entries.size() * 2); 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 TimeRange timeRange = TimeRange.ofDay(DateUtils.getDate(year, month, day, 1, 1, 1));
final List<Entry> entries = generateEntries(timeRange, numberOfEntries, 0, tags); final List<Entry> entries = generateEntries(timeRange, numberOfEntries, 0, tags);
db.put(entries); db.putEntries(entries);
expected.addAll(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 TimeRange timeRange = TimeRange.ofDay(DateUtils.getDate(year, month, day, 1, 1, 1));
final List<Entry> entries = generateEntries(timeRange, numberOfEntries, 0, tags); final List<Entry> entries = generateEntries(timeRange, numberOfEntries, 0, tags);
db.put(entries); db.putEntries(entries);
expected.addAll(entries); expected.addAll(entries);
final LongList actualEntries = db.get(Query.createQuery(tags)).singleGroup().flatMap(); 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 tagsCommon = Tags.create("commonKey", "commonValue");
final Tags tagsOne = Tags.create("myKey", "one", "commonKey", "commonValue"); final Tags tagsOne = Tags.create("myKey", "one", "commonKey", "commonValue");
final List<Entry> entriesOne = generateEntries(timeRange, numberOfEntries, 1, tagsOne); final List<Entry> entriesOne = generateEntries(timeRange, numberOfEntries, 1, tagsOne);
db.put(entriesOne); db.putEntries(entriesOne);
printEntries(entriesOne, "one"); printEntries(entriesOne, "one");
final Tags tagsTwo = Tags.create("myKey", "two", "commonKey", "commonValue"); final Tags tagsTwo = Tags.create("myKey", "two", "commonKey", "commonValue");
final List<Entry> entriesTwo = generateEntries(timeRange, numberOfEntries, 2, tagsTwo); final List<Entry> entriesTwo = generateEntries(timeRange, numberOfEntries, 2, tagsTwo);
printEntries(entriesTwo, "two"); printEntries(entriesTwo, "two");
db.put(entriesTwo); db.putEntries(entriesTwo);
final Tags tagsThree = Tags.create("myKey", "three", "commonKey", "commonValue"); final Tags tagsThree = Tags.create("myKey", "three", "commonKey", "commonValue");
final List<Entry> entriesThree = generateEntries(timeRange, numberOfEntries, 3, tagsThree); final List<Entry> entriesThree = generateEntries(timeRange, numberOfEntries, 3, tagsThree);
printEntries(entriesThree, "three"); printEntries(entriesThree, "three");
db.put(entriesThree); db.putEntries(entriesThree);
final LongList actualEntriesOne = db.get(Query.createQuery(tagsOne)).singleGroup().flatMap(); final LongList actualEntriesOne = db.get(Query.createQuery(tagsOne)).singleGroup().flatMap();
Assert.assertEquals(actualEntriesOne, toExpectedValues(entriesOne)); Assert.assertEquals(actualEntriesOne, toExpectedValues(entriesOne));
@@ -319,7 +317,7 @@ public class PerformanceDbTest {
private LongList storeEntries(final PerformanceDb performanceDb, final TimeRange timeRange, private LongList storeEntries(final PerformanceDb performanceDb, final TimeRange timeRange,
final long numberOfEntries, final Tags tags, final int addToDate) { final long numberOfEntries, final Tags tags, final int addToDate) {
final List<Entry> entries = generateEntries(timeRange, numberOfEntries, addToDate, tags); final List<Entry> entries = generateEntries(timeRange, numberOfEntries, addToDate, tags);
performanceDb.put(entries); performanceDb.putEntries(entries);
final LongList result = new LongList(); final LongList result = new LongList();