MCPcopy
hub / github.com/kopia/kopia / initNewBuffer

Method initNewBuffer

internal/repodiag/log_manager.go:129–147  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

127}
128
129func (m *LogManager) initNewBuffer() (flushBuffer *gather.WriteBuffer, flushBlobID blob.ID) {
130 if m.gz != nil {
131 m.gz.Close() //nolint:errcheck
132 }
133
134 flushBuffer = m.currentSegment
135
136 if flushBuffer != nil {
137 flushBlobID = blob.ID(fmt.Sprintf("%v_%v_%v_%v_", m.prefix, m.startTime, m.timeFunc().Unix(), m.nextChunkNumber.Add(1)))
138 } else {
139 flushBlobID = blob.ID("")
140 }
141
142 m.startTime = m.timeFunc().Unix()
143 m.currentSegment = gather.NewWriteBuffer()
144 m.gz = gzip.NewWriter(m.currentSegment)
145
146 return flushBuffer, flushBlobID
147}
148
149// NewLogManager creates a new LogManager that will emit logs as repository blobs.
150func NewLogManager(ctx context.Context, w *BlobWriter, disableRepositoryLog bool, textWriter io.Writer, params ...contentlog.ParamWriter) *LogManager {

Callers 2

outputEntryMethod · 0.95
SyncMethod · 0.95

Calls 5

IDTypeAlias · 0.92
NewWriteBufferFunction · 0.92
CloseMethod · 0.65
NewWriterMethod · 0.65
AddMethod · 0.45

Tested by

no test coverage detected