mirror of
https://github.com/KingDuckZ/dindexer.git
synced 2025-07-03 14:14:11 +00:00
Implement default ctor and move assignment in Script.
This commit is contained in:
parent
678e8c90d1
commit
75335cd390
2 changed files with 16 additions and 2 deletions
|
@ -18,9 +18,15 @@
|
||||||
#include "script.hpp"
|
#include "script.hpp"
|
||||||
|
|
||||||
namespace redis {
|
namespace redis {
|
||||||
|
Script::Script() :
|
||||||
|
m_sha1(),
|
||||||
|
m_manager(nullptr)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
Script::Script (boost::string_ref parSha1, ScriptManager& parManager) :
|
Script::Script (boost::string_ref parSha1, ScriptManager& parManager) :
|
||||||
m_sha1(parSha1),
|
m_sha1(parSha1),
|
||||||
m_manager(parManager)
|
m_manager(&parManager)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
} //namespace redis
|
} //namespace redis
|
||||||
|
|
|
@ -23,12 +23,15 @@
|
||||||
#include "helpers/sequence_bt.hpp"
|
#include "helpers/sequence_bt.hpp"
|
||||||
#include <boost/utility/string_ref.hpp>
|
#include <boost/utility/string_ref.hpp>
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
|
#include <cassert>
|
||||||
|
#include <ciso646>
|
||||||
|
|
||||||
namespace redis {
|
namespace redis {
|
||||||
class ScriptManager;
|
class ScriptManager;
|
||||||
|
|
||||||
class Script {
|
class Script {
|
||||||
public:
|
public:
|
||||||
|
Script ( void );
|
||||||
Script ( Script&& ) = default;
|
Script ( Script&& ) = default;
|
||||||
Script ( boost::string_ref parSha1, ScriptManager& parManager );
|
Script ( boost::string_ref parSha1, ScriptManager& parManager );
|
||||||
~Script ( void ) noexcept = default;
|
~Script ( void ) noexcept = default;
|
||||||
|
@ -36,12 +39,14 @@ namespace redis {
|
||||||
template <typename... Keys, typename... Values>
|
template <typename... Keys, typename... Values>
|
||||||
void run ( Batch& parBatch, const std::tuple<Keys...>& parKeys, const std::tuple<Values...>& parValues );
|
void run ( Batch& parBatch, const std::tuple<Keys...>& parKeys, const std::tuple<Values...>& parValues );
|
||||||
|
|
||||||
|
Script& operator= ( Script&& ) = default;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
template <typename... Keys, typename... Values, std::size_t... KeyIndices, std::size_t... ValueIndices>
|
template <typename... Keys, typename... Values, std::size_t... KeyIndices, std::size_t... ValueIndices>
|
||||||
void run_with_indices ( Batch& parBatch, const std::tuple<Keys...>& parKeys, const std::tuple<Values...>& parValues, dinhelp::bt::index_seq<KeyIndices...>, dinhelp::bt::index_seq<ValueIndices...> );
|
void run_with_indices ( Batch& parBatch, const std::tuple<Keys...>& parKeys, const std::tuple<Values...>& parValues, dinhelp::bt::index_seq<KeyIndices...>, dinhelp::bt::index_seq<ValueIndices...> );
|
||||||
|
|
||||||
boost::string_ref m_sha1;
|
boost::string_ref m_sha1;
|
||||||
ScriptManager& m_manager;
|
ScriptManager* m_manager;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename... Keys, typename... Values>
|
template <typename... Keys, typename... Values>
|
||||||
|
@ -62,6 +67,9 @@ namespace redis {
|
||||||
static_assert(sizeof...(Keys) == std::tuple_size<decltype(parKeys)>::value, "Wrong key count");
|
static_assert(sizeof...(Keys) == std::tuple_size<decltype(parKeys)>::value, "Wrong key count");
|
||||||
static_assert(sizeof...(Values) == std::tuple_size<decltype(parValues)>::value, "Wrong value count");
|
static_assert(sizeof...(Values) == std::tuple_size<decltype(parValues)>::value, "Wrong value count");
|
||||||
|
|
||||||
|
assert(not m_sha1.empty());
|
||||||
|
assert(m_manager);
|
||||||
|
|
||||||
parBatch.run(
|
parBatch.run(
|
||||||
"EVALSHA",
|
"EVALSHA",
|
||||||
m_sha1,
|
m_sha1,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue