]>
git.proxmox.com Git - ceph.git/blob - ceph/src/common/OpQueue.h
208d762b37cf96077cb7b05b3444384559dc5c57
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 * Ceph - scalable distributed file system
6 * Copyright (C) 2004-2006 Sage Weil <sage@newdream.net>
8 * This is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License version 2.1, as published by the Free Software
11 * Foundation. See file COPYING.
18 #include "include/msgr.h"
28 * Abstract class for all Op Queues
30 * In order to provide optimized code, be sure to declare all
31 * virutal functions as final in the derived class.
34 template <typename T
, typename K
>
38 // How many Ops are in the queue
39 virtual unsigned length() const = 0;
40 // Ops will be removed f evaluates to true, f may have sideeffects
41 virtual void remove_by_filter(
42 std::function
<bool (T
)> f
) = 0;
43 // Ops of this priority should be deleted immediately
44 virtual void remove_by_class(K k
, std::list
<T
> *out
) = 0;
45 // Enqueue op in the back of the strict queue
46 virtual void enqueue_strict(K cl
, unsigned priority
, T item
) = 0;
47 // Enqueue op in the front of the strict queue
48 virtual void enqueue_strict_front(K cl
, unsigned priority
, T item
) = 0;
49 // Enqueue op in the back of the regular queue
50 virtual void enqueue(K cl
, unsigned priority
, unsigned cost
, T item
) = 0;
51 // Enqueue the op in the front of the regular queue
52 virtual void enqueue_front(K cl
, unsigned priority
, unsigned cost
, T item
) = 0;
53 // Returns if the queue is empty
54 virtual bool empty() const = 0;
55 // Return an op to be dispatch
56 virtual T
dequeue() = 0;
57 // Formatted output of the queue
58 virtual void dump(ceph::Formatter
*f
) const = 0;
59 // Don't leak resources on destruction
60 virtual ~OpQueue() {};