LCOV - code coverage report
Current view: top level - co - queueSlave.h (source / functions) Hit Total Coverage
Test: Collage Lines: 0 2 0.0 %
Date: 2018-01-09 16:37:03 Functions: 0 2 0.0 %

          Line data    Source code
       1             : 
       2             : /* Copyright (c) 2011-2014, Stefan Eilemann <eile@eyescale.ch>
       3             :  *                    2011, Carsten Rohn <carsten.rohn@rtt.ag>
       4             :  *               2011-2012, Daniel Nachbaur <danielnachbaur@gmail.com>
       5             :  *
       6             :  * This file is part of Collage <https://github.com/Eyescale/Collage>
       7             :  *
       8             :  * This library is free software; you can redistribute it and/or modify it under
       9             :  * the terms of the GNU Lesser General Public License version 2.1 as published
      10             :  * by the Free Software Foundation.
      11             :  *
      12             :  * This library is distributed in the hope that it will be useful, but WITHOUT
      13             :  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
      14             :  * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
      15             :  * details.
      16             :  *
      17             :  * You should have received a copy of the GNU Lesser General Public License
      18             :  * along with this library; if not, write to the Free Software Foundation, Inc.,
      19             :  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
      20             :  */
      21             : 
      22             : #ifndef CO_QUEUESLAVE_H
      23             : #define CO_QUEUESLAVE_H
      24             : 
      25             : #include <co/api.h>
      26             : #include <co/object.h> // base class
      27             : #include <co/types.h>
      28             : 
      29             : namespace co
      30             : {
      31             : namespace detail
      32             : {
      33             : class QueueSlave;
      34             : }
      35             : 
      36             : /**
      37             :  * The consumer end of a distributed queue.
      38             :  *
      39             :  * One or more instances of this class are mapped to the identifier of the
      40             :  * QueueMaster registered on another node.
      41             :  */
      42             : class QueueSlave : public Object
      43             : {
      44             : public:
      45             :     /**
      46             :      * Construct a new queue consumer.
      47             :      *
      48             :      * The implementation will prefetch items from the queue master to cache
      49             :      * them locally. The prefetchMark determines when new items are requested,
      50             :      * and the prefetchAmount how many items are fetched. Prefetching items
      51             :      * hides the network latency by pipelining the network communication with
      52             :      * the processing, but introduces some imbalance between queue slaves.
      53             :      *
      54             :      * @param prefetchMark the low-water mark for prefetching, or
      55             :      *                     LB_UNDEFINED_UINT32 to use the Global default.
      56             :      * @param prefetchAmount the refill quantity when prefetching, or
      57             :      *                       LB_UNDEFINED_UINT32 to use the Global default.
      58             :      * @version 1.0
      59             :      */
      60             :     CO_API QueueSlave(const uint32_t prefetchMark = LB_UNDEFINED_UINT32,
      61             :                       const uint32_t prefetchAmount = LB_UNDEFINED_UINT32);
      62             : 
      63             :     /** Destruct this queue consumer. @version 1.0 */
      64             :     virtual CO_API ~QueueSlave();
      65             : 
      66             :     /**
      67             :      * Dequeue an item.
      68             :      *
      69             :      * The returned item can deserialize additional data using the DataIStream
      70             :      * operators.
      71             :      *
      72             :      * @param timeout An optional timeout for the operation.
      73             :      * @return an item from the distributed queue, or an invalid item if the
      74             :      *         queue is empty or the operation timed out.
      75             :      * @version 1.0
      76             :      */
      77             :     CO_API ObjectICommand pop(const uint32_t timeout = LB_TIMEOUT_INDEFINITE);
      78             : 
      79             : protected:
      80           0 :     ChangeType getChangeType() const override { return STATIC; }
      81           0 :     void getInstanceData(co::DataOStream&) override { LBDONTCALL }
      82             :     void applyInstanceData(co::DataIStream& is) override;
      83             : 
      84             : private:
      85             :     detail::QueueSlave* const _impl;
      86             : 
      87             :     CO_API void attach(const uint128_t& id, const uint32_t instanceID) override;
      88             : };
      89             : 
      90             : } // co
      91             : 
      92             : #endif // CO_QUEUESLAVE_H

Generated by: LCOV version 1.11