blob: 6bce2c17c82797bbf5dcf82c07cdbc4b20d6452a [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/*
Davide Pesavento11904062022-04-14 22:33:28 -04003 * Copyright (c) 2014-2022, 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
Shuo Chen09f09bb2014-03-18 15:37:11 -070025namespace repo {
26
weijia yuan82cf9142018-10-21 12:25:02 -070027class DeleteHandle : public CommandBaseHandle
Shuo Chen09f09bb2014-03-18 15:37:11 -070028{
Shuo Chen09f09bb2014-03-18 15:37:11 -070029public:
weijia yuan82cf9142018-10-21 12:25:02 -070030 class Error : public CommandBaseHandle::Error
Shuo Chen09f09bb2014-03-18 15:37:11 -070031 {
32 public:
Davide Pesavento11904062022-04-14 22:33:28 -040033 using CommandBaseHandle::Error::Error;
Shuo Chen09f09bb2014-03-18 15:37:11 -070034 };
35
weijia yuan82cf9142018-10-21 12:25:02 -070036 DeleteHandle(Face& face, RepoStorage& storageHandle,
Davide Pesavento11904062022-04-14 22:33:28 -040037 ndn::mgmt::Dispatcher& dispatcher, Scheduler& scheduler,
38 ndn::security::Validator& validator);
Shuo Chen09f09bb2014-03-18 15:37:11 -070039
40private:
41 void
weijia yuan82cf9142018-10-21 12:25:02 -070042 handleDeleteCommand(const Name& prefix, const Interest& interest,
43 const ndn::mgmt::ControlParameters& parameters,
44 const ndn::mgmt::CommandContinuation& done);
Shuo Chen09f09bb2014-03-18 15:37:11 -070045
weijia yuan82cf9142018-10-21 12:25:02 -070046 RepoCommandResponse
Shuo Chen09f09bb2014-03-18 15:37:11 -070047 positiveReply(const Interest& interest, const RepoCommandParameter& parameter,
weijia yuan82cf9142018-10-21 12:25:02 -070048 uint64_t statusCode, uint64_t nDeletedData) const;
49
50 RepoCommandResponse
Davide Pesavento11904062022-04-14 22:33:28 -040051 negativeReply(const Interest& interest, uint64_t statusCode, const std::string& text) const;
Shuo Chen09f09bb2014-03-18 15:37:11 -070052
53 void
weijia yuan82cf9142018-10-21 12:25:02 -070054 processSingleDeleteCommand(const Interest& interest, const RepoCommandParameter& parameter,
55 const ndn::mgmt::CommandContinuation& done) const;
Shuo Chen09f09bb2014-03-18 15:37:11 -070056
57 void
weijia yuan82cf9142018-10-21 12:25:02 -070058 processSegmentDeleteCommand(const Interest& interest, const RepoCommandParameter& parameter,
59 const ndn::mgmt::CommandContinuation& done) const;
Shuo Chen09f09bb2014-03-18 15:37:11 -070060};
61
Alexander Afanasyev39d98072014-05-04 12:46:29 -070062} // namespace repo
Shuo Chen09f09bb2014-03-18 15:37:11 -070063
Alexander Afanasyev39d98072014-05-04 12:46:29 -070064#endif // REPO_HANDLES_DELETE_HANDLE_HPP