LCOV - code coverage report
Current view: top level - irohad/ordering/impl/ordering_gate_cache - on_demand_cache.hpp (source / functions) Hit Total Coverage
Test: coverage_cleared.info Lines: 1 1 100.0 %
Date: 2018-12-05 17:11:35 Functions: 4 5 80.0 %

          Line data    Source code
       1             : /**
       2             :  * Copyright Soramitsu Co., Ltd. All Rights Reserved.
       3             :  * SPDX-License-Identifier: Apache-2.0
       4             :  */
       5             : 
       6             : #ifndef IROHA_ON_DEMAND_CACHE_HPP
       7             : #define IROHA_ON_DEMAND_CACHE_HPP
       8             : 
       9             : #include "ordering/impl/ordering_gate_cache/ordering_gate_cache.hpp"
      10             : 
      11             : #include <shared_mutex>
      12             : 
      13             : #include <boost/circular_buffer.hpp>
      14             : 
      15             : namespace iroha {
      16             :   namespace ordering {
      17             :     namespace cache {
      18             : 
      19             :       class OnDemandCache : public OrderingGateCache {
      20             :        public:
      21             :         void addToBack(const BatchesSetType &batches) override;
      22             : 
      23             :         BatchesSetType pop() override;
      24             : 
      25             :         void remove(const HashesSetType &hashes) override;
      26             : 
      27             :         virtual const BatchesSetType &head() const override;
      28             : 
      29             :         virtual const BatchesSetType &tail() const override;
      30             : 
      31             :        private:
      32             :         mutable std::shared_timed_mutex mutex_;
      33             :         using BatchesQueueType = boost::circular_buffer<BatchesSetType>;
      34           3 :         BatchesQueueType circ_buffer{3, BatchesSetType{}};
      35             :       };
      36             : 
      37             :     }  // namespace cache
      38             :   }    // namespace ordering
      39             : }  // namespace iroha
      40             : 
      41             : #endif  // IROHA_ON_DEMAND_CACHE_HPP

Generated by: LCOV version 1.13