Skip to content

About

Java SDK for clusdr, a distributed coordination runtime. Talks to the local daemon for membership, presence, locks, leases, and events.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

A runtime for the cluster. An SDK for the app.

docs Maven Central CI Java 17+ License

Application SDK for the local Clusdr daemon. This package does not join the cluster.

your process  ──►  clusdr daemon on this host  ──►  the rest of the cluster

Not a database, queue, or Kubernetes. Wire API is v1alpha1. TLS is on by default. Blocking client on Java 17+.

Install

<dependency>
  <groupId>io.clusdr</groupId>
  <artifactId>clusdr</artifactId>
  <version>0.2.0</version>
</dependency>

Same version train as the daemon. A running daemon on this host is required:

curl -fsSL https://clusdr.io/install.sh | sh

Linux amd64/arm64, or Docker Hub durguto/clusdr (GHCR: ghcr.io/clusdr/clusdr). Then clusdr init and clusdr start --bootstrap. Guide: first member.

Use

Clusdr.local() dials CLUSDR_GRPC_ADDR or 127.0.0.1:7947, waits on Health, then you own the connection.

try (Cluster c = Clusdr.local()) {
  List<Member> members = c.members();
  Member leader = c.leader();

  c.publish("deployment", Map.of("sha", "abc"));

  Lock lk = c.lock("scheduler", Duration.ofSeconds(15));
  c.unlock("scheduler");

  for (Event event : c.watch()) {
    // member.join, leader.changed, custom.deployment, …
    break;
  }
}

dial is for tests and operators. Apps use local().

One Cluster is safe for concurrent unary calls. Same connection = same holder (unlock is process-wide for that name). Several watch() loops on one client are fine.

ttl is a Duration. close() (and try-with-resources) stops Watch, unlocks, and revokes what this process still holds. Failures throw ClusdrException.

Full surface: Java SDK. Runnable copies (Go, Python, Rust, TypeScript, and Java): examples.

TLS

On unless insecure(true) or CLUSDR_TLS=disabled. PEMs (ca.crt, node.crt, node.key) come from dataDir, CLUSDR_DATA_DIR, or ~/.clusdr. Missing files are an error; this client does not skip-verify.

Not in this package

  • Join, promote, or configure the cluster (CLI)
  • Talking to a remote node's Runtime API as the normal path — put a daemon on that host

Links

Apache-2.0. Contributor checkout: CONTRIBUTING.md.

About

Java SDK for clusdr, a distributed coordination runtime. Talks to the local daemon for membership, presence, locks, leases, and events.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages