Comments (1)
Yes, libdqlite expect standard NULL-terminated C strings.
I didn't try with rust, but I can't quite reproduce your issue with plain C.
I wrote a main.c
server with:
#include <stdio.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <dqlite.h>
int main() {
const char *address = "127.0.0.1:5005";
const char *dir = "/tmp/dqlite-rs";
dqlite_node *node;
int rv;
mkdir(dir, 0755);
rv = dqlite_node_create(1, address, dir, &node);
if (rv != 0) {
printf("dqlite_node_create: %d\n", rv);
}
rv = dqlite_node_set_bind_address(node, address);
if (rv != 0) {
printf("dqlite_bind_address: %d\n", rv);
}
rv = dqlite_node_start(node);
if (rv != 0) {
printf("dqlite_node_start: %d\n", rv);
}
pause();
}
which I compiled and started with:
gcc main.c -o main -ldqlite && ./main
That starts fine. I then I wrote a minimal Go main.go
client with:
package main
import (
"context"
"database/sql"
"log"
"github.com/canonical/go-dqlite/client"
"github.com/canonical/go-dqlite/driver"
)
func main() {
store := client.NewInmemNodeStore()
store.Set(context.Background(), []client.NodeInfo{{Address: "127.0.0.1:5005"}})
driver, err := driver.New(store)
if err != nil {
log.Fatal(err)
}
sql.Register("dqlite", driver)
db, err := sql.Open("dqlite", "test.db")
if err != nil {
log.Fatal(err)
}
defer db.Close()
_, err = db.Exec("CREATE TABLE IF NOT EXISTS foo(n INT)")
if err != nil {
log.Fatal(err)
}
}
and ran it with:
go run -tags libsqlite3 main.go
The client ran fine without reporting errors.
from dqlite.
Related Issues (20)
- Proposal: stop trying to handle OOM HOT 1
- Investigate growing memory usage found by microk8s benchmarking HOT 2
- Consider shipping a tiny "manifest" binary to print information about the dqlite installation
- install instructions don't work HOT 4
- Confusing error message when trying to run a query statement with Exec HOT 1
- Recommended way to perform schema migrations HOT 4
- Raft uv_timer leak when creating and destroying node HOT 1
- Cluster-wide configuration of target voter/standby count
- Idea: pass a socket instead of dqlite_node_set_bind_address HOT 4
- Implement DQLITE_VISIBLE_TO_TESTS properly, or get rid of it HOT 1
- Git layout for v1.15.0 HOT 8
- Write operations that immediately follow write operations sometimes cause a disk I/O-error, followed by loss of leadership and high latency HOT 3
- Support the RETURNING clause HOT 2
- Can we use the unix-excl VFS? HOT 9
- Consider periodically using VACUUM to reduce memory footprint HOT 9
- Not Leader failure response HOT 5
- Multi threading bug in tracef() HOT 1
- Jepsen: assertion failure in vfs.c HOT 1
- Nested barriers
- 1.16.0: test suite fails HOT 17
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 dqlite.