MCPcopy
hub / github.com/puma/puma-dev / Append

Method Append

linebuffer/linebuffer.go:18–38  ·  view source on GitHub ↗
(line string)

Source from the content-addressed store, hash-verified

16}
17
18func (lb *LineBuffer) Append(line string) error {
19 lb.lock.Lock()
20 defer lb.lock.Unlock()
21
22 if lb.Size == 0 {
23 lb.Size = DefaultSize
24 }
25
26 if len(lb.lines) < lb.Size {
27 lb.lines = append(lb.lines, line)
28 } else {
29 lb.lines[lb.cur] = line
30 lb.cur++
31
32 if lb.cur == len(lb.lines) {
33 lb.cur = 0
34 }
35 }
36
37 return nil
38}
39
40func (lb *LineBuffer) Do(x func(string) error) error {
41 lb.lock.Lock()

Callers 4

TestLineBufferFunction · 0.95
eventAddMethod · 0.80
watchMethod · 0.80
AddMethod · 0.80

Calls

no outgoing calls

Tested by 1

TestLineBufferFunction · 0.76