A Go implementation of Apache Helix (currently the participant part only).
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
model
util
zk
.codecov.yml
.gitignore
.travis.yml
CODE_OF_CONDUCT.md
CONTRIBUTING.md
LICENSE
Makefile serialize Feb 1, 2018
README.md
admin.go
admin_test.go
check_license.sh initial commit (already functional) Dec 15, 2017
constants.go
cover.sh
data_accessor.go
data_accessor_test.go
glide.lock initial commit (already functional) Dec 15, 2017
glide.yaml
key_builder.go
participant.go
participant_test.go
state_model.go
state_model_processor.go
state_model_test.go
test_participant.go
test_util.go

README.md

go-helix GoDoc Build Status Coverage Status

A Go implementation of Apache Helix.

Currently the participant part only, compatible with the Apache Helix Java controller.

Installation

go get -u github.com/uber-go/go-helix

Quick Start

Init participant

participant, fatalErrChan := NewParticipant(
	zap.NewNop(),
	tally.NoopScope,
	"localhost:2181", // Zookeeper connect string
	"test_app", // application identifier
	"test_cluster", // helix cluster name
	"test_resource", // helix resource name
	"localhost", // participant host name
	123, // participant port
)

processor := NewStateModelProcessor()
processor.AddTransition("OFFLINE", "ONLINE", func(m *model.Message) (err error) {
    partitionNum, err := p.getPartitionNum(m)
    if err != nil {
        return err
    }
    // add logic here to save the owned partition and/or perform any actions for going online
})
processor.AddTransition("ONLINE", "OFFLINE", func(m *model.Message) (err error) {
   partitionNum, err := p.getPartitionNum(m)
   if err != nil {
       return err
   }
   // add logic here to remove the owned partition and/or perform any actions for going offline
})

participant.RegisterStateModel("OnlineOffline", processor)

err := participant.Connect() // initialization is complete if err is nil

// listen to the fatal error channel and handle the error by
// 1. recreate participant from scratch and connect, or
// 2. quit the program and restart
fatalErr := <- fatalErrChan

Use participant

Use the saved partitions to see if the partition should be handled by the participant.

Disconnect participant

participant.Disconnect()

Development Status: Beta

The APIs are functional. We do not expect, but there's no guarantee that no breaking changes will be made.

Contributing

We encourage and support an active, healthy community of contributors — including you! Details are in the contribution guide and the code of conduct. The go-helix maintainers keep an eye on issues and pull requests, but you can also report any negative conduct to oss-conduct@uber.com. That email list is a private, safe space; even the go-helix maintainers don't have access, so don't hesitate to hold us to a high standard.


Released under the MIT License.