Coder Social home page Coder Social logo

godist's Introduction

godist

Description

godist is a distributed worker library for the Go language.

Implementation

godist is implemented as a collection interfaces, and a function to create a basic Workflow. To use godist, implement the required interfaces for your concrete Job and Task data structures, and submit jobs to the concrete Workflow.

Example use

Creating a Workflow

A basic concrete Workflow data structure is returned by invoking NewBasicWorkflow as demonstrated in the following example:

    howManyWorkersForEachPhase := 5
	w := NewBasicWorkflow(howManyWorkersForEachPhase)
	defer w.Quit()

Submitting Jobs to the Workflow

Once a Workflow is created, jobs may be submitted to the Workflow either asynchronously provided with a call-back function, or synchronously by blocking until the Job is complete.

Synchronous example:

	var buf bytes.Buffer
	job := newSillyJob(5, 60, &buf)
	w.SubmitAndWait(job)

Asynchronous example.

	var buf bytes.Buffer
	job := newSillyJob(1, 20, &buf)
	done := make(chan bool)
	w.SubmitWithCallback(job, func() { done <- true })
	<-done

Other Examples

See example implementations of Job and Task in silly.go, with included unit testing in silly_test.go.

See example implementation of Workflow in workflow.go, with included unit testing in workflow_test.go.

godist's People

Contributors

karrick avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.