Remove Ring.Close
This is unused.
This commit is contained in:
parent
13635747c4
commit
7ce369958e
13
ring.go
13
ring.go
@ -14,7 +14,6 @@ type Ring struct {
|
|||||||
|
|
||||||
cur uint64
|
cur uint64
|
||||||
consumers []*RingConsumer
|
consumers []*RingConsumer
|
||||||
closed bool
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewRing creates a new ring buffer.
|
// NewRing creates a new ring buffer.
|
||||||
@ -27,10 +26,6 @@ func NewRing(capacity int) *Ring {
|
|||||||
|
|
||||||
// Produce appends a new message to the ring buffer.
|
// Produce appends a new message to the ring buffer.
|
||||||
func (r *Ring) Produce(msg *irc.Message) {
|
func (r *Ring) Produce(msg *irc.Message) {
|
||||||
if r.closed {
|
|
||||||
panic("soju: Ring.Produce called after Close")
|
|
||||||
}
|
|
||||||
|
|
||||||
i := int(r.cur % r.cap)
|
i := int(r.cur % r.cap)
|
||||||
r.buffer[i] = msg
|
r.buffer[i] = msg
|
||||||
r.cur++
|
r.cur++
|
||||||
@ -40,14 +35,6 @@ func (r *Ring) Cur() uint64 {
|
|||||||
return r.cur
|
return r.cur
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Ring) Close() {
|
|
||||||
if r.closed {
|
|
||||||
panic("soju: Ring.Close called twice")
|
|
||||||
}
|
|
||||||
|
|
||||||
r.closed = true
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewConsumer creates a new ring buffer consumer.
|
// NewConsumer creates a new ring buffer consumer.
|
||||||
//
|
//
|
||||||
// If seq is nil, the consumer will get messages starting from the last
|
// If seq is nil, the consumer will get messages starting from the last
|
||||||
|
Loading…
Reference in New Issue
Block a user