Skip to content

v2.1 Ethereal Sky

Latest
Compare
Choose a tag to compare
@petomalina petomalina released this 21 Dec 17:53
· 2 commits to main since this release

v2.1 Ethereal Sky

This release comes with two main features:

  • pot now supports CLI flags as well as environment variables (run pot --help)
  • pot now support Open Telemetry integration by passing (--metrics and --tracing). You need to setup a default OTEL collector.
Usage: main --bucket=STRING

Flags:
  -h, --help                Show context-sensitive help.
      --log-level="info"    debug | info | warn | error ($LOG_LEVEL)
  -b, --bucket=STRING       bucket name ($BUCKET)
      --zip=STRING          zip is the path where the zip file is stored ($ZIP)
      --distributed-lock    distributed-lock enables distributed locking of the pot
                            ($DISTRIBUTED_LOCK)
      --tracing             tracing enables tracing ($TRACING)
      --metrics             metrics enables metrics ($METRICS)

Running Elections on Pot

Another major feature is a support for elections. You can check the example to see how you can hold elections between multiple servers to decide which one should be and keep being a leader. This is an incredibly simple algorithm mainly for use in situations where one needs a lightweight, almost-no-cost replacement to Raft or Paxos. The algorithm was inspired by Raft, but runs fully on a bucket as a backend.

slog.Info("attempting election", slog.String("id", id), slog.Bool("primary", primary))
res, err := client.Create("test/election", []Leader{{ID: id}}, pot.WithNoRewrite(time.Second*10))
if err != nil {
	if pot.IsNoRewriteViolated(err) {
		primary = false
	} else {
		slog.Error("failed", slog.String("err", err.Error()))
	}
}

if !primary && err == nil {
	primary = true
	slog.Info("became primary", slog.String("id", id), slog.Int64("generation", res.Generation))
}

Full Changelog: v2.0...v2.1