Skip to content

make ArchiveRecord a trait#186

Merged
ruebot merged 2 commits intoarchivesunleashed:masterfrom
helgeho:master
Apr 6, 2018
Merged

make ArchiveRecord a trait#186
ruebot merged 2 commits intoarchivesunleashed:masterfrom
helgeho:master

Conversation

@helgeho
Copy link
Contributor

@helgeho helgeho commented Mar 27, 2018

GitHub issue(s):

What does this Pull Request do?

This commit introduces a trait that describes the interface of an ArchiveRecord in AUT. This allows for alternative implementations of this core record type in AUT, such as the one provided by ArchiveSpark-AUT-bridge. The original AUT implementation of ArchiveRecord, which is instantiated by AUT's RecordLoader, is moved to the ArchiveRecordImpl class.

This was already done before by #175 and reverted by #181 because the change of moving ISO8601 into a static object caused some issues with certain collections (see below). Therefore, this time, ISO8601 remains part of ArchiveRecordImpl.

How should this be tested?

As this is a pure refactoring without changing any logic, a simple compilation + smoke test should be sufficient. However, as it turns out, the little additional change of moving ISO8601 into a static object in the first attempt of this change (#175) caused strange behaviors with some collections (probably when running on multiple cores per executor, since SimpleDateFormat is not thread-safe as pointed out by @anjackson, see #181). Hence, it should be better tested with different kinds of collections to make sure there are no unexpected side effects involved.

Additional Notes:

The first attempt to make ArchiveRecord a trait (#175) was reverted by #181. This time nothing else is changed except for the trait (ISO8601 remains part of ArchiveRecordImpl). @ruebot and @ianmilligan1 please test it as you did last time (#181), I hope it is not causing problems this time.

@ianmilligan1
Copy link
Member

Thanks @helgeho - I should be able to kick the tires on this later this week (or early next in worst case - it's a tough time of term).

@ruebot ruebot requested a review from lintool March 27, 2018 14:12
@codecov
Copy link

codecov bot commented Mar 27, 2018

Codecov Report

Merging #186 into master will increase coverage by 0.1%.
The diff coverage is 82.05%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master     #186     +/-   ##
=========================================
+ Coverage   67.24%   67.34%   +0.1%     
=========================================
  Files          32       32             
  Lines         635      637      +2     
  Branches      124      124             
=========================================
+ Hits          427      429      +2     
  Misses        167      167             
  Partials       41       41
Impacted Files Coverage Δ
src/main/scala/io/archivesunleashed/package.scala 71.66% <100%> (ø) ⬆️
...scala/io/archivesunleashed/ArchiveRecordImpl.scala 81.57% <81.57%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c5f07c6...42f56ca. Read the comment docs.

val getDomain: String = ExtractDomain(getUrl)

val getImageBytes: Array[Byte] = {
if (getContentString.startsWith("HTTP/"))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for consistency, add braces also?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't change anything there, that's exactly your current https://github.com/archivesunleashed/aut/blob/master/src/main/scala/io/archivesunleashed/spark/archive/io/ArchiveRecord.scala , I only wanted to add the trait, not make your code more / less consistent, because I do not know how your policy is in terms of coding styles (personally though, I also prefer no braces for one-liners)

@ruebot ruebot merged commit 3163ace into archivesunleashed:master Apr 6, 2018
@helgeho
Copy link
Contributor Author

helgeho commented Apr 9, 2018

https://github.com/helgeho/ArchiveSpark-AUT-bridge is also updated now, please check it out, give it a try!

@lintool
Copy link
Member

lintool commented Apr 9, 2018

Neat! Although you'll want to change your documentation to reflect the new package structure.

@helgeho
Copy link
Contributor Author

helgeho commented Apr 9, 2018

oh, that's right, thanks for the heads up, I'll do that soon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants