mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-29 15:35:50 +00:00
Remove unused sitefiles module
This commit is contained in:
@@ -581,7 +581,6 @@ for toolchain in all_toolchains:
|
||||
'resource.cpp',
|
||||
'rpcx.cpp',
|
||||
'server.cpp',
|
||||
'sitefiles.cpp',
|
||||
'validators.cpp',
|
||||
'websocket.cpp',
|
||||
)
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
#include <ripple/protocol/STParsedJSON.h>
|
||||
#include <ripple/rpc/Manager.h>
|
||||
#include <ripple/server/make_ServerHandler.h>
|
||||
#include <ripple/sitefiles/Sitefiles.h>
|
||||
#include <ripple/validators/make_Manager.h>
|
||||
#include <beast/asio/io_latency_probe.h>
|
||||
#include <beast/module/core/thread/DeadlineTimer.h>
|
||||
@@ -172,7 +171,6 @@ public:
|
||||
|
||||
// These are Stoppable-related
|
||||
std::unique_ptr <JobQueue> m_jobQueue;
|
||||
std::unique_ptr <SiteFiles::Manager> m_siteFiles;
|
||||
std::unique_ptr <RPC::Manager> m_rpcManager;
|
||||
// VFALCO TODO Make OrderBookDB abstract
|
||||
OrderBookDB m_orderBookDB;
|
||||
@@ -282,9 +280,6 @@ public:
|
||||
// Anything which calls addJob must be a descendant of the JobQueue
|
||||
//
|
||||
|
||||
, m_siteFiles (SiteFiles::Manager::New (
|
||||
*this, m_logs.journal("SiteFiles")))
|
||||
|
||||
, m_rpcManager (RPC::make_Manager (m_logs.journal("RPCManager")))
|
||||
|
||||
, m_orderBookDB (*m_jobQueue)
|
||||
@@ -387,11 +382,6 @@ public:
|
||||
return *m_rpcManager;
|
||||
}
|
||||
|
||||
SiteFiles::Manager& getSiteFiles()
|
||||
{
|
||||
return *m_siteFiles;
|
||||
}
|
||||
|
||||
LocalCredentials& getLocalCredentials ()
|
||||
{
|
||||
return m_localCredentials ;
|
||||
|
||||
@@ -30,7 +30,6 @@ namespace boost { namespace asio { class io_service; } }
|
||||
|
||||
namespace ripple {
|
||||
|
||||
namespace SiteFiles { class Manager; }
|
||||
namespace Validators { class Manager; }
|
||||
namespace Resource { class Manager; }
|
||||
namespace NodeStore { class Database; }
|
||||
@@ -97,7 +96,6 @@ public:
|
||||
virtual FullBelowCache& getFullBelowCache () = 0;
|
||||
virtual JobQueue& getJobQueue () = 0;
|
||||
virtual RPC::Manager& getRPCManager () = 0;
|
||||
virtual SiteFiles::Manager& getSiteFiles () = 0;
|
||||
virtual NodeCache& getTempNodeCache () = 0;
|
||||
virtual TreeNodeCache& getTreeNodeCache () = 0;
|
||||
virtual SLECache& getSLECache () = 0;
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#define RIPPLE_PEERFINDER_MANAGER_H_INCLUDED
|
||||
|
||||
#include <ripple/peerfinder/Slot.h>
|
||||
#include <ripple/sitefiles/Sitefiles.h>
|
||||
#include <beast/chrono/abstract_clock.h>
|
||||
#include <beast/module/core/files/File.h>
|
||||
#include <boost/asio/ip/tcp.hpp>
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
# SiteFiles
|
||||
|
||||
A central module that manages the download of local and remote ripple.txt files
|
||||
and allows other code modules to access the sections.
|
||||
@@ -1,137 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of rippled: https://github.com/ripple/rippled
|
||||
Copyright (c) 2012, 2013 Ripple Labs Inc.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef RIPPLE_SITEFILES_SITEFILES_H_INCLUDED
|
||||
#define RIPPLE_SITEFILES_SITEFILES_H_INCLUDED
|
||||
|
||||
#include <beast/threads/Stoppable.h>
|
||||
#include <beast/utility/PropertyStream.h>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace ripple {
|
||||
namespace SiteFiles {
|
||||
|
||||
/** A Site File section.
|
||||
Each section has a name, an associative map of key/value pairs,
|
||||
and a vector of zero or more free-form data strings.
|
||||
*/
|
||||
// VFALCO NOTE This could use ripple::Section instead, which
|
||||
// seems to offer the same functionality
|
||||
//
|
||||
class Section
|
||||
{
|
||||
public:
|
||||
typedef std::map <std::string, std::string> MapType;
|
||||
typedef std::vector <std::string> DataType;
|
||||
|
||||
Section(int = 0); // dummy argument for emplace()
|
||||
|
||||
// Observers
|
||||
std::string const& get (std::string const& key) const;
|
||||
std::string const& operator[] (std::string const& key) const;
|
||||
DataType const& data() const;
|
||||
|
||||
// Modifiers
|
||||
void set (std::string const& key, std::string const& value);
|
||||
std::string& operator[] (std::string const& key);
|
||||
void push_back (std::string const& data);
|
||||
|
||||
private:
|
||||
MapType m_map;
|
||||
DataType m_data;
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
class SiteFile
|
||||
{
|
||||
public:
|
||||
SiteFile (int = 0); // dummy argument for emplace
|
||||
|
||||
typedef std::map <std::string, Section> SectionsType;
|
||||
|
||||
/** Retrieve a section by name. */
|
||||
/** @{ */
|
||||
Section const& get (std::string const& name) const;
|
||||
Section const& operator[] (std::string const& key) const;
|
||||
/** @} */
|
||||
|
||||
/** Retrieve or create a section with the specified name. */
|
||||
Section& insert (std::string const& name);
|
||||
|
||||
private:
|
||||
SectionsType m_sections;
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** SiteFiles listeners receive notifications on new files and sections.
|
||||
Calls are made on an implementation-defined, unspecified thread.
|
||||
Subclasses implementations should not perform blocking i/o or take
|
||||
a long time.
|
||||
*/
|
||||
class Listener
|
||||
{
|
||||
public:
|
||||
/** Called every time a new site file is retrieved.
|
||||
Notifications for Site files retrieved before a listener was added will
|
||||
be sent at the time the listener is added.
|
||||
*/
|
||||
virtual void onSiteFileFetch (
|
||||
std::string const& name, SiteFile const& siteFile) = 0;
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** Fetches and maintains a collection of ripple.txt files from domains. */
|
||||
class Manager
|
||||
: public beast::Stoppable
|
||||
, public beast::PropertyStream::Source
|
||||
{
|
||||
protected:
|
||||
explicit Manager (Stoppable& parent);
|
||||
|
||||
public:
|
||||
/** Create a new Manager. */
|
||||
static Manager* New (beast::Stoppable& parent, beast::Journal journal);
|
||||
|
||||
/** Destroy the object.
|
||||
Any pending fetch operations are aborted.
|
||||
*/
|
||||
virtual ~Manager() = default;
|
||||
|
||||
/** Adds a listener. */
|
||||
virtual void addListener (Listener& listener) = 0;
|
||||
|
||||
/** Remove a listener. */
|
||||
virtual void removeListener (Listener& listener) = 0;
|
||||
|
||||
/** Add a URL leading to a ripple.txt file.
|
||||
This call does not block. The URL will be fetched asynchronously.
|
||||
Parsing errors are reported to the journal.
|
||||
*/
|
||||
virtual void addURL (std::string const& urlstr) = 0;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,308 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of rippled: https://github.com/ripple/rippled
|
||||
Copyright (c) 2012, 2013 Ripple Labs Inc.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef RIPPLE_SITEFILES_LOGIC_H_INCLUDED
|
||||
#define RIPPLE_SITEFILES_LOGIC_H_INCLUDED
|
||||
|
||||
#include <beast/http/URL.h>
|
||||
#include <beast/module/asio/HTTPResponse.h> // DEPRECATED
|
||||
#include <boost/regex.hpp>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <set>
|
||||
|
||||
namespace ripple {
|
||||
namespace SiteFiles {
|
||||
|
||||
/*
|
||||
Config file format:
|
||||
|
||||
Syntactically a series of lines, where line has this format:
|
||||
[ <vertical whitespace> ] <anything> ( <vertical-whitespace> OR <end-of-file> )
|
||||
|
||||
Semantically a series of of zero or more sections, where each section
|
||||
has a name and optional data. Specifically, the format:
|
||||
( <start-of-file> OR <header> ) <data>
|
||||
|
||||
Data appearing before the first header goes into the section whose
|
||||
name is the empty string "".
|
||||
|
||||
All lines are valid, errors are not possible. Each line matches one of
|
||||
the Comment, Header, or Data format:
|
||||
|
||||
Comment:
|
||||
[ <horizontal whitespace> ] [ '#' <anything> ]
|
||||
|
||||
Comment lines are ignored; The file is treated as if
|
||||
the comment lines do not exist.
|
||||
|
||||
Header:
|
||||
[ <horizontal whitespace> ] '[' <anything> ']' [ <anything> ]
|
||||
|
||||
Data:
|
||||
Anything not matching a comment or header.
|
||||
|
||||
Lines in a data block are added to the section with the last name parsed,
|
||||
or the empty string if no header line has been seen yet.
|
||||
*/
|
||||
class Logic
|
||||
{
|
||||
public:
|
||||
typedef std::set <Listener*> Listeners;
|
||||
typedef std::map <beast::URL, SiteFile> SiteFiles;
|
||||
|
||||
struct State
|
||||
{
|
||||
State()
|
||||
{
|
||||
}
|
||||
|
||||
Listeners listeners;
|
||||
SiteFiles files;
|
||||
};
|
||||
|
||||
typedef beast::SharedData <State> SharedState;
|
||||
|
||||
SharedState m_state;
|
||||
beast::Journal m_journal;
|
||||
|
||||
explicit Logic (beast::Journal journal)
|
||||
: m_journal (journal)
|
||||
{
|
||||
}
|
||||
|
||||
~Logic ()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
//
|
||||
// Logic
|
||||
//
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
void addListener (Listener& listener)
|
||||
{
|
||||
SharedState::Access state (m_state);
|
||||
|
||||
// Notify the listener for each site file already added
|
||||
for (SiteFiles::const_iterator iter (state->files.begin());
|
||||
iter != state->files.end(); ++iter)
|
||||
{
|
||||
listener.onSiteFileFetch (to_string (iter->first), iter->second);
|
||||
}
|
||||
|
||||
state->listeners.insert (&listener);
|
||||
}
|
||||
|
||||
void removeListener (Listener& listener)
|
||||
{
|
||||
SharedState::Access state (m_state);
|
||||
state->listeners.erase (&listener);
|
||||
}
|
||||
|
||||
void addURL (std::string const& urlstr)
|
||||
{
|
||||
// VFALCO This is commented out because the HTTPClient
|
||||
// implementation is now obsolete. A new HTTP client
|
||||
// that uses the latest best practices (asio coroutines,
|
||||
// beast::http::message and beast::http::parser) should
|
||||
// be used.
|
||||
//
|
||||
// NOTE SiteFiles is currently an unused module.
|
||||
//
|
||||
#if 0
|
||||
auto url = beast::parse_URL (urlstr);
|
||||
|
||||
if (!url.first)
|
||||
{
|
||||
m_journal.error <<
|
||||
"Error parsing '" << urlstr << "'";
|
||||
return;
|
||||
}
|
||||
|
||||
auto const result (m_client->get (url.second));
|
||||
|
||||
boost::system::error_code const error (result.first);
|
||||
|
||||
if (error)
|
||||
{
|
||||
m_journal.error <<
|
||||
"HTTP GET '" << url.second <<
|
||||
"' failed: " << error.message();
|
||||
return;
|
||||
}
|
||||
|
||||
beast::HTTPResponse const& response (*result.second);
|
||||
|
||||
processResponse (url.second, response);
|
||||
#endif
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
//
|
||||
// Implementation
|
||||
//
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
void processResponse (beast::URL const& url, beast::HTTPResponse const& response)
|
||||
{
|
||||
SharedState::Access state (m_state);
|
||||
|
||||
std::pair <SiteFiles::iterator, bool> result (
|
||||
state->files.emplace (url, 0));
|
||||
|
||||
if (! result.second)
|
||||
{
|
||||
m_journal.error <<
|
||||
"Duplicate URL '" << url << "' ignored";
|
||||
return;
|
||||
}
|
||||
|
||||
SiteFile& siteFile (result.first->second);
|
||||
parse (siteFile, response);
|
||||
|
||||
for (Listeners::iterator iter (state->listeners.begin());
|
||||
iter != state->listeners.end(); ++iter)
|
||||
{
|
||||
Listener* const listener (*iter);
|
||||
listener->onSiteFileFetch (to_string (url), siteFile);
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
static boost::regex const& reHeader ()
|
||||
{
|
||||
static boost::regex re (
|
||||
"(?:\\v*)" // Line break (optional)
|
||||
"(?:\\h*)" // Horizontal whitespace (optional)
|
||||
"(?:\\[)" // Open bracket
|
||||
"([^\\]]*)" // [1] Everything between the brackets
|
||||
"(?:\\])" // Close bracket
|
||||
"(?:\\V*)" // Rest of the line
|
||||
, boost::regex::perl |
|
||||
boost::regex_constants::match_not_null
|
||||
);
|
||||
|
||||
return re;
|
||||
}
|
||||
|
||||
static boost::regex const& reComment ()
|
||||
{
|
||||
static boost::regex re (
|
||||
"(?:\\v)*" // Line break (optional)
|
||||
"(?:\\h*)" // Horizontal whitespace (optional)
|
||||
"(?:#\\V*)*" // Comment
|
||||
"(?:\\v*)" // Line break (optional)
|
||||
, boost::regex::perl
|
||||
| boost::regex_constants::match_not_null
|
||||
);
|
||||
|
||||
return re;
|
||||
}
|
||||
|
||||
static boost::regex const& reData ()
|
||||
{
|
||||
static boost::regex re (
|
||||
"(?:\\v|\\h)*" // Whitespace
|
||||
"(\\V*)" // [1] Rest of the line
|
||||
, boost::regex::perl
|
||||
| boost::regex_constants::match_not_null
|
||||
);
|
||||
|
||||
return re;
|
||||
}
|
||||
#else
|
||||
|
||||
// regex debugger:
|
||||
//
|
||||
// https://www.debuggex.com/r/jwZFkNrqsouaTPHf
|
||||
//
|
||||
// (Thanks to J Lynn)
|
||||
//
|
||||
static boost::regex const& reHeader ()
|
||||
{
|
||||
static boost::regex re (
|
||||
"(?:\\h*(?:#\\V*)?\\v)*" // Zero or more comments
|
||||
"(?:\\v*)" // Line break (optional)
|
||||
"(?:\\h*)" // Horizontal whitespace (optional)
|
||||
"(?:\\[)" // Open bracket
|
||||
"([^\\]]*)" // [1] Everything between the brackets
|
||||
"(?:\\])" // Close bracket
|
||||
"(?:\\V*)" // Rest of the line
|
||||
"(?:\\h*(?:#\\V*)?\\v)*" // Zero or more comments
|
||||
, boost::regex::perl
|
||||
);
|
||||
|
||||
return re;
|
||||
}
|
||||
|
||||
static boost::regex const& reData ()
|
||||
{
|
||||
static boost::regex re (
|
||||
"(?:\\h*(?:#\\V*)?\\v)*" // Zero or more comments
|
||||
"(\\V*)" // [1] Rest of the line
|
||||
"(?:\\h*(?:#\\V*)?\\v)*" // Zero or more comments
|
||||
, boost::regex::perl
|
||||
);
|
||||
|
||||
return re;
|
||||
}
|
||||
#endif
|
||||
template <typename BidirectionalIterator>
|
||||
void parse (
|
||||
SiteFile& siteFile,
|
||||
BidirectionalIterator start,
|
||||
BidirectionalIterator end)
|
||||
{
|
||||
Section* section (&siteFile.insert (""));
|
||||
|
||||
boost::match_results <BidirectionalIterator> m;
|
||||
for (;start != end;)
|
||||
{
|
||||
if (boost::regex_search (start, end, m, reHeader(),
|
||||
boost::regex_constants::match_continuous))
|
||||
{
|
||||
std::string const& s (m[1]);
|
||||
section = &siteFile.insert (s);
|
||||
}
|
||||
else
|
||||
{
|
||||
boost::regex_search (start, end, m, reData(),
|
||||
boost::regex_constants::match_continuous);
|
||||
|
||||
std::string const& s (m[1]);
|
||||
section->push_back (s);
|
||||
}
|
||||
|
||||
start = m[0].second;
|
||||
}
|
||||
}
|
||||
|
||||
void parse (SiteFile& siteFile, beast::HTTPResponse const& response)
|
||||
{
|
||||
std::string const s (response.body().to_string());
|
||||
parse (siteFile, s.begin(), s.end());
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,146 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of rippled: https://github.com/ripple/rippled
|
||||
Copyright (c) 2012, 2013 Ripple Labs Inc.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include <ripple/sitefiles/Sitefiles.h>
|
||||
#include <ripple/sitefiles/impl/Logic.h>
|
||||
#include <beast/module/core/core.h>
|
||||
#include <functional>
|
||||
|
||||
namespace ripple {
|
||||
namespace SiteFiles {
|
||||
|
||||
typedef beast::ScopedWrapperContext <
|
||||
beast::RecursiveMutex, beast::RecursiveMutex::ScopedLockType> SerializedContext;
|
||||
|
||||
class ManagerImp
|
||||
: public Manager
|
||||
, public beast::Thread
|
||||
, public beast::DeadlineTimer::Listener
|
||||
, public beast::LeakChecked <ManagerImp>
|
||||
{
|
||||
public:
|
||||
Logic m_logic;
|
||||
beast::Journal m_journal;
|
||||
beast::ServiceQueue m_queue;
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
ManagerImp (Stoppable& stoppable, beast::Journal journal)
|
||||
: Manager (stoppable)
|
||||
, Thread ("SiteFiles")
|
||||
, m_logic (journal)
|
||||
, m_journal (journal)
|
||||
{
|
||||
// Turned off for now, this is for testing
|
||||
//addURL ("https://ripple.com/ripple.txt");
|
||||
}
|
||||
|
||||
~ManagerImp ()
|
||||
{
|
||||
stopThread ();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
//
|
||||
// Manager
|
||||
//
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
void addListener (SiteFiles::Listener& listener)
|
||||
{
|
||||
m_queue.post (std::bind (
|
||||
&Logic::addListener, &m_logic, std::ref (listener)));
|
||||
}
|
||||
|
||||
void removeListener (SiteFiles::Listener& listener)
|
||||
{
|
||||
m_queue.post (std::bind (
|
||||
&Logic::removeListener, &m_logic, std::ref (listener)));
|
||||
}
|
||||
|
||||
void addURL (std::string const& urlstr)
|
||||
{
|
||||
m_queue.post (std::bind (&Logic::addURL, &m_logic, urlstr));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
//
|
||||
// Stoppable
|
||||
//
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
void onPrepare ()
|
||||
{
|
||||
}
|
||||
|
||||
void onStart ()
|
||||
{
|
||||
startThread();
|
||||
}
|
||||
|
||||
void onStop ()
|
||||
{
|
||||
m_journal.debug << "Stopping";
|
||||
m_queue.stop ();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
//
|
||||
// PropertyStream
|
||||
//
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
void onWrite (beast::PropertyStream::Map& map)
|
||||
{
|
||||
//SerializedContext::Scope scope (m_context);
|
||||
|
||||
// ...
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
void onDeadlineTimer (beast::DeadlineTimer& timer)
|
||||
{
|
||||
}
|
||||
|
||||
void run ()
|
||||
{
|
||||
m_journal.debug << "Started";
|
||||
m_queue.run();
|
||||
m_queue.reset();
|
||||
m_queue.poll();
|
||||
stopped();
|
||||
}
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
Manager::Manager (Stoppable& parent)
|
||||
: Stoppable ("SiteFiles", parent)
|
||||
, beast::PropertyStream::Source ("sitefiles")
|
||||
{
|
||||
}
|
||||
|
||||
Manager* Manager::New (Stoppable& parent, beast::Journal journal)
|
||||
{
|
||||
return new ManagerImp (parent, journal);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of rippled: https://github.com/ripple/rippled
|
||||
Copyright (c) 2012, 2013 Ripple Labs Inc.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include <ripple/sitefiles/Sitefiles.h>
|
||||
|
||||
namespace ripple {
|
||||
namespace SiteFiles {
|
||||
|
||||
Section::Section(int)
|
||||
{
|
||||
}
|
||||
|
||||
std::string const& Section::get (std::string const& key) const
|
||||
{
|
||||
MapType::const_iterator iter (m_map.find (key));
|
||||
if (iter != m_map.end())
|
||||
return iter->second;
|
||||
static std::string const none;
|
||||
return none;
|
||||
}
|
||||
|
||||
std::string const& Section::operator[] (std::string const& key) const
|
||||
{
|
||||
return get (key);
|
||||
}
|
||||
|
||||
std::vector <std::string> const& Section::data() const
|
||||
{
|
||||
return m_data;
|
||||
}
|
||||
|
||||
void Section::set (std::string const& key, std::string const& value)
|
||||
{
|
||||
m_map [key] = value;
|
||||
}
|
||||
|
||||
std::string& Section::operator[] (std::string const& key)
|
||||
{
|
||||
return m_map [key];
|
||||
}
|
||||
|
||||
void Section::push_back (std::string const& data)
|
||||
{
|
||||
m_data.push_back (data);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of rippled: https://github.com/ripple/rippled
|
||||
Copyright (c) 2012, 2013 Ripple Labs Inc.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef RIPPLE_SITEFILES_SITE_H_INCLUDED
|
||||
#define RIPPLE_SITEFILES_SITE_H_INCLUDED
|
||||
|
||||
namespace ripple {
|
||||
namespace SiteFiles {
|
||||
|
||||
struct Site
|
||||
{
|
||||
Site (int) // dummy argument for emplace()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,51 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of rippled: https://github.com/ripple/rippled
|
||||
Copyright (c) 2012, 2013 Ripple Labs Inc.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include <ripple/sitefiles/Sitefiles.h>
|
||||
|
||||
namespace ripple {
|
||||
namespace SiteFiles {
|
||||
|
||||
SiteFile::SiteFile (int)
|
||||
{
|
||||
}
|
||||
|
||||
Section const& SiteFile::get (std::string const& name) const
|
||||
{
|
||||
SectionsType::const_iterator iter (m_sections.find (name));
|
||||
if (iter != m_sections.end())
|
||||
return iter->second;
|
||||
static Section const none;
|
||||
return none;
|
||||
}
|
||||
|
||||
Section const& SiteFile::operator[] (std::string const& key) const
|
||||
{
|
||||
return get (key);
|
||||
}
|
||||
|
||||
Section& SiteFile::insert (std::string const& name)
|
||||
{
|
||||
std::pair <SectionsType::iterator, bool> result (
|
||||
m_sections.emplace (name, 0));
|
||||
return result.first->second;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of rippled: https://github.com/ripple/rippled
|
||||
Copyright (c) 2012, 2013 Ripple Labs Inc.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include <BeastConfig.h>
|
||||
#include <ripple/sitefiles/impl/Manager.cpp>
|
||||
#include <ripple/sitefiles/impl/Section.cpp>
|
||||
#include <ripple/sitefiles/impl/SiteFile.cpp>
|
||||
Reference in New Issue
Block a user