Verified Commit fa27234c authored by Alberto Miranda's avatar Alberto Miranda ♨️
Browse files

First implementation of staging API

parent 1da7ece4
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -242,6 +242,9 @@ add_subdirectory(src/daemon)
# Client library
add_subdirectory(src/client)

# APIs
add_subdirectory(src/api)

option(GKFS_BUILD_TESTS "Build GekkoFS self tests" OFF)

include(CMakeDependentOption)
+57 −0
Original line number Diff line number Diff line
/*
  Copyright 2018-2021, Barcelona Supercomputing Center (BSC), Spain
  Copyright 2015-2021, Johannes Gutenberg Universitaet Mainz, Germany

  This software was partially supported by the
  EC H2020 funded project NEXTGenIO (Project ID: 671951, www.nextgenio.eu).

  This software was partially supported by the
  ADA-FS project under the SPPEXA project funded by the DFG.

  This file is part of GekkoFS.

  GekkoFS is free software: you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation, either version 3 of the License, or
  (at your option) any later version.

  GekkoFS is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with GekkoFS.  If not, see <https://www.gnu.org/licenses/>.

  SPDX-License-Identifier: GPL-3.0-or-later
*/

#ifndef GEKKOFS_API_FS_HPP
#define GEKKOFS_API_FS_HPP

#include <memory>

namespace gkfs::api::fs {

class connection {

public:
    connection();
    connection(const std::string& hostfile);
    ~connection();

    connection(connection&& rhs) noexcept = default;
    connection&
    operator=(connection&& rhs) noexcept = default;
    connection(const connection& other) = delete;
    connection&
    operator=(const connection& rhs) = delete;

private:
    class impl;
    std::unique_ptr<impl> pimpl_;
};

} // namespace gkfs::api::fs

#endif // GEKKOFS_API_FS_HPP
+36 −0
Original line number Diff line number Diff line
/*
  Copyright 2018-2021, Barcelona Supercomputing Center (BSC), Spain
  Copyright 2015-2021, Johannes Gutenberg Universitaet Mainz, Germany

  This software was partially supported by the
  EC H2020 funded project NEXTGenIO (Project ID: 671951, www.nextgenio.eu).

  This software was partially supported by the
  ADA-FS project under the SPPEXA project funded by the DFG.

  This file is part of GekkoFS.

  GekkoFS is free software: you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation, either version 3 of the License, or
  (at your option) any later version.

  GekkoFS is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with GekkoFS.  If not, see <https://www.gnu.org/licenses/>.

  SPDX-License-Identifier: GPL-3.0-or-later
*/

#ifndef GEKKOFS_API_HPP
#define GEKKOFS_API_HPP

#include "info.hpp"
#include "connection.hpp"
#include "staging.hpp"

#endif // GEKKOFS_API_HPP

include/api/info.hpp

0 → 100644
+89 −0
Original line number Diff line number Diff line
/*
  Copyright 2018-2021, Barcelona Supercomputing Center (BSC), Spain
  Copyright 2015-2021, Johannes Gutenberg Universitaet Mainz, Germany

  This software was partially supported by the
  EC H2020 funded project NEXTGenIO (Project ID: 671951, www.nextgenio.eu).

  This software was partially supported by the
  ADA-FS project under the SPPEXA project funded by the DFG.

  This file is part of GekkoFS.

  GekkoFS is free software: you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation, either version 3 of the License, or
  (at your option) any later version.

  GekkoFS is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with GekkoFS.  If not, see <https://www.gnu.org/licenses/>.

  SPDX-License-Identifier: GPL-3.0-or-later
*/

#ifndef GEKKOFS_INFO_HPP
#define GEKKOFS_INFO_HPP

#include <memory>

namespace gkfs::api::fs {

// TODO: identical to preload_context.hpp FsConfig. Refactor?
struct config {
    // configurable metadata
    bool atime_state_;
    bool mtime_state_;
    bool ctime_state_;
    bool link_cnt_state_;
    bool blocks_state_;

    uid_t uid_;
    gid_t gid_;

    std::string rootdir_;
    std::string mountdir_;
};

class host {
public:
    host();
    ~host();
    host(const std::string& hostname, const std::string& uri);
    host(host&& rhs) noexcept;
    host(const host& other);

    host&
    operator=(host&& rhs) noexcept;
    host&
    operator=(const host& other);

    void
    swap(host& other);

    std::string
    hostname() const;
    std::string
    uri() const;

private:
    class impl;
    std::unique_ptr<impl> pimpl_;
};

} // namespace gkfs::api::fs

namespace gkfs::api::rpc {

struct config {
    std::string protocol_string_;
    bool auto_sm_enabled_{false};
};

} // namespace gkfs::api::rpc

#endif // GEKKOFS_INFO_HPP
+47 −0
Original line number Diff line number Diff line
/*
  Copyright 2018-2021, Barcelona Supercomputing Center (BSC), Spain
  Copyright 2015-2021, Johannes Gutenberg Universitaet Mainz, Germany

  This software was partially supported by the
  EC H2020 funded project NEXTGenIO (Project ID: 671951, www.nextgenio.eu).

  This software was partially supported by the
  ADA-FS project under the SPPEXA project funded by the DFG.

  This file is part of GekkoFS.

  GekkoFS is free software: you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation, either version 3 of the License, or
  (at your option) any later version.

  GekkoFS is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with GekkoFS.  If not, see <https://www.gnu.org/licenses/>.

  SPDX-License-Identifier: GPL-3.0-or-later
*/

#ifndef GEKKOFS_API_STAGING_HPP
#define GEKKOFS_API_STAGING_HPP

#include <filesystem>

namespace gkfs::api::staging {

void
put(const std::filesystem::path& pathname, const void* buf, size_t count,
    off_t offset);

void
put(const gkfs::api::fs::connection& conn,
    const std::filesystem::path& pathname, const void* buf, size_t count,
    off_t offset);

} // namespace gkfs::api::staging

#endif // GEKKOFS_API_STAGING_HPP
Loading