From def2448aa0fe86fc8471047237148fdae4e13732 Mon Sep 17 00:00:00 2001 From: Max Kotliar Date: Wed, 13 May 2026 15:59:17 +0300 Subject: [PATCH] add func comment --- lib/persistentqueue/fastqueue.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/persistentqueue/fastqueue.go b/lib/persistentqueue/fastqueue.go index bc534be716..f9d244e6fe 100644 --- a/lib/persistentqueue/fastqueue.go +++ b/lib/persistentqueue/fastqueue.go @@ -228,7 +228,9 @@ func (fq *FastQueue) tryWriteBlock(block []byte, ignoreDisabledPQ bool) bool { return true } -// MustReadBlock reads the next block from fq to dst and returns it. +// MustReadBlock reads the next block from fq into dst and returns it. +// It first reads from the in-memory queue, then checks file-based queue. +// It blocks until a block is available or the stop deadline is exceeded, in which case it returns (dst, false). func (fq *FastQueue) MustReadBlock(dst []byte) ([]byte, bool) { fq.mu.Lock() defer fq.mu.Unlock() @@ -257,6 +259,9 @@ func (fq *FastQueue) MustReadBlock(dst []byte) ([]byte, bool) { } } +// MustReadInMemoryBlock reads the next block from the in-memory queue into dst and returns it. +// It returns (dst, true) if a block was available, or (nil, false) if the in-memory queue is empty. +// It does not block waiting for new blocks. func (fq *FastQueue) MustReadInMemoryBlock(dst []byte) ([]byte, bool) { fq.mu.Lock() defer fq.mu.Unlock()