MCPcopy Index your code
hub / github.com/coder/coder / initBuf

Method initBuf

coderd/workspacestats/batcher.go:264–287  ·  view source on GitHub ↗

initBuf resets the buffer. b MUST be locked.

(size int)

Source from the content-addressed store, hash-verified

262
263// initBuf resets the buffer. b MUST be locked.
264func (b *DBBatcher) initBuf(size int) {
265 b.buf = &database.InsertWorkspaceAgentStatsParams{
266 ID: make([]uuid.UUID, 0, b.batchSize),
267 CreatedAt: make([]time.Time, 0, b.batchSize),
268 UserID: make([]uuid.UUID, 0, b.batchSize),
269 WorkspaceID: make([]uuid.UUID, 0, b.batchSize),
270 TemplateID: make([]uuid.UUID, 0, b.batchSize),
271 AgentID: make([]uuid.UUID, 0, b.batchSize),
272 ConnectionsByProto: json.RawMessage("[]"),
273 ConnectionCount: make([]int64, 0, b.batchSize),
274 RxPackets: make([]int64, 0, b.batchSize),
275 RxBytes: make([]int64, 0, b.batchSize),
276 TxPackets: make([]int64, 0, b.batchSize),
277 TxBytes: make([]int64, 0, b.batchSize),
278 SessionCountVSCode: make([]int64, 0, b.batchSize),
279 SessionCountJetBrains: make([]int64, 0, b.batchSize),
280 SessionCountReconnectingPTY: make([]int64, 0, b.batchSize),
281 SessionCountSSH: make([]int64, 0, b.batchSize),
282 ConnectionMedianLatencyMS: make([]float64, 0, b.batchSize),
283 Usage: make([]bool, 0, b.batchSize),
284 }
285
286 b.connectionsByProto = make([]map[string]int64, 0, size)
287}
288
289func (b *DBBatcher) resetBuf() {
290 b.buf.ID = b.buf.ID[:0]

Callers 1

NewBatcherFunction · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected