Comments (8)
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.
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.
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.
@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.
OK then, I'll figure something out then. Thank you for the answers. Cheers.
from objectbox-go.
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.
I made exactly that, works fine, thanks for the advice.
from objectbox-go.
Glad it worked. Closing the issue.
from objectbox-go.
Related Issues (20)
- Query: OR condition HOT 2
- Build fails on CentOS 7 due to gcc not running c99 mode HOT 1
- Following GETTING STARTED guide does not work HOT 4
- Self-assigned IDs HOT 3
- Maybe fix this ? HOT 3
- Encryption & static linking HOT 2
- Support sync-server
- Support "Flex" type
- Support "unique: replace on conflict"
- Installation fails under WSL2 HOT 2
- Repo is down - 502 Bad Gateway error HOT 3
- Cgo compile error with gcc on Windows 10 Pro: " undefined reference to `obx_txn_mark_success" HOT 6
- New Repo Creation [Objectbox-Rust] HOT 11
- Upgrade dependency "github.com/google/flatbuffers"
- Ignore some structs for code generation
- How to statically compile in golang so library is included?
- Version.LessThan() function not working properly
- Time property in inlined struct
- dyld Symbol not found: _obx_async on latest xcode, macos, and golang HOT 1
- Performance Benchmarks page has broken images HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from objectbox-go.