blob: e69938b37f383608a7df481e69d11b9d0119df6c [file] [log] [blame]
Shuo Chen09f09bb2014-03-18 15:37:11 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
3 * Copyright (C) 2014 Regents of the University of California.
4 * See COPYING for copyright and distribution information.
5 */
6
7#ifndef REPO_NDN_HANDLE_DELETE_HANDLE_HPP
8#define REPO_NDN_HANDLE_DELETE_HANDLE_HPP
9
10#include "ndn-handle-common.hpp"
11#include "base-handle.hpp"
12
13namespace repo {
14
15using std::vector;
16
17class DeleteHandle : public BaseHandle
18{
19
20public:
21 class Error : public BaseHandle::Error
22 {
23 public:
24 explicit
25 Error(const std::string& what)
26 : BaseHandle::Error(what)
27 {
28 }
29 };
30
31public:
32 DeleteHandle(Face& face, StorageHandle& storageHandle, KeyChain& keyChain,
33 Scheduler& scheduler, CommandInterestValidator& validator);
34
35 virtual void
36 listen(const Name& prefix);
37
38private:
39 void
40 onInterest(const Name& prefix, const Interest& interest);
41
42 void
43 onRegisterFailed(const Name& prefix, const std::string& reason);
44
45 void
46 onValidated(const shared_ptr<const Interest>& interest, const Name& prefix);
47
48 void
49 onValidationFailed(const shared_ptr<const Interest>& interest, const Name& prefix);
50
51 /**
52 * @todo delete check has not been realized due to the while loop of segmented data deletion.
53 */
54 void
55 onCheckInterest(const Name& prefix, const Interest& interest);
56
57 void
58 onCheckRegisterFailed(const Name& prefix, const std::string& reason);
59
60 void
61 positiveReply(const Interest& interest, const RepoCommandParameter& parameter,
62 uint64_t statusCode, uint64_t nDeletedDatas);
63
64 void
65 negativeReply(const Interest& interest, uint64_t statusCode);
66
67 void
68 processSingleDeleteCommand(const Interest& interest, RepoCommandParameter& parameter);
69
70 void
71 processSelectorDeleteCommand(const Interest& interest, RepoCommandParameter& parameter);
72
73 void
74 processSegmentDeleteCommand(const Interest& interest, RepoCommandParameter& parameter);
75
76private:
77 CommandInterestValidator& m_validator;
78
79};
80
81} //namespace repo
82
83#endif // REPO_NDN_HANDLE_DELETE_HANDLE_HPP