beans

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 9, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

README

go-beanstalk-client

Go Report Card

Purpose

  • Learn to learn the relevant grammar knowledge of GoLand and help you understand the basic grammar and understand the characteristics of the language.
  • Using the beanstalk queue (Beanstalk is a simple, fast work queue. https://beanstalkd.github.io/) and using Go's coroutine goroutine feature, you can create a factory for each Tube pipeline, the factory has a number of custom quantities Workers and workers receive tasks.

install-linux

cd example
./install.sh

execute file

  • beanstalkf
  • beanstalkf-daemon background

Command

  • start
  • status
  • stop

Documentation

Overview

Package beans implements a queue of beanstalk framework

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSeparator

func GetSeparator(x int, y int) string

GetSeparator get the separator

func GetSliceByMapString

func GetSliceByMapString(m map[string]string) []string

GetSliceByMapString 将无序的map转换为slice

func ListTubeInfo

func ListTubeInfo(t *beanstalk.Tube)

ListTubeInfo view one tube status

func ListTubesInfo

func ListTubesInfo()

ListTubesInfo view all tubes status

func Monitor

func Monitor(originTubeNum int)

Monitor 厂长监控

func Run

func Run()

Run start to run command

func ShowStatus

func ShowStatus(status *map[string]string)

ShowStatus 将状态信息的格式转化为易阅读的格式

func Start

func Start()

Start start to work

func Status

func Status()

Status view the tube status

func TestPut

func TestPut(tubeName *string)

TestPut tube Put Job

func TubeFactoryStart

func TubeFactoryStart(tubeName string)

TubeFactoryStart 管道工厂启动

Types

type TubeFactory

type TubeFactory struct {
	// contains filtered or unexported fields
}

TubeFactory Tube工厂

func NewTubeFactory

func NewTubeFactory(name string, num int, conn *beanstalk.Conn) *TubeFactory

NewTubeFactory 创建Tube工厂

func (*TubeFactory) Run

func (tf *TubeFactory) Run()

Run 工厂启动

type Worker

type Worker struct {
	// contains filtered or unexported fields
}

Worker 工人

func NewWorker

func NewWorker(name string, f func(name string, conn *beanstalk.Conn) error) *Worker

NewWorker 分配工人

func (*Worker) Execute

func (w *Worker) Execute(tf *TubeFactory)

Execute 工人开始操作

func (*Worker) ReserveJob

func (w *Worker) ReserveJob()

ReserveJob 获取任务Job

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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