Skip to content

More tests, add filename to Torrent, fast Database#include? method #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Oct 19, 2015

Conversation

winterthediplomat
Copy link
Contributor

I'm sorry I did not make separated Pull Requests, but I got carried out and pushed too much.

  • more tests
    This PR adds some tests (and travis-ci support!) to yamazaki libraries.
  • add filename to Torrent class
    This modification is needed for some modifications in Miyuki, but it may be useful for several clients who just want to know where are the downloaded torrents.
  • fast Database#include? method
    Track databases will only grow larger and larger, even though the rate is low. It should be noted that clients will perform more searches than insertions, so a faster #include is key to a faster Yamazaki. Yes, 56x faster.
    Unfortunately, the modification requires Array#bsearch, which is available only on ruby 2.x. Let me know if you think it has to be compatible with 1.9.x rubies (still shipped by LTS linux distros), we can get around it.

@RoxasShadow
Copy link
Contributor

I suggest so squash something if you can and eventually fix ruby1.9.3 does not have Array#bsearch that's not actually written in the git-way.

@@ -0,0 +1,5 @@
nguage: ruby
Copy link
Contributor

Choose a reason for hiding this comment

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

is that a typo?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes.

@RoxasShadow
Copy link
Contributor

For me now we're ok 👍 @hydride0?

@winterthediplomat
Copy link
Contributor Author

Please wait until a patch for this issue is added (test has to be un-skipped and code modified to guarantee uniqueness)

@winterthediplomat
Copy link
Contributor Author

Ok, fixed the filename non-uniqueness. Ok for me too.

@RoxasShadow
Copy link
Contributor

Good, can you also squash something too? There a lots of commits there. Then let's wait for @hydride0.

Torrent.filename: it'll contain the path a torrent was downloaded to.

Add tests: Yamazaki now has more tests, covering the usual behaviour
of the library. A travis.yml has been added too.

`Database#size` returns the number of saved items inside the database.
Switching to Array#bsearch (with database sorting)
makes yamazaki a lot faster (25-56x)
ruby1.9.3 is removed because `Array#bsearch`
is not supported from <2.x ruby releases
Roxas noticed a lot of imperfections and little problems,
they're fixed now.
Filenames should be considered unique in the database,
so duplicates are not allowed. If duplicates are present in
the source file, they won't be deleted after the JSON load
(and it would be very, very time consuming to do this, unless
we switch to hashtables).
Fake database files were created under `/tmp`, and
it may break compatibility with non-posix platform.
Moreover they were not deleted, leaving a lot of random
files around: now they are.
@winterthediplomat
Copy link
Contributor Author

squashed and forced things, is it ok for you @RoxasShadow ?

@RoxasShadow
Copy link
Contributor

👍

hydride0 added a commit that referenced this pull request Oct 19, 2015
More tests, add `filename` to Torrent, fast Database#include? method
@hydride0 hydride0 merged commit 3b84f9f into hydride0:master Oct 19, 2015
@winterthediplomat
Copy link
Contributor Author

\o/

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.

3 participants