- Sort Score
- Result 10 results
- Languages All
Results 1 - 3 of 3 for CloseWriter (0.16 sec)
-
internal/ringbuffer/README.md
`TryRead` and `TryWrite` are still available for non-blocking reads and writes. To signify the end of the stream, close the ring buffer from the writer side with `rb.CloseWriter()` Either side can use `rb.CloseWithError(err error)` to signal an error and close the ring buffer. Any reads or writes will return the error on next call.
Registered: Sun Nov 03 19:28:11 UTC 2024 - Last Modified: Wed May 15 00:11:04 UTC 2024 - 2.1K bytes - Viewed (0) -
internal/ringbuffer/ring_buffer.go
// and always returns nil. func (r *RingBuffer) CloseWithError(err error) { if err == nil { err = io.EOF } r.setErr(err, false) } // CloseWriter closes the writer. // Reads will return any remaining bytes and io.EOF. func (r *RingBuffer) CloseWriter() { r.setErr(io.EOF, false) } // Flush waits for the buffer to be empty and fully read.
Registered: Sun Nov 03 19:28:11 UTC 2024 - Last Modified: Wed May 15 00:11:04 UTC 2024 - 13.3K bytes - Viewed (0) -
internal/ringbuffer/ring_buffer_test.go
} if doSleep && writeRng.Intn(10) == 0 { time.Sleep(time.Duration(writeRng.Intn(maxSleep))) } } if err := rb.Flush(); err != nil { t.Fatalf("flush failed: %v", err) } rb.CloseWriter() } wg.Wait() if !errors.Is(readErr, io.EOF) { t.Fatalf("expect io.EOF but got %v", readErr) } if readBytes != wroteBytes { a, b := readBuf.Bytes(), wroteBuf.Bytes()
Registered: Sun Nov 03 19:28:11 UTC 2024 - Last Modified: Wed May 15 00:11:04 UTC 2024 - 26.8K bytes - Viewed (0)