]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | ============= |
2 | CephContext | |
3 | ============= | |
4 | ||
5 | A CephContext represents a single view of the Ceph cluster. It comes complete | |
6 | with a configuration, a set of performance counters (PerfCounters), and a | |
7 | heartbeat map. You can find more information about CephContext in | |
8 | src/common/ceph_context.h. | |
9 | ||
10 | Generally, you will have only one CephContext in your application, called | |
11 | g_ceph_context. However, in library code, it is possible that the library user | |
12 | will initialize multiple CephContexts. For example, this would happen if he | |
13 | called rados_create more than once. | |
14 | ||
15 | A ceph context is required to issue log messages. Why is this? Well, without | |
16 | the CephContext, we would not know which log messages were disabled and which | |
17 | were enabled. The dout() macro implicitly references g_ceph_context, so it | |
18 | can't be used in library code. It is fine to use dout and derr in daemons, but | |
19 | in library code, you must use ldout and lderr, and pass in your own CephContext | |
20 | object. The compiler will enforce this restriction. |