pchan


职责

源码实现

源码实现请见pchan.go

结构

type PChan struct {
	exit       chan struct{} //退出信号
	needStore  bool          //是否需要落盘
	storeMutex *sync.Mutex   //锁
	waiter     *sync.WaitGroup
	queue      *fqueue.FQueue //利用fqueue实现的mmap,大小4G
	limit      int            //阈值
	input      chan []byte    //input管道,有缓冲型,大小 limit*1.5
	output     chan []byte    //output管道,有缓冲型l,大小 limit*1.5

	Input  chan<- []byte //外部使用的input,主要是给server使用,还有proxy失败回传
	Output <-chan []byte //外部使用的output,主要是给proxy使用,proxy从中读取消息
}

注意事项