distributed

package module
v0.0.0-...-16a880a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 18, 2018 License: MPL-2.0 Imports: 3 Imported by: 2

README

go-distributed GoDoc Build Status Go Report Card Coverage Status

Package designed to run long-running tasks in a cluster.

Contributing

If you'd like to add new exported APIs, please open an issue describing your proposal — discussing API changes ahead of time makes pull request review much smoother. In your issue, pull request, and any other communications, please remember to treat your fellow contributors with respect!

Setup

Fork, then clone the repository:

mkdir -p $GOPATH/src/github.com/monetha
cd $GOPATH/src/github.com/monetha
git clone git@github.com:your_github_username/go-distributed.git
cd go-distributed
git remote add upstream https://github.com/monetha/go-distributed.git
git fetch upstream

Install dependencies:

make dependencies

Make sure that the tests and the linters pass:

make test
make lint
Making Changes

Start by creating a new branch for your changes:

cd $GOPATH/src/github.com/monetha/go-distributed
git checkout master
git fetch upstream
git rebase upstream/master
git checkout -b cool_new_feature

Make your changes, then ensure that make lint and make test still pass. If you're satisfied with your changes, push them to your fork.

git push origin cool_new_feature

Then use the GitHub UI to open a pull request.

At this point, you're waiting on us to review your changes. We try to respond to issues and pull requests within a few business days, and we may suggest some improvements or alternatives. Once your changes are approved, one of the project maintainers will merge them.

We're much more likely to approve your changes if you:

  • Add tests for new functionality.
  • Write a good commit message.
  • Maintain backward compatibility.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBroker

func NewBroker(cfg *Config) (broker.Broker, error)

NewBroker creates a Broker which allows you to execute arbitrary tasks in a distributed infrastructure. The same tasks should be registered on a multiple servers, but only one instance of the task will be launched. Consul key is used to uniquely identify the task. When `cfg` is not nil Broker uses Consul to acquire the distributed lock and to ensure a single instance of a task is running. In case `cfg` is nil Broker uses mutex and runs all tasks locally allowing you not to have Consul cluster and simulate distributed environment.

Types

type Config

type Config consulbroker.Config

Config is a broker configuration

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL