()
| 127 | } |
| 128 | |
| 129 | func (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. |
| 150 | func NewLogManager(ctx context.Context, w *BlobWriter, disableRepositoryLog bool, textWriter io.Writer, params ...contentlog.ParamWriter) *LogManager { |
no test coverage detected