LCOV - code coverage report
Current view: top level - pebble/internal/cache - entry_invariants.go (source / functions) Hit Total Coverage
Test: 2023-11-03 08:17Z 844f0582 - tests + meta.lcov Lines: 10 14 71.4 %
Date: 2023-11-03 08:18:51 Functions: 0 0 -

          Line data    Source code
       1             : // Copyright 2020 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             : //go:build (invariants && !race) || (tracing && !race)
       6             : // +build invariants,!race tracing,!race
       7             : 
       8             : package cache
       9             : 
      10             : import (
      11             :         "fmt"
      12             :         "os"
      13             : 
      14             :         "github.com/cockroachdb/pebble/internal/invariants"
      15             : )
      16             : 
      17             : // When the "invariants" or "tracing" build tags are enabled, we need to
      18             : // allocate entries using the Go allocator so entry.val properly maintains a
      19             : // reference to the Value.
      20             : const entriesGoAllocated = true
      21             : 
      22           2 : func entryAllocNew() *entry {
      23           2 :         e := &entry{}
      24           2 :         // Note: this is a no-op if invariants and tracing are disabled or race is
      25           2 :         // enabled.
      26           2 :         invariants.SetFinalizer(e, func(obj interface{}) {
      27           2 :                 e := obj.(*entry)
      28           2 :                 if v := e.ref.refs(); v != 0 {
      29           0 :                         fmt.Fprintf(os.Stderr, "%p: cache entry has non-zero reference count: %d\n%s",
      30           0 :                                 e, v, e.ref.traces())
      31           0 :                         os.Exit(1)
      32           0 :                 }
      33             :         })
      34           2 :         return e
      35             : }
      36             : 
      37           2 : func entryAllocFree(e *entry) {
      38           2 : }

Generated by: LCOV version 1.14