MCPcopy Create free account
hub / github.com/Monibuca/engine / Glow

Method Glow

util/ring-writer.go:54–70  ·  view source on GitHub ↗
(size int)

Source from the content-addressed store, hash-verified

52}
53
54func (rb *RingWriter[T, F]) Glow(size int) (newItem *Ring[F]) {
55 if size < rb.poolSize {
56 newItem = rb.pool.Unlink(size)
57 rb.poolSize -= size
58 } else if size == rb.poolSize {
59 newItem = rb.pool
60 rb.poolSize = 0
61 rb.pool = nil
62 } else {
63 newItem = rb.create(size - rb.poolSize).Link(rb.pool)
64 rb.poolSize = 0
65 rb.pool = nil
66 }
67 rb.Link(newItem)
68 rb.Size += size
69 return
70}
71
72func (rb *RingWriter[T, F]) recycle(r *Ring[F]) {
73 if rb.pool == nil {

Callers 2

StepMethod · 0.95
FlushMethod · 0.80

Calls 3

createMethod · 0.95
UnlinkMethod · 0.80
LinkMethod · 0.80

Tested by

no test coverage detected