bes Updated for version 3.21.1
The Backend Server (BES) is the lower two tiers of the Hyrax data server
NgapRequestHandler.h
1// NgapContainer.cc
2
3// -*- mode: c++; c-basic-offset:4 -*-
4
5// This file is part of ngap_module, A C++ module that can be loaded in to
6// the OPeNDAP Back-End Server (BES) and is able to handle remote requests.
7
8// Copyright (c) 2020 OPeNDAP, Inc.
9// Author: Nathan Potter <ndp@opendap.org>
10//
11// This library is free software; you can redistribute it and/or
12// modify it under the terms of the GNU Lesser General Public
13// License as published by the Free Software Foundation; either
14// version 2.1 of the License, or (at your option) any later version.
15//
16// This library is distributed in the hope that it will be useful,
17// but WITHOUT ANY WARRANTY; without even the implied warranty of
18// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19// Lesser General Public License for more details.
20//
21// You should have received a copy of the GNU Lesser General Public
22// License along with this library; if not, write to the Free Software
23// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24//
25// You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
26// Authors:
27// ndp Nathan Potter <ndp@opendap.org>
28
29#ifndef I_NgapRequestHandler_H
30#define I_NgapRequestHandler_H
31
32#include <string>
33#include <ostream>
34#include <queue>
35#include <unordered_map>
36
37#include "MemoryCache.h"
38#include "FileCache.h"
39#include "BESRequestHandler.h"
40
41namespace ngap {
42
43class NgapRequestHandler : public BESRequestHandler {
44
45 static unsigned int d_cmr_cache_size_items; // max number of entries
46 static unsigned int d_cmr_cache_purge_items; // remove this many during purge
47
48 static bool d_use_cmr_cache;
49 static MemoryCache<std::string> d_cmr_mem_cache;
50
51 static unsigned int d_dmrpp_mem_cache_size_items; // max number of entries
52 static unsigned int d_dmrpp_mem_cache_purge_items; // remove this many during purge
53
54 static bool d_use_dmrpp_cache;
55 static MemoryCache<std::string> d_dmrpp_mem_cache;
56
57 static long long d_dmrpp_file_cache_size_mb;
58 static long long d_dmrpp_file_cache_purge_size_mb;
59 static std::string d_dmrpp_file_cache_dir;
60
61 static FileCache d_dmrpp_file_cache;
62
63 friend class NgapContainer; // give NgapContainer access to the cache parameters
64 friend class NgapOwnedContainer; // give NgapOwnedContainer access to the cache parameters. jhrg 4/29/24
65 friend class NgapContainerTest;
66 friend class NgapOwnedContainerTest;
67 friend class NgapRequestHandlerTest;
68
69public:
70 explicit NgapRequestHandler(const std::string &name);
71
72 NgapRequestHandler() = delete;
73
74 ~NgapRequestHandler() override = default;
75
76 NgapRequestHandler(const NgapRequestHandler &src) = delete;
77
78 NgapRequestHandler &operator=(const NgapRequestHandler &rhs) = delete;
79
80 void dump(std::ostream &strm) const override;
81
82 static bool ngap_build_vers(BESDataHandlerInterface &dhi);
83
84 static bool ngap_build_help(BESDataHandlerInterface &dhi);
85};
86
87} // namespace ngap
88
89#endif // NgapRequestHandler.h
Structure storing information used by the BES to handle the request.
Implementation of a caching mechanism for files.
Definition FileCache.h:122
A simple memory cache.
Definition MemoryCache.h:64
void dump(std::ostream &strm) const override
dumps information about this object