Skip to content

Commit

Permalink
DNM:objclass-sdk: make cls_zlog an optional build
Browse files Browse the repository at this point in the history
Signed-off-by: Neha Ojha <nojha@redhat.com>
  • Loading branch information
neha-ojha committed Apr 21, 2017
1 parent 9123694 commit e844fcf
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 24 deletions.
2 changes: 2 additions & 0 deletions ceph.spec.in
Expand Up @@ -723,6 +723,8 @@ Summary: RADOS object class development kit
Group: Development/Libraries
License: LGPL-2.0
Requires: librados2-devel = %{epoch}:%{version}-%{release}
BuildRequires: protobuf-devel
BuildRequires: protobuf-compiler
%description -n rados-objclass-dev
This package contains libraries and headers needed to develop RADOS object
class plugins.
Expand Down
2 changes: 2 additions & 0 deletions debian/control
Expand Up @@ -45,6 +45,8 @@ Build-Depends: bc,
libudev-dev,
libxml2-dev,
lsb-release,
libprotobuf-dev,
protobuf-compiler,
parted,
pkg-config,
python (>= 2.7),
Expand Down
42 changes: 27 additions & 15 deletions doc/rados/api/objclass-sdk.rst
Expand Up @@ -14,34 +14,46 @@ tree because they do not depend on any internal implementation of `Ceph`. This
project decouples object class development from Ceph and encourages creation
and distribution of object classes as packages.

In order to demonstrate the use of this framework, we have two examples. The
In order to demonstrate the use of this framework, we have two examples. The
first one is called ``cls_sdk``, which is a very simple object class that
makes use of the SDK framework. This object class resides in the ``src/cls``
directory.

The second example is a project called, `ZLog`, which is a strongly
The second example is a project called,
`ZLog <http://noahdesu.github.io/zlog/#>`_ , which is a strongly
consistent shared-log designed to run at high-performance over distributed
storage systems. `ZLog <https://github.com/noahdesu/zlog>`_ makes use of
`Ceph` as a storage backend to provide high performance and reliability.
`ZLog` was earlier dependent on `Ceph's` ``encoding.h`` interface. Now, this
dependency has been eliminated by means of `Google Protocol Buffers`.
Therefore, in order to use `ZLog` with `Ceph's Object Class SDK framework`,
users need to setup the appropriate `Protobuf Packages
<https://github.com/google/protobuf>`_, based on their platform.

storage systems. `ZLog` makes use of `Ceph` as a storage backend to provide
high performance and reliability. `ZLog` was earlier dependent on `Ceph's`
``encoding.h`` interface. Now, this dependency has been eliminated by making
use of serialization and deserialization methods provided by `Google Protocol
Buffers`. `ZLog` can now be built using `Ceph's Object Class SDK framework`
and users only need to setup the appropriate `Protobuf Packages
<https://github.com/google/protobuf>`_, based on their platform. The
``cls_zlog`` plugin resides in the ``src/cls/`` directory as an example of an
object class that can be built by making using of the SDK interface. The
`ZLog` project and unittests reside
`here <https://github.com/noahdesu/zlog>`_. This project is evolving
and we are hoping to see a slightly different version of the plugin soon.

Installing objclass.h
---------------------

The object class interface that enables out-of-tree development of object
classes resides in ``src/include/rados/`` and gets installed with `Ceph`
installation. It can be found in ``<prefix>/include/rados``. ::
installation. After running ``make install``, you should be able to see it
in ``<prefix>/include/rados``. ::

ls /usr/local/include/rados

Using the SDK example
---------------------
Using the SDK examples
----------------------

The ``cls_sdk`` object class resides in ``src/cls/sdk/``. This gets built and
1. The ``cls_sdk`` object class resides in ``src/cls/sdk/``. This gets built and
loaded into Ceph, with the Ceph build process. You can run the
``ceph_test_cls_sdk`` unittest to test this class.
``ceph_test_cls_sdk`` unittest, which resides in ``src/test/cls_sdk/``,
to test this class.

2. As for the ``cls_zlog`` object class, the plugin gets built and loaded into
`Ceph` with its build process. The unittests can be run separately by cloning
and building https://github.com/noahdesu/zlog and following the steps provided
in the documentation.
21 changes: 12 additions & 9 deletions src/cls/CMakeLists.txt
Expand Up @@ -9,15 +9,18 @@ set_target_properties(cls_sdk PROPERTIES VERSION "1.0.0" SOVERSION "1")
install(TARGETS cls_sdk DESTINATION ${cls_dir})

# cls_zlog
find_package(Protobuf REQUIRED)
include_directories(${PROTOBUF_INCLUDE_DIRS})
PROTOBUF_GENERATE_CPP(PROTO_SRCS PROTO_HDRS zlog/zlog.proto)
add_library(cls_zlog SHARED zlog/cls_zlog.cc ${PROTO_SRCS})
target_include_directories(cls_zlog PUBLIC
${PROTOBUF_INCLUDE_DIRS} ${CMAKE_CURRENT_BINARY_DIR})
target_link_libraries(cls_zlog ${PROTOBUF_LIBRARIES})
set_target_properties(cls_zlog PROPERTIES VERSION "1.0.0" SOVERSION "1")
install(TARGETS cls_zlog DESTINATION ${cls_dir})
option(WITH_ZLOG "build ZLog using the object class SDK" ON)
if(WITH_ZLOG)
find_package(Protobuf REQUIRED)
include_directories(${PROTOBUF_INCLUDE_DIRS})
PROTOBUF_GENERATE_CPP(PROTO_SRCS PROTO_HDRS zlog/zlog.proto)
add_library(cls_zlog SHARED zlog/cls_zlog.cc ${PROTO_SRCS})
target_include_directories(cls_zlog PUBLIC
${PROTOBUF_INCLUDE_DIRS} ${CMAKE_CURRENT_BINARY_DIR})
target_link_libraries(cls_zlog ${PROTOBUF_LIBRARIES})
set_target_properties(cls_zlog PROPERTIES VERSION "1.0.0" SOVERSION "1")
install(TARGETS cls_zlog DESTINATION ${cls_dir})
endif(WITH_ZLOG)

# cls_hello
set(cls_hello_srcs hello/cls_hello.cc)
Expand Down

0 comments on commit e844fcf

Please sign in to comment.