sbtourist / Journal.IO

Journal.IO is a zero-dependency, fast and easy-to-use journal storage implementation.
Apache License 2.0
260 stars 39 forks source link

Improve configuration (and related errors) management #22

Closed jeluard closed 11 years ago

jeluard commented 11 years ago

Currently it's not always easy to distinguish between what must be set on a Journal from what is optional. Also the Journal lifecycle is not enforced and calling read/write before open leads to error that might be hard to diagnose if a library does not own the Journal creation.

I am considering working on a light builder implementation to generate a fully configured Journal.

Would that make sense to integrate that in the main codebase?

sbtourist commented 11 years ago

Absolutely, I agree journal creation is pretty ugly right now. A pull request would be great :)

jeluard commented 11 years ago

I have some first drat for this here. Let me know what you think!

sbtourist commented 11 years ago

Sorry for the late late reply :(

I'm not sure about the need to extend Journal: what about a "JournalBuilder" that just builds and opens/returns a Journal?

jeluard commented 11 years ago

Sure. I extended Journal as a way to embed the builder class in the Journal (but in Journal.IO it would be in Journal itself). Having the builder external to the Journal seems very fine too.

sbtourist commented 11 years ago

Cool, do you maybe have some time to make such changes?

jeluard commented 11 years ago

Now the builder is in a dedicated JournalBuilder class. I didn't change the visibility of Journal constructor for backward compatibility but it would probably be cleaner to change it to private at some point.

sbtourist commented 11 years ago

Great, I'll have a look!