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. Lines exceeding maxLineSize are truncated with a marker.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.