message_queue

package
v0.0.0-...-fc33dcb Latest Latest
Warning

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

Go to latest
Published: May 22, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EmptyQueue

func EmptyQueue()

func FrontQueue

func FrontQueue()

func Run

func Run()

Types

type Body

type Body struct {
	Next    *Body
	Key     []byte
	Value   interface{}
	Check   bool
	Operate func() error
}

type Msg

type Msg struct {
	From    string
	To      string
	Time    int64
	Content string
	Repeat  int
	Loop    int
	Next    *Msg
}

type Queue

type Queue struct {
	Body   *Body
	Length int
}

func InitQueue

func InitQueue() *Queue

func (*Queue) InQueue

func (q *Queue) InQueue(body *Body)

func (*Queue) OutQueue

func (q *Queue) OutQueue() *Body

type Ring

type Ring struct {
	Now  *Msg
	Dead []*Msg `用来存放没有成功推送出去的消息,消息都会立即推送出去,没推出去下方在Dead`
	All  int    `当前所有的消息数`
	// contains filtered or unexported fields
}
var RING *Ring

func NewMessage

func NewMessage() *Ring

TODO Message 要 new 出一个环形的msg

func (*Ring) Pull

func (r *Ring) Pull(msg *Msg, res *string) error

func (*Ring) Push

func (r *Ring) Push(msg *Msg, res *string) error

Jump to

Keyboard shortcuts

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