Skip to content
This repository was archived by the owner on Dec 30, 2020. It is now read-only.

robotomize/bionic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bionic

This is a simple and easy-to-configure distributed task queue.

Bionic is made to quickly deploy distributed computing involving user hosts. Websocket is used as a transport.

install

This version is not for use in production.

go get github.com/robotomize/bionic

A client calculating pi may look like this

c, err := bionic.NewClient("ws://localhost:9090/ws", http.Header{"Cookie": []string{}})
	if err != nil {
		fmt.Printf(err.Error())
		os.Exit(2)
	}
	c.RegisterHandlers("pi", func(j *bionic.JobMessage) error {
		var req *PiJobReq
		if err := json.Unmarshal(j.Job.Payload, &req); err != nil {
			return err
		}
		n := req.N
		res := &PiJobResp{Pi: pi(n)}

		bytes, err := json.Marshal(&res)
		if err != nil {
			return err
		}
		j.Proto.Kind = bionic.JobCompletedMessageKind
		j.Job.Payload = bytes
		return nil
	})
	go c.Listen()

About

This is a simple and easy-to-configure distributed task queue

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages