ceph-dovecot / dovecot-ceph-plugin

Dovecot plugin for storing mails in a Ceph cluster
Other
131 stars 23 forks source link

Make RadosDictionary interface independent from librados #265

Open jrse opened 5 years ago

jrse commented 5 years ago
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
/*
 * Copyright (c) 2017-2018 Tallence AG and the authors
 *
 * 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 SRC_LIBRMB_INTERFACES_RADOS_DICTIONARY_INTERFACE_H_
#define SRC_LIBRMB_INTERFACES_RADOS_DICTIONARY_INTERFACE_H_

#include <string>

#include <rados/librados.hpp>

namespace librmb {

/**
 * Rados Dictionary
 *
 * Dictionary module (omap values).
 */
class RadosDictionary {
 public:
  virtual ~RadosDictionary() {}

  virtual const std::string get_full_oid(const std::string& key) = 0;
  virtual const std::string get_shared_oid() = 0;
  virtual const std::string get_private_oid() = 0;

  virtual const std::string& get_oid() = 0;
  virtual const std::string& get_username() = 0;
  virtual const std::string& get_poolname() = 0;

  virtual librados::IoCtx& get_io_ctx(const std::string& key) = 0;
  virtual librados::IoCtx& get_shared_io_ctx() = 0;
  virtual librados::IoCtx& get_private_io_ctx() = 0;

  virtual void remove_completion(librados::AioCompletion* c) = 0;
  virtual void push_back_completion(librados::AioCompletion* c) = 0;
  virtual void wait_for_completions() = 0;

  virtual int get(const std::string& key, std::string* value_r) = 0;
};
}  // namespace librmb

#endif  // SRC_LIBRMB_INTERFACES_RADOS_DICTIONARY_INTERFACE_H_