cspmodel

package
v0.0.0-...-d5aecf8 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BarrierMode

func BarrierMode()

func Consumer

func Consumer(in <-chan int)

消费者

func PipelineMode

func PipelineMode()

func Producer

func Producer(factor int, out chan<- int)

生产者: 生成 factor 整数倍的序列, 3, 0, 3, 6, 9, 5, 0, 5, 10, 15

func ProducerConsumerMode

func ProducerConsumerMode()

Types

type Publisher

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

发布者对象

func NewPublisher

func NewPublisher(publishTimeout time.Duration, buffer int) *Publisher

构建一个发布者对象, 可以设置发布超时时间和缓存队列的长度

func (*Publisher) Close

func (p *Publisher) Close()

关闭发布者对象,同时关闭所有的订阅者管道。

func (*Publisher) Evict

func (p *Publisher) Evict(sub chan interface{})

退出订阅

func (*Publisher) Publish

func (p *Publisher) Publish(v interface{})

发布一个主题

func (*Publisher) Subscribe

func (p *Publisher) Subscribe() chan interface{}

添加一个新的订阅者,订阅全部主题

func (*Publisher) SubscribeTopic

func (p *Publisher) SubscribeTopic(topic topicFunc) chan interface{}

添加一个新的订阅者,订阅过滤器筛选后的主题

type SiteResp

type SiteResp struct {
	Site   string
	Err    error
	Resp   string
	Status int
	Cost   int64
}

Jump to

Keyboard shortcuts

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