Aut: Refactor RecordLoader classes

Created on 25 Oct 2017  路  13Comments  路  Source: archivesunleashed/aut

We have a number of classes called from RecordLoader that have ArchiveRecord as a parent. We should refactor the RecordLoader object to use one class -- ArchiveRecord -- that detects records that are warc or arc.

(The commit adding the Generic class is https://github.com/archivesunleashed/aut/commit/77891e7d54ad1527dcddaa434120c916da661f65 )
I think Jeremy did us very well here -- just needed a moment to consider refactoring.

enhancement

Most helpful comment

@MapleOx clean up the Scala end, but let's leave the Java stuff alone. InputFormats and Writables are independently useful for connecting to other systems...

Please send a PR.

All 13 comments

Currently, is there any reason someone would want to use loadArc or loadWarc instead of loadArchives? If not, I think we can consider getting rid of loadArc and loadWarc too.

Probably not.

Agreed, I think we have totally moved over to loadArchives.

Yep, I think they're good to go 鈥撀燼nd I don't think they're called by anything else so should be an easy removal?

I took a look at the Scala and Java classes, and if we're going to always work with generic archive records, I think we can refactor as follows:

  • In the Scala code:

    1. Remove the trait ArchiveRecord and classes ArcRecord and WarcRecord;

    2. Rename GenericArchiveRecord to ArchiveRecord.

  • In the Java code:

    1. Under java.io.archivesunleashed.io, remove the classes ArcRecordWritable and WarcRecordWritable;

    2. Under java.io.archivesunleashed.mapreduce, remove the classes WacArcInputFormat and WacWarcInputFormat.

After possibly straightening up import statements and tests that use the aforementioned classes, I think this should work... Also, this might address the test issues in #106?

@MapleOx yeah, that makes sense. As I'm digging deeper into cleaning up #106, I'm now down the rabbit hole of GenericArchiveRecord and ArchiveRecord. Definitely wasn't as simple as I thought it was last night :smile:

@MapleOx clean up the Scala end, but let's leave the Java stuff alone. InputFormats and Writables are independently useful for connecting to other systems...

Please send a PR.

@MapleOx do you want me to push up what I have right now in another branch? In the interim I'll close #106.

@ruebot sure, thanks :) I have to head out soon, but I'll get a PR submitted this afternoon.

@MapleOx yeah, I'm about to head out now as well. I'll push to issue-102-b. It's broken, but I've made progress. If it's too much of a mess, feel free to do your own thing and don't worry about what I've done.

@ruebot I can take a look at RecordRDDTest on Monday. I had a feeling tests would start breaking once I got into it as well. All this because of #101 ! In the end, this will be very good though. Simplify the codebase.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

SamFritz picture SamFritz  路  4Comments

ruebot picture ruebot  路  6Comments

jrwiebe picture jrwiebe  路  9Comments

ruebot picture ruebot  路  4Comments

lintool picture lintool  路  8Comments