github.com/Cloud-Foundations/Dominator@v0.3.4/lib/queue/api.go (about)

     1  package queue
     2  
     3  // NewDataQueue creates a pair of channels (a send-only channel and a
     4  // receive-only channel) which form a queue. Arbitrary data may be sent via the
     5  // queue. The send-only channel is always available for sending. Data are stored
     6  // in an internal buffer until they are dequeued by reading from the
     7  // receive-only channel. If the send-only channel is closed the receive-only
     8  // channel will be closed after all data are consumed.
     9  func NewDataQueue() (chan<- interface{}, <-chan interface{}) {
    10  	return newDataQueue()
    11  }
    12  
    13  // NewEventQueue creates a pair of channels (a send-only channel and a
    14  // receive-only channel) which form a queue. Events (empty structures) may be
    15  // sent via the queue. The send-only channel is always available for sending.
    16  // An internal count of events received but not consumed is maintained. If the
    17  // send-only channel is closed the receive-only channel will be closed after all
    18  // events are consumed.
    19  func NewEventQueue() (chan<- struct{}, <-chan struct{}) {
    20  	return newEventQueue()
    21  }