blob: fbb25d388ec44a85073da5f113e54ca0f3f74fe5 [file] [log] [blame]
Shuo Chen09f09bb2014-03-18 15:37:11 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
Alexander Afanasyevc0e26582017-08-13 21:16:49 -04002/*
weijia yuan82cf9142018-10-21 12:25:02 -07003 * Copyright (c) 2014-2018, Regents of the University of California.
Alexander Afanasyeve1e6f2a2014-04-25 11:28:12 -07004 *
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 Chen09f09bb2014-03-18 15:37:11 -070018 */
19
Alexander Afanasyev39d98072014-05-04 12:46:29 -070020#ifndef REPO_HANDLES_DELETE_HANDLE_HPP
21#define REPO_HANDLES_DELETE_HANDLE_HPP
Shuo Chen09f09bb2014-03-18 15:37:11 -070022
weijia yuan82cf9142018-10-21 12:25:02 -070023#include "command-base-handle.hpp"
24
25#include <ndn-cxx/mgmt/dispatcher.hpp>
Alexander Afanasyevb7e8a812014-07-23 01:36:47 -070026
Shuo Chen09f09bb2014-03-18 15:37:11 -070027namespace repo {
28
weijia yuan82cf9142018-10-21 12:25:02 -070029class DeleteHandle : public CommandBaseHandle
Shuo Chen09f09bb2014-03-18 15:37:11 -070030{
31
32public:
weijia yuan82cf9142018-10-21 12:25:02 -070033 class Error : public CommandBaseHandle::Error
Shuo Chen09f09bb2014-03-18 15:37:11 -070034 {
35 public:
36 explicit
37 Error(const std::string& what)
weijia yuan82cf9142018-10-21 12:25:02 -070038 : CommandBaseHandle::Error(what)
Shuo Chen09f09bb2014-03-18 15:37:11 -070039 {
40 }
41 };
42
43public:
weijia yuan82cf9142018-10-21 12:25:02 -070044 DeleteHandle(Face& face, RepoStorage& storageHandle,
45 ndn::mgmt::Dispatcher& dispatcher, Scheduler& scheduler, Validator& validator);
Shuo Chen09f09bb2014-03-18 15:37:11 -070046
47private:
48 void
weijia yuan82cf9142018-10-21 12:25:02 -070049 handleDeleteCommand(const Name& prefix, const Interest& interest,
50 const ndn::mgmt::ControlParameters& parameters,
51 const ndn::mgmt::CommandContinuation& done);
Shuo Chen09f09bb2014-03-18 15:37:11 -070052
weijia yuan82cf9142018-10-21 12:25:02 -070053 RepoCommandResponse
Shuo Chen09f09bb2014-03-18 15:37:11 -070054 positiveReply(const Interest& interest, const RepoCommandParameter& parameter,
weijia yuan82cf9142018-10-21 12:25:02 -070055 uint64_t statusCode, uint64_t nDeletedData) const;
56
57 RepoCommandResponse
58 negativeReply(const Interest& interest, uint64_t statusCode, const std::string text) const;
Shuo Chen09f09bb2014-03-18 15:37:11 -070059
60 void
weijia yuan82cf9142018-10-21 12:25:02 -070061 processSingleDeleteCommand(const Interest& interest, const RepoCommandParameter& parameter,
62 const ndn::mgmt::CommandContinuation& done) const;
Shuo Chen09f09bb2014-03-18 15:37:11 -070063
64 void
weijia yuan82cf9142018-10-21 12:25:02 -070065 processSelectorDeleteCommand(const Interest& interest, const RepoCommandParameter& parameter,
66 const ndn::mgmt::CommandContinuation& done) const;
Shuo Chen09f09bb2014-03-18 15:37:11 -070067
68 void
weijia yuan82cf9142018-10-21 12:25:02 -070069 processSegmentDeleteCommand(const Interest& interest, const RepoCommandParameter& parameter,
70 const ndn::mgmt::CommandContinuation& done) const;
Shuo Chen09f09bb2014-03-18 15:37:11 -070071};
72
Alexander Afanasyev39d98072014-05-04 12:46:29 -070073} // namespace repo
Shuo Chen09f09bb2014-03-18 15:37:11 -070074
Alexander Afanasyev39d98072014-05-04 12:46:29 -070075#endif // REPO_HANDLES_DELETE_HANDLE_HPP