/* * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. */ #pragma once #include "glean/rts/densemap.h" #include "glean/rts/id.h" #include "glean/rts/stats.h" namespace facebook { namespace glean { namespace rocks { using PredicateStats = rts::DenseMap; /// Atomic access to predicate stats. This is completely encapsulated here /// mostly because including Hazptr.h needs RTTI, but we have to compile the /// rest of rocksdb.cpp with -fno-rtti because some pre-compiled RocksDB /// packages are compiled with -fno-rtti and otherwise we get linker errors. class AtomicPredicateStats { public: AtomicPredicateStats(); ~AtomicPredicateStats(); void set(PredicateStats stats); PredicateStats get() const; size_t count(rts::Pid pid) const; const PredicateStats& unprotected() const; private: struct Impl; std::unique_ptr impl; }; } // namespace rocks } // namespace glean } // namespace facebook