Coder Social home page Coder Social logo

Is Hive surpport transaction? about hive HOT 10 CLOSED

isar avatar isar commented on July 21, 2024
Is Hive surpport transaction?

from hive.

Comments (10)

simc avatar simc commented on July 21, 2024 5

The feature of transaction seems useful in such a case.

I agree. It's still on my radar...

from hive.

simc avatar simc commented on July 21, 2024 3

@benoitverstraete

I do but it is not high on the priority list. The next update will improve performance and introduce HiveObjects, ListView and MapView. The update after that will contain queries. Then I plan to look at transactions...

from hive.

leedstyh avatar leedstyh commented on July 21, 2024 1

Thanks @leisim

from hive.

simc avatar simc commented on July 21, 2024

Not currently. What would you need transactions for?

If you want to write multiple entries with a single disk access, you can use putAll().

from hive.

leedstyh avatar leedstyh commented on July 21, 2024

If putAll() fails, are all the kv pairs not written?

from hive.

simc avatar simc commented on July 21, 2024

Yes exactly

from hive.

benoitverstraete avatar benoitverstraete commented on July 21, 2024

Hi @leisim ,

Do you plan to implement a "transaction" on multiples boxes ? I would like to save a complete set of data, or nothing.

Here is an example for an invoice and its lines/products :

Hive.transaction((transaction) {
   transaction.add(Hive.box('invoices').add(invoiceId, invoice));
   transaction.add(Hive.box('lines').add(lineId, line));

   // commit
   // rollback in case of error
});

from hive.

kaboc avatar kaboc commented on July 21, 2024

What if you need to do both put() and delete() in a single transaction?

e.g. ToDo app

  • categoryA
    • task1
    • task2
  • categoryB
    • task3

If you want to delete categoryB at the same time as task3 is moved to categoryA which makes categoryB empty, a series of update and removal operations is probably necessary. The feature of transaction seems useful in such a case.

from hive.

ShangyanLi avatar ShangyanLi commented on July 21, 2024

An additional use case example would be a conditional write (reading value A and only writing value B if A satisfies a certain condition).

from hive.

simc avatar simc commented on July 21, 2024

@ShangyanLi Why are transactions needed for such an operation? Wouldn't it be possible to implement this with the operations currently available?

from hive.

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.