Giter Club home page Giter Club logo

Comments (8)

whyrusleeping avatar whyrusleeping commented on May 17, 2024 28

from badger.

whyrusleeping avatar whyrusleeping commented on May 17, 2024 8

from badger.

awfm9 avatar awfm9 commented on May 17, 2024 8

It does not make sense to panic in the library. When saying it has to be a fatal error, you are ignoring that the consuming application might be doing a whole host of other things unrelated to writing to a K/V store. Bubbling up the errors to the user of the API and letting him decide what to do about it is definitely the way to go.

from badger.

barakmich avatar barakmich commented on May 17, 2024

Same also with NewKV and Close -- io.Closer is idiomatic, please follow it.

from badger.

manishrjain avatar manishrjain commented on May 17, 2024

@whyrusleeping : The rationale that some of these operations return no error is that unless we are unable to write to disk, there's no reason for the Set to fail (in which case it would log.Fatal, because there's not much you could do if you can't write to disk). It's a blind write. The only operations which can fail are CAS ops, which check the previous state.

Though, I see the point that given this is a library, that choice of log.Fatal isn't one we should make. @ashwin95r is working to send disk errors back (and not log.Fatal).

from badger.

whyrusleeping avatar whyrusleeping commented on May 17, 2024

Yeah, definitely don't want to be doing log.Fatals in lower layers of the app. Let us know when you've got that wired up through, i'm really excited to work with badger :)

from badger.

manishrjain avatar manishrjain commented on May 17, 2024

@ashwin95r and I looked at the code again. Even if we change Set to return an error back, there's nothing much a user can do about it, because this relates to a file system failure. One can't just change the directory Badger is pointing to; because it would then stop working.

Similarly, Get can only fail if we're unable to read stuff off disk (which would cause lot more issues than just a request failure, because LSM trees do lot of things in the background). All of these are permanent failures; so I see little benefit in returning these to the user.

We could add io.Closer interface, if that's of any value. It would just return nil.

from badger.

manishrjain avatar manishrjain commented on May 17, 2024

This is a duplicate of #23, which I just addressed. Have another look at the public APIs, and feel free to reopen if I missed some API, or you expect to see something more.

from badger.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.