]> git.proxmox.com Git - ceph.git/blame - ceph/src/rgw/rgw_amqp.h
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / rgw / rgw_amqp.h
CommitLineData
11fdf7f2 1// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
9f95a23c 2// vim: ts=8 sw=2 smarttab ft=cpp
11fdf7f2
TL
3
4#pragma once
5
6#include <string>
7#include <functional>
f67539c2 8#include <boost/optional.hpp>
11fdf7f2
TL
9#include <boost/smart_ptr/intrusive_ptr.hpp>
10
9f95a23c 11#include "include/common_fwd.h"
eafe8130 12
11fdf7f2
TL
13namespace rgw::amqp {
14// forward declaration of connection object
15struct connection_t;
16
17typedef boost::intrusive_ptr<connection_t> connection_ptr_t;
18
19// required interfaces needed so that connection_t could be used inside boost::intrusive_ptr
20void intrusive_ptr_add_ref(const connection_t* p);
21void intrusive_ptr_release(const connection_t* p);
22
23// the reply callback is expected to get an integer parameter
24// indicating the result, and not to return anything
25typedef std::function<void(int)> reply_callback_t;
26
eafe8130
TL
27// initialize the amqp manager
28bool init(CephContext* cct);
29
30// shutdown the amqp manager
31void shutdown();
32
11fdf7f2 33// connect to an amqp endpoint
f67539c2
TL
34connection_ptr_t connect(const std::string& url, const std::string& exchange, bool mandatory_delivery, bool verify_ssl,
35 boost::optional<const std::string&> ca_location);
11fdf7f2
TL
36
37// publish a message over a connection that was already created
38int publish(connection_ptr_t& conn,
39 const std::string& topic,
40 const std::string& message);
41
42// publish a message over a connection that was already created
43// and pass a callback that will be invoked (async) when broker confirms
44// receiving the message
45int publish_with_confirm(connection_ptr_t& conn,
46 const std::string& topic,
47 const std::string& message,
48 reply_callback_t cb);
49
50// convert the integer status returned from the "publish" function to a string
51std::string status_to_string(int s);
52
53// number of connections
54size_t get_connection_count();
55
56// return the number of messages that were sent
57// to broker, but were not yet acked/nacked/timedout
58size_t get_inflight();
59
60// running counter of successfully queued messages
61size_t get_queued();
62
63// running counter of dequeued messages
64size_t get_dequeued();
65
66// number of maximum allowed connections
67size_t get_max_connections();
68
69// number of maximum allowed inflight messages
70size_t get_max_inflight();
71
72// maximum number of messages in the queue
73size_t get_max_queue();
74
75// disconnect from an amqp broker
76bool disconnect(connection_ptr_t& conn);
77
78}
79