Shuo Chen | 09f09bb | 2014-03-18 15:37:11 -0700 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
Alexander Afanasyev | c0e2658 | 2017-08-13 21:16:49 -0400 | [diff] [blame] | 2 | /* |
weijia yuan | 82cf914 | 2018-10-21 12:25:02 -0700 | [diff] [blame^] | 3 | * Copyright (c) 2014-2018, Regents of the University of California. |
Alexander Afanasyev | e1e6f2a | 2014-04-25 11:28:12 -0700 | [diff] [blame] | 4 | * |
| 5 | * This file is part of NDN repo-ng (Next generation of NDN repository). |
| 6 | * See AUTHORS.md for complete list of repo-ng authors and contributors. |
| 7 | * |
| 8 | * repo-ng is free software: you can redistribute it and/or modify it under the terms |
| 9 | * of the GNU General Public License as published by the Free Software Foundation, |
| 10 | * either version 3 of the License, or (at your option) any later version. |
| 11 | * |
| 12 | * repo-ng is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
| 13 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
| 14 | * PURPOSE. See the GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License along with |
| 17 | * repo-ng, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>. |
Shuo Chen | 09f09bb | 2014-03-18 15:37:11 -0700 | [diff] [blame] | 18 | */ |
| 19 | |
Alexander Afanasyev | 39d9807 | 2014-05-04 12:46:29 -0700 | [diff] [blame] | 20 | #ifndef REPO_HANDLES_DELETE_HANDLE_HPP |
| 21 | #define REPO_HANDLES_DELETE_HANDLE_HPP |
Shuo Chen | 09f09bb | 2014-03-18 15:37:11 -0700 | [diff] [blame] | 22 | |
weijia yuan | 82cf914 | 2018-10-21 12:25:02 -0700 | [diff] [blame^] | 23 | #include "command-base-handle.hpp" |
| 24 | |
| 25 | #include <ndn-cxx/mgmt/dispatcher.hpp> |
Alexander Afanasyev | b7e8a81 | 2014-07-23 01:36:47 -0700 | [diff] [blame] | 26 | |
Shuo Chen | 09f09bb | 2014-03-18 15:37:11 -0700 | [diff] [blame] | 27 | namespace repo { |
| 28 | |
weijia yuan | 82cf914 | 2018-10-21 12:25:02 -0700 | [diff] [blame^] | 29 | class DeleteHandle : public CommandBaseHandle |
Shuo Chen | 09f09bb | 2014-03-18 15:37:11 -0700 | [diff] [blame] | 30 | { |
| 31 | |
| 32 | public: |
weijia yuan | 82cf914 | 2018-10-21 12:25:02 -0700 | [diff] [blame^] | 33 | class Error : public CommandBaseHandle::Error |
Shuo Chen | 09f09bb | 2014-03-18 15:37:11 -0700 | [diff] [blame] | 34 | { |
| 35 | public: |
| 36 | explicit |
| 37 | Error(const std::string& what) |
weijia yuan | 82cf914 | 2018-10-21 12:25:02 -0700 | [diff] [blame^] | 38 | : CommandBaseHandle::Error(what) |
Shuo Chen | 09f09bb | 2014-03-18 15:37:11 -0700 | [diff] [blame] | 39 | { |
| 40 | } |
| 41 | }; |
| 42 | |
| 43 | public: |
weijia yuan | 82cf914 | 2018-10-21 12:25:02 -0700 | [diff] [blame^] | 44 | DeleteHandle(Face& face, RepoStorage& storageHandle, |
| 45 | ndn::mgmt::Dispatcher& dispatcher, Scheduler& scheduler, Validator& validator); |
Shuo Chen | 09f09bb | 2014-03-18 15:37:11 -0700 | [diff] [blame] | 46 | |
| 47 | private: |
| 48 | void |
weijia yuan | 82cf914 | 2018-10-21 12:25:02 -0700 | [diff] [blame^] | 49 | handleDeleteCommand(const Name& prefix, const Interest& interest, |
| 50 | const ndn::mgmt::ControlParameters& parameters, |
| 51 | const ndn::mgmt::CommandContinuation& done); |
Shuo Chen | 09f09bb | 2014-03-18 15:37:11 -0700 | [diff] [blame] | 52 | |
weijia yuan | 82cf914 | 2018-10-21 12:25:02 -0700 | [diff] [blame^] | 53 | RepoCommandResponse |
Shuo Chen | 09f09bb | 2014-03-18 15:37:11 -0700 | [diff] [blame] | 54 | positiveReply(const Interest& interest, const RepoCommandParameter& parameter, |
weijia yuan | 82cf914 | 2018-10-21 12:25:02 -0700 | [diff] [blame^] | 55 | uint64_t statusCode, uint64_t nDeletedData) const; |
| 56 | |
| 57 | RepoCommandResponse |
| 58 | negativeReply(const Interest& interest, uint64_t statusCode, const std::string text) const; |
Shuo Chen | 09f09bb | 2014-03-18 15:37:11 -0700 | [diff] [blame] | 59 | |
| 60 | void |
weijia yuan | 82cf914 | 2018-10-21 12:25:02 -0700 | [diff] [blame^] | 61 | processSingleDeleteCommand(const Interest& interest, const RepoCommandParameter& parameter, |
| 62 | const ndn::mgmt::CommandContinuation& done) const; |
Shuo Chen | 09f09bb | 2014-03-18 15:37:11 -0700 | [diff] [blame] | 63 | |
| 64 | void |
weijia yuan | 82cf914 | 2018-10-21 12:25:02 -0700 | [diff] [blame^] | 65 | processSelectorDeleteCommand(const Interest& interest, const RepoCommandParameter& parameter, |
| 66 | const ndn::mgmt::CommandContinuation& done) const; |
Shuo Chen | 09f09bb | 2014-03-18 15:37:11 -0700 | [diff] [blame] | 67 | |
| 68 | void |
weijia yuan | 82cf914 | 2018-10-21 12:25:02 -0700 | [diff] [blame^] | 69 | processSegmentDeleteCommand(const Interest& interest, const RepoCommandParameter& parameter, |
| 70 | const ndn::mgmt::CommandContinuation& done) const; |
Shuo Chen | 09f09bb | 2014-03-18 15:37:11 -0700 | [diff] [blame] | 71 | }; |
| 72 | |
Alexander Afanasyev | 39d9807 | 2014-05-04 12:46:29 -0700 | [diff] [blame] | 73 | } // namespace repo |
Shuo Chen | 09f09bb | 2014-03-18 15:37:11 -0700 | [diff] [blame] | 74 | |
Alexander Afanasyev | 39d9807 | 2014-05-04 12:46:29 -0700 | [diff] [blame] | 75 | #endif // REPO_HANDLES_DELETE_HANDLE_HPP |