MCPcopy Create free account
hub / github.com/apache/pulsar-client-go / ReadableSlice

Method ReadableSlice

pulsar/internal/blocking_queue.go:208–223  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

206}
207
208func (bq *blockingQueue) ReadableSlice() []interface{} {
209 bq.mutex.Lock()
210 defer bq.mutex.Unlock()
211
212 res := make([]interface{}, bq.size)
213 readIdx := bq.headIdx
214 for i := 0; i < bq.size; i++ {
215 res[i] = bq.items[readIdx]
216 readIdx++
217 if readIdx == bq.maxSize {
218 readIdx = 0
219 }
220 }
221
222 return res
223}
224
225func (bq *blockingQueue) Lock() {
226 bq.mutex.Lock()

Callers

nothing calls this directly

Calls 2

LockMethod · 0.65
UnlockMethod · 0.65

Tested by

no test coverage detected