cratetorrent icon indicating copy to clipboard operation
cratetorrent copied to clipboard

Fallback to buffered IO disk operations when not on Linux

Open ExceptionallyHandsome opened this issue 3 years ago • 5 comments

Closes #88

I had to implement read_exact_at/write_all_at, and guess what? There's no cross platform API for read_at/write_at! For good reason: Unix API does not affect "seek cursor", while other's do. I don't think we care since we always specify the offset explicitly, but perhaps it's undesirable? Need your input, but I think we can live with that.

There are couple of code pieces gated under cfg which is quite ugly, but all attempts at factoring these pieces out resulted in pretentious versions of roughly the same code, so I decided this is good enough. Suggestions are welcome.

Overall, this is roughly the "working" version. "Working" because I haven't had a chance to test it. I'll proceed to it in two-three days (busy days, sorry), so this is just me presenting the design for your judgement.

(and a somewhat unrelated question: is TorrentFile really supposed be public? I just see all its methods are pub and have detailed doc comments, but the struct itself is pub(crate))

ExceptionallyHandsome avatar Jan 03 '21 03:01 ExceptionallyHandsome

Just saw this:

is TorrentFile really supposed be public? I just see all its methods are pub and have detailed doc comments, but the struct itself is pub(crate)

It's not! I try to document everything as nicely as possible though, especially more complicated things. As noted above though, no intentions of making the type public.

vimpunk avatar Jan 07 '21 20:01 vimpunk

It's not! I try to document everything as nicely as possible though, especially more complicated things. As noted above though, no intentions of making the type public.

Then do you mind if I make the methods pub(crate) instead of pub? It's kinda confusing.

ExceptionallyHandsome avatar Jan 08 '21 06:01 ExceptionallyHandsome

@ExceptionallyHandsome I thought it was sufficient to make a type's visibility restricted without having to alter its methods' visibility, but I wasn't sure what is actually good practice in this case as I haven't found much online. Do you perhaps know?

Arguably being explicit is better so I don't actually mind.

vimpunk avatar Jan 08 '21 10:01 vimpunk

Hi @ExceptionallyHandsome, how have you been doing?

I've been very busy and haven't had a lot of time to put more thought into this MR. Do you plan to continue it at some point? I plan to recommence developmenet of cratetorrent in the coming weeks, I just have a few more priorities to attend to first.

No rush, and absolutely no problem if you don't want to pick this up. I'm just inquiring, I understand what it's like to be busy after all. :)

vimpunk avatar Apr 13 '21 17:04 vimpunk

Hey everybody, I'm new to this project and noticed that it can't be built on Mac due to the use ofpreadv and pwritev , which doesn't exist for darwin. Is this the intent to fix this issue and if so, is there any chance there will be progress on that matter ?

nikita-fuchs avatar Apr 11 '22 09:04 nikita-fuchs