Git Product home page Git Product logo

Comments (8)

vaind avatar vaind commented on May 31, 2024

ObjectBox Go currently only works in embedded mode, where there is no separate database server. Therefore, a program requires unique access to the database (files).

From what I understand about your situation, you have two options:

  • These programs each have separate databases and communicate with each other through an API (like microservices). In that case, each program only needs access to its own database file directly.
  • If both programs need access to the same physical database, you'd probably have to keep opening the database when you need it and immediately closing it afterwards - that might work but obviously induces performance degradation.

Your best bet would be for each program to have its own database. If you really need one, you can have a simple service with both databases, providing an API to the other programs.

In the future, you could use ObjectBox Sync to solve this situation (if you would be fine with asynchronous data propagation between the clients) but that's not readily available yet.

from objectbox-go.

greenrobot avatar greenrobot commented on May 31, 2024

There might be a third option: merge program1 and program2 into one. If both programs should access both databases, what is the motivation to separate them? Asking to understand your use case better...

from objectbox-go.

harisgen79 avatar harisgen79 commented on May 31, 2024

Program1 performs as an RFID card scanner which means it should respond quickly which is the motivation to separate them. Program2 also does POST and GET methods every interval (few hours or so, haven't defined it yet). When it does GET it receives data of 1500+ employees which takes a long time. If it was all in one program, RFID reader would not be responding while doing GET so I had to separate them, otherwise there might be a queue of employees getting angry because the device is not responding instantly.

from objectbox-go.

greenrobot avatar greenrobot commented on May 31, 2024

@harisgen79 ObjectBox uses a multi version concurrency model, where a reader (read transactions; usually sufficient for a typical GET) never blocks a writer.

from objectbox-go.

harisgen79 avatar harisgen79 commented on May 31, 2024

OK then, I'll figure something out then. Thank you for the answers. Cheers.

from objectbox-go.

vaind avatar vaind commented on May 31, 2024

Also, you can run the employee update job "in the background" as another goroutine, see https://golang.org/pkg/time/#example_NewTicker - that means you can have it all in the single application while not blocking the RFID scanner functionality

from objectbox-go.

harisgen79 avatar harisgen79 commented on May 31, 2024

I made exactly that, works fine, thanks for the advice.

from objectbox-go.

vaind avatar vaind commented on May 31, 2024

Glad it worked. Closing the issue.

from objectbox-go.

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.