Znode tree with versioned CAS, ephemeral/sequential nodes, sessions, and one-shot watches. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
20 lines
518 B
Markdown
20 lines
518 B
Markdown
# zk
|
|
|
|
In-memory ZooKeeper-style coordination store in Go.
|
|
|
|
- Znode tree with versioned data and compare-and-set `Set`/`Delete`
|
|
- Persistent, ephemeral, and sequential nodes
|
|
- Sessions: closing one deletes its ephemeral nodes
|
|
- One-shot watches via `Get`, `Exists`, and `Children`
|
|
- Stat with czxid/mzxid/pzxid, version, cversion
|
|
|
|
```go
|
|
s := zk.New()
|
|
c := s.NewSession()
|
|
defer c.Close()
|
|
c.Create("/election", nil, zk.Persistent)
|
|
me, _ := c.Create("/election/n-", nil, zk.EphemeralSequential)
|
|
```
|
|
|
|
`go test -race ./...`
|