]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
hypertable: added skeleton .h and .cc CephBroker
authorGreg Farnum <gregf@hq.newdream.net>
Wed, 8 Jul 2009 19:00:38 +0000 (12:00 -0700)
committerGreg Farnum <gregf@hq.newdream.net>
Thu, 9 Jul 2009 18:40:38 +0000 (11:40 -0700)
These are meant to be built in Hypertable, obviously.

src/client/hypertable/CephBroker.cc [new file with mode: 0644]
src/client/hypertable/CephBroker.h [new file with mode: 0644]

diff --git a/src/client/hypertable/CephBroker.cc b/src/client/hypertable/CephBroker.cc
new file mode 100644 (file)
index 0000000..d3c4998
--- /dev/null
@@ -0,0 +1,120 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
+/*
+ * Ceph - scalable distributed file system
+ *
+ * Copyright (C) 2004-2006 Sage Weil <sage@newdream.net>
+ *
+ * This is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software 
+ * Foundation.  See file COPYING.
+ * 
+ */
+
+#include "Common/Compat.h"
+#include <cerrno>
+
+extern "C" {
+#include <fcntl.h>
+#include <poll.h>
+#include <sys/types.h>
+#include <sys/uio.h>
+#include <unistd.h>
+}
+
+#include "Common/FileUtils.h"
+#include "Common/System.h"
+#include "CephBroker.h"
+
+using namespace Hypertable;
+
+atomic_t CephBroker::ms_next_fd = ATOMIC_INIT(0);
+
+CephBroker::CephBroker(PropertiesPtr &cfg) {
+  m_verbose = cfg->get_bool("Hypertable.Verbose");
+  /* do other stuff */
+}
+
+CephBroker::~CephBroker() { /* destroy client? */}
+
+void CephBroker::open(ResponseCallbackOpen *cb, const char *fname, uint32_t bufsz)
+{
+
+}
+
+void CephBroker::create(ResponseCallbackOpen *cb, const char *fname, bool overwrite,
+       int32_t bufsz, int16_t replication, int64_t blksz){
+
+}
+
+void CephBroker::close(ResponseCallback *cb, uint32_t fd){
+
+}
+
+void CephBroker::read(ResponseCallbackRead *cb, uint32_t fd, uint32_t amount){
+
+}
+
+void CephBroker::append(ResponseCallbackAppend *cb, uint32_t fd,
+                   uint32_t amount, const void CephBroker::*data, bool sync)
+{
+
+}
+void CephBroker::seek(ResponseCallback *cb, uint32_t fd, uint64_t offset){
+
+}
+
+void CephBroker::remove(ResponseCallback *cb, const char *fname){
+
+}
+
+void CephBroker::length(ResponseCallbackLength *cb, const char *fname){
+
+}
+
+void CephBroker::pread(ResponseCallbackRead *cb, uint32_t fd, uint64_t offset,
+                  uint32_t amount){
+
+}
+
+void CephBroker::mkdirs(ResponseCallback *cb, const char *dname){
+
+}
+
+void CephBroker::rmdir(ResponseCallback *cb, const char *dname){
+
+}
+
+void CephBroker::flush(ResponseCallback *cb, uint32_t fd){
+
+}
+
+void CephBroker::status(ResponseCallback *cb){
+
+}
+
+void CephBroker::shutdown(ResponseCallback *cb){
+
+}
+
+void CephBroker::readdir(ResponseCallbackReaddir *cb, const char *dname){
+
+}
+
+void CephBroker::exists(ResponseCallbackExists *cb, const char *fname){
+
+}
+
+void CephBroker::rename(ResponseCallback *cb, const char *src, const char *dst){
+
+}
+
+void CephBroker::debug(ResponseCallback *, int32_t command,
+                  StaticBuffer &serialized_parameters){
+
+}
+
+void CephBroker::report_error(ResponseCallback *cb, int error) {
+
+}
diff --git a/src/client/hypertable/CephBroker.h b/src/client/hypertable/CephBroker.h
new file mode 100644 (file)
index 0000000..38d17e0
--- /dev/null
@@ -0,0 +1,95 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
+/*
+ * Ceph - scalable distributed file system
+ *
+ * Copyright (C) 2004-2006 Sage Weil <sage@newdream.net>
+ *
+ * This is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software 
+ * Foundation.  See file COPYING.
+ * 
+ */
+
+#ifndef HYPERTABLE_CEPHBROKER_H
+#define HYPERTABLE_CEPHBROKER_H
+
+extern "C" {
+#include "libceph.h"
+#include <unistd.h>
+}
+
+#include "Common/String.h"
+#include "Common/atomic.h"
+#include "Common/Properties.h"
+
+#include "DfsBroker/Lib/Broker.h"
+
+namespace Hypertable {
+  using namespace DfsBroker;
+  /**
+   *
+   */
+  class OpenFileDataCeph : public OpenFileData {
+  public:
+    OpenFileDataCeph(int _fd, int _flags) : fd(_fd), flags(_flags) {}
+    virtual ~OpenFileDataCeph() { }
+    int fd;
+    int flags;
+  };
+
+  /**
+   *
+   */
+  class OpenFileDataCephPointer : public OpenFileDataPtr {
+  public:
+    OpenFileDataCephPtr() : OpenFileDataPtr() { }
+    OpenFileDataCephPtr(OpenFileDataCeph *ofdl) : OpenFileDataPtr(ofdl, true) { }
+    OpenFileDataCeph *operator->() const { return (OpenFileDataCeph *)get(); }
+  };
+
+  /**
+   *
+   */
+  class CephBroker : public DfsBroker::Broker {
+  public:
+    CephBroker(PropertiesPtr& cfg);
+    virtual ~CephBroker();
+
+    virtual void open(ResponseCallbackOpen *cb, const char *fname,
+                      uint32_t bufsz);
+    virtual void
+    create(ResponseCallbackOpen *cb, const char *fname, bool overwrite,
+           int32_t bufsz, int16_t replication, int64_t blksz);
+    virtual void close(ResponseCallback *cb, uint32_t fd);
+    virtual void read(ResponseCallbackRead *cb, uint32_t fd, uint32_t amount);
+    virtual void append(ResponseCallbackAppend *cb, uint32_t fd,
+                        uint32_t amount, const void *data, bool sync);
+    virtual void seek(ResponseCallback *cb, uint32_t fd, uint64_t offset);
+    virtual void remove(ResponseCallback *cb, const char *fname);
+    virtual void length(ResponseCallbackLength *cb, const char *fname);
+    virtual void pread(ResponseCallbackRead *cb, uint32_t fd, uint64_t offset,
+                       uint32_t amount);
+    virtual void mkdirs(ResponseCallback *cb, const char *dname);
+    virtual void rmdir(ResponseCallback *cb, const char *dname);
+    virtual void flush(ResponseCallback *cb, uint32_t fd);
+    virtual void status(ResponseCallback *cb);
+    virtual void shutdown(ResponseCallback *cb);
+    virtual void readdir(ResponseCallbackReaddir *cb, const char *dname);
+    virtual void exists(ResponseCallbackExists *cb, const char *fname);
+    virtual void rename(ResponseCallback *cb, const char *src, const char *dst);
+    virtual void debug(ResponseCallback *, int32_t command,
+                       StaticBuffer &serialized_parameters);
+
+  private:
+    static atomic_t ms_next_fd;
+
+    virtual void report_error(ResponseCallback *cb, int error);
+
+    bool m_verbose;
+    String m_root_dir;
+  };
+}
+
+#endif //HYPERTABLE_CEPH_BROKER_H