Skip to content

Commit

Permalink
refactor RecordFileParser to parser package; add an EventStreamFilePa…
Browse files Browse the repository at this point in the history
…rser to parse EventStream file(s); #1
  • Loading branch information
QianSwirlds committed Jul 29, 2019
1 parent 6256187 commit 7856810
Show file tree
Hide file tree
Showing 12 changed files with 1,510 additions and 54 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ Should you wish to enable logging, copy the `log4j2.xml` file from `src/main/res
for example

```shell
java -Dlog4j.configurationFile=./log4j2.xml -cp mirrorNode.jar com.hedera.recordFileParser.RecordFileParser
java -Dlog4j.configurationFile=./log4j2.xml -cp mirrorNode.jar com.hedera.parser.RecordFileParser
```

This will ensure that the `log4j2.xml` file is used to direct logging accordingly.
Expand Down Expand Up @@ -337,7 +337,7 @@ shard,realm,number,balance
Run the following command:

```shell
java -cp mirrorNode.jar com.hedera.recordFileParser.RecordFileParser
java -cp mirrorNode.jar com.hedera.parser.RecordFileParser
```

### To Parse Balance file(s)
Expand Down Expand Up @@ -469,7 +469,7 @@ Contains a `RecordFileDownloader` class which connects to an s3 bucket and downl

Contains a `AccountBalancesDownloader` class which connects to an s3 bucket and downloads account balance files from the bucket.

- com.hedera.recordFileParser
- com.hedera.parser

Contains a `RecordFileParser` class which given a number of record files will process them, it calls the static class below which is responsible for processing the output itself.

Expand Down
13 changes: 13 additions & 0 deletions config/log4j2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@
</Policies>
<DefaultRolloverStrategy max="10"/>
</RollingFile>
<RollingFile name="eventStream-log" fileName="output/eventStream.log"
filePattern="output/eventStream.log-%d{yyyy-MM-dd}-%i.log" >
<PatternLayout>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %-5p %-4L %c{1} - %m%n</pattern>
</PatternLayout>
<Policies>
<SizeBasedTriggeringPolicy size="5 MB" />
</Policies>
<DefaultRolloverStrategy max="10"/>
</RollingFile>
</Appenders>
<Loggers>
<Root level="INFO">
Expand All @@ -22,5 +32,8 @@
<Logger name="recordStream-log" level="INFO">
<AppenderRef ref="recordStream-log" level="INFO"/>
</Logger>
<Logger name="eventStream-log" level="INFO">
<AppenderRef ref="eventStream-log" level="INFO"/>
</Logger>
</Loggers>
</Configuration>
2 changes: 1 addition & 1 deletion docker/RecordsParser
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ ADD ./config/config.json ./config/config.json
# log configuration
ADD ./config/log4j2.xml log4j2.xml

CMD java -Dlog4j.configurationFile=./log4j2.xml -cp mirrorNode.jar com.hedera.recordFileParser.RecordFileParser
CMD java -Dlog4j.configurationFile=./log4j2.xml -cp mirrorNode.jar com.hedera.parser.RecordFileParser

CMD tail -f ./config/config.json
2 changes: 1 addition & 1 deletion docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,4 @@ services:
volumes:
- ./MirrorNodeData:/MirrorNodeData
- ./runtime:/MirrorNodeCode
command: java -Dlog4j.configurationFile=./config/log4j2.xml -cp mirrorNode.jar com.hedera.recordFileParser.RecordFileParser
command: java -Dlog4j.configurationFile=./config/log4j2.xml -cp mirrorNode.jar com.hedera.parser.RecordFileParser
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import com.amazonaws.services.s3.model.S3ObjectSummary;
import com.hedera.configLoader.ConfigLoader;
import com.hedera.mirrorNodeProxy.Utility;
import com.hedera.recordFileParser.RecordFileParser;
import com.hedera.parser.RecordFileParser;
import org.apache.commons.codec.binary.Hex;
import org.apache.commons.lang3.tuple.Pair;

Expand Down
4 changes: 4 additions & 0 deletions src/main/java/com/hedera/mirrorNodeProxy/Utility.java
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,10 @@ public static boolean isRecordFile(String filename) {
return filename.endsWith(".rcd");
}

public static boolean isEventStreamFile(String filename) {
return filename.endsWith(".evts");
}

public static boolean isRecordSigFile(String filename) {
return filename.endsWith(".rcd_sig");
}
Expand Down
Loading

0 comments on commit 7856810

Please sign in to comment.