queue

package
v0.0.0-...-285c3ee Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2023 License: BSD-2-Clause Imports: 13 Imported by: 0

Documentation

Overview

*

  • Package queue implements a simple 'dynamic' queue, letting
  • external services write to you so you can process them async
  • and without any pressure to handle edge-cases like failure. *
  • - /queue/<name>/<MD5(secret+name)>(.ok)
  • <name> is channel to put HTTP-req in
  • (.ok) is optional and when set returns OK as body (if remote party needs this)
  • <secret> is key in overrides.toml
  • - func health() returns health-status for queues
  • <name> = {pending: X, first: <when it started processing>, last: <last time job was processed> lastOK: <last time job was sucessfully processed>, ok=N err=N} *
  • This package uses boltdb to save the entries in buckets.
  • /var/hfast.db > queue-bucket > name-bucket

*

  • TCP localhost:11300 for workers to connect to
  • Every minute PING/PONG
  • It's a server push protocol, the server will inform event-driven
  • the request.
  • > HELLO hfast.v1
  • < CHAN chan1 chan2 ...
  • > READY
  • > PING
  • < PONG
  • > JOB <id> <byte_len>
  • > ............
  • > ............
  • < DONE <id>

Index

Constants

View Source
const WORKER_LISTEN = "localhost:11300"

Default listener

View Source
const WORKER_MAX = 100

Limit amount of connected workers

Variables

View Source
var Listen net.Listener

Functions

func Close

func Close() error

Close db and listeners

func Handle

func Handle() http.Handler

URL=/v1/url.json

func Init

func Init() error

func Serve

func Serve(listen string) (func() error, error)

Types

type Job

type Job struct {
	Id uint64
}

type Msg

type Msg struct {
	Id []byte
}

Jump to

Keyboard shortcuts

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