forked from cockroachdb/pebble
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdb_internals.go
More file actions
24 lines (20 loc) · 761 Bytes
/
db_internals.go
File metadata and controls
24 lines (20 loc) · 761 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Copyright 2012 The LevelDB-Go and Pebble Authors. All rights reserved. Use
// of this source code is governed by a BSD-style license that can be found in
// the LICENSE file.
package pebble
// JobID identifies a job (like a compaction). Job IDs are passed to event
// listener notifications and act as a mechanism for tying together the events
// and log messages for a single job such as a flush, compaction, or file
// ingestion. Job IDs are not serialized to disk or used for correctness.
type JobID int
// newJobIDLocked returns a new JobID; DB.mu must be held.
func (d *DB) newJobIDLocked() JobID {
res := d.mu.nextJobID
d.mu.nextJobID++
return res
}
func (d *DB) newJobID() JobID {
d.mu.Lock()
defer d.mu.Unlock()
return d.newJobIDLocked()
}