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