~ubuntu-branches/ubuntu/quantal/ceph/quantal

« back to all changes in this revision

Viewing changes to doc/dev/context.rst

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2012-07-16 09:56:24 UTC
  • mfrom: (0.3.11)
  • mto: This revision was merged to the branch mainline in revision 17.
  • Revision ID: package-import@ubuntu.com-20120716095624-azr2w4hbhei1rxmx
Tags: upstream-0.48
ImportĀ upstreamĀ versionĀ 0.48

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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.