buffer

package
v0.13.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 21, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ProcessResponseAsRingBufferToEnd

func ProcessResponseAsRingBufferToEnd(httpResp *http.Response, maxJobLogLines int) (string, int, *http.Response, error)

ProcessResponseAsRingBufferToEnd reads the body of an HTTP response line by line, storing only the last maxJobLogLines lines using a ring buffer (sliding window). This efficiently retains the most recent lines, overwriting older ones as needed.

Parameters:

httpResp:        The HTTP response whose body will be read.
maxJobLogLines:  The maximum number of log lines to retain.

Returns:

string:          The concatenated log lines (up to maxJobLogLines), separated by newlines.
int:             The total number of lines read from the response.
*http.Response:  The original HTTP response.
error:           Any error encountered during reading.

The function uses a ring buffer to efficiently store only the last maxJobLogLines lines. If the response contains more lines than maxJobLogLines, only the most recent lines are kept.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL