An experimental library for building clustered services in Go

Overview

Donut is a library for building clustered applications in Go.

Example

package main

import (
	"context"
	"log"
	"os"

	// Wait for etcd client v3.4, there is a module import issue.
	client "github.com/coreos/etcd/clientv3" // "go.etcd.io/etcd/clientv3"
	"github.com/dforsyth/donut/cluster"
	"github.com/dforsyth/donut/coordinator"
)

type ExampleListener struct {
	logger *log.Logger
}

func (l *ExampleListener) OnJoin(c *cluster.Cluster) {
	l.logger.Println("Joined the cluster!")
}

func (l *ExampleListener) StartWork(ctx context.Context, workKey string) {
	l.logger.Println("Starting work " + workKey)
}

func (*ExampleListener) OnLeave() {}

func main() {
	logger := log.New(os.Stderr, "", log.LstdFlags)
	c := cluster.New("example", "node", &ExampleListener{logger: logger})
	client, err := client.New(client.Config{
		Endpoints: []string{"http://0.0.0.0:2379"},
	})
	if err != nil {
		logger.Fatalf("Failed to create client: %s", err)
	}
	coo, err := coordinator.NewEtcdCoordinator(client)
	if err != nil {
		logger.Fatalf("Failed to create coordinator: %s", err)
	}
	if err := c.Join(coo); err != nil {
		logger.Fatalf("Failed to join cluster: %s", err)
	}
	select {}
}

Documentation

http://go.pkgdoc.org/github.com/dforsyth/donut

TODO

  • Better testing
  • More examples
Issues
  • zookeeper.h: No such file or directory

    zookeeper.h: No such file or directory

    I tried running the example code as stated in the README.md . I always keep getting this error no matter how much I try resolving it. [email protected]:~/Desktop/experiment/go$ go install github.com/jerryant/clusters

    launchpad.net/gozk/zookeeper

    src/launchpad.net/gozk/zookeeper/zk.go:15:23: fatal error: zookeeper.h: No such file or directory #include <zookeeper.h>                                      ^ compilation terminated.

    opened by jerryajay 4
Owner
David Forsythe
🥔
David Forsythe
AppsFlyer 487 Jul 16, 2022
A Go library for master-less peer-to-peer autodiscovery and RPC between HTTP services

sleuth sleuth is a Go library that provides master-less peer-to-peer autodiscovery and RPC between HTTP services that reside on the same network. It w

null 354 Jun 29, 2022
Dapr is a portable, event-driven, runtime for building distributed applications across cloud and edge.

Dapr is a portable, serverless, event-driven runtime that makes it easy for developers to build resilient, stateless and stateful microservices that run on the cloud and edge and embraces the diversity of languages and developer frameworks.

Dapr 18.8k Aug 8, 2022
Skynet is a framework for distributed services in Go.

##Introduction Skynet is a communication protocol for building massively distributed apps in Go. It is not constrained to Go, so it will lend itself n

null 2k Jul 25, 2022
A distributed, proof of stake blockchain designed for the financial services industry.

Provenance Blockchain Provenance is a distributed, proof of stake blockchain designed for the financial services industry.

Provenance Blockchain, Inc. 57 Jul 22, 2022
Distributed-Services - Distributed Systems with Golang to consequently build a fully-fletched distributed service

Distributed-Services This project is essentially a result of my attempt to under

Hamza Yusuff 6 Jun 1, 2022
Golang client library for adding support for interacting and monitoring Celery workers, tasks and events.

Celeriac Golang client library for adding support for interacting and monitoring Celery workers and tasks. It provides functionality to place tasks on

Stefan von Cavallar 73 Jul 19, 2022
dht is used by anacrolix/torrent, and is intended for use as a library in other projects both torrent related and otherwise

dht Installation Install the library package with go get github.com/anacrolix/dht, or the provided cmds with go get github.com/anacrolix/dht/cmd/....

Matt Joiner 240 Aug 2, 2022
A feature complete and high performance multi-group Raft library in Go.

Dragonboat - A Multi-Group Raft library in Go / 中文版 News 2021-01-20 Dragonboat v3.3 has been released, please check CHANGELOG for all changes. 2020-03

lni 4.3k Jul 27, 2022
Compute cluster (HPC) job submission library for Go (#golang) based on the open DRMAA standard.

go-drmaa This is a job submission library for Go (#golang) which is compatible to the DRMAA standard. The Go library is a wrapper around the DRMAA C l

Daniel Gruber 39 Jun 24, 2022
Dynatomic is a library for using dynamodb as an atomic counter

Dynatomic Dynatomic is a library for using dynamodb as an atomic counter Dynatomic Motivation Usage Development Contributing Motivation The dynatomic

Tyler Finethy 14 Jan 23, 2022
Library for enabling asynchronous health checks in your service

go-health A library that enables async dependency health checking for services running on an orchestrated container platform such as kubernetes or mes

InVision 627 Jul 30, 2022
A standard library for microservices.

Go kit Go kit is a programming toolkit for building microservices (or elegant monoliths) in Go. We solve common problems in distributed systems and ap

Go kit 23.6k Aug 4, 2022
Simple, fast and scalable golang rpc library for high load

gorpc Simple, fast and scalable golang RPC library for high load and microservices. Gorpc provides the following features useful for highly loaded pro

Aliaksandr Valialkin 652 Jul 24, 2022
A library that implements the outboxer pattern in go

Outboxer Outboxer is a go library that implements the outbox pattern. Getting Started Outboxer was designed to simplify the tough work of orchestratin

Ítalo Vietro 87 Jul 27, 2022
🌧 BitTorrent client and library in Go

rain BitTorrent client and library in Go. Running in production at put.io. Features Core protocol Fast extension Magnet links Multiple trackers UDP tr

Cenk Altı 748 Jul 18, 2022
Go Library [DEPRECATED]

Tideland Go Library Description The Tideland Go Library contains a larger set of useful Google Go packages for different purposes. ATTENTION: The cell

Tideland 194 May 27, 2022
Lockgate is a cross-platform locking library for Go with distributed locks using Kubernetes or lockgate HTTP lock server as well as the OS file locks support.

Lockgate Lockgate is a locking library for Go. Classical interface: 2 types of locks: shared and exclusive; 2 modes of locking: blocking and non-block

werf 229 Jul 18, 2022
A distributed systems library for Kubernetes deployments built on top of spindle and Cloud Spanner.

hedge A library built on top of spindle and Cloud Spanner that provides rudimentary distributed computing facilities to Kubernetes deployments. Featur

null 21 Jan 4, 2022