Coder Social home page Coder Social logo

Comments (5)

bitemyapp avatar bitemyapp commented on June 30, 2024

Your design for Version sounds good to me.

I agree IndexDocumentSettings rather than a separate function is probably the way to go.

For handling conflicts, we're talking about either a proper error or exception. Documentation on how to catch it is probably sufficient. Is it worth trying to parse out the new version number or is it mostly not going to matter and they just need to know it failed and to see the error body?

from bloodhound.

MichaelXavier avatar MichaelXavier commented on June 30, 2024

So I decided to actually try this out while writing tests for my change and I'm pretty sure ES is just putting some Java exception through a serializer. It would be awesome if we could parse out the exact version and stuff, but it looks like doing so would require us to parse an Error message which makes my skin crawl. For reference, here's the reply:

Response {responseStatus = Status {statusCode = 409, statusMessage = "Conflict"}, responseVersion = HTTP/1.1, responseHeaders = [("Content-Type","application/json; charset=UTF-8"),("Content-Length","144")], responseBody = "{\"error\":\"VersionConflictEngineException[[bloodhound-tests-twitter-1][2] [tweet][1]: version conflict, current [1], provided [1]]\",\"status\":409}", responseCookieJar = CJ {expose = []}, responseClose' = ResponseClose}

What would be a nice compromise though is I could look through the API conventions documentation and provide to start with:

isVersionConflict :: Reply -> Bool
isVersionConflict = (== 409) . statusCode . responseStatus

With more to come later.

from bloodhound.

MichaelXavier avatar MichaelXavier commented on June 30, 2024

Pushed a commit that implements this. Added a simple test case that writes a value with a version control strategy that requires the value to increment, fails to increment it and asserts that the index is rejected with a version conflict. Have a look and let me know what you think.

from bloodhound.

bitemyapp avatar bitemyapp commented on June 30, 2024

@MichaelXavier other than my comment about the query appending, your commit looks good to me. Good tests, thank you! 👍

from bloodhound.

bitemyapp avatar bitemyapp commented on June 30, 2024

I believe this is resolved and generally available now. Thank you @MichaelXavier ! 🐻 👍

from bloodhound.

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.