int replication_call_defer_flush_all(const rel_time_t time)
{
    R_CMD r;
    r.key  = NULL;
    r.time = time;
    return(replication(REPLICATION_DEFER_FLUSH_ALL, &r));
}
int replication_call_del(char *key, size_t keylen)
{
    R_CMD r;
    r.key    = key;
    r.keylen = keylen;
    return(replication(REPLICATION_DEL, &r));
}
int replication_call_defer_del(char *key, size_t keylen, rel_time_t time)
{
    R_CMD r;
    r.key    = key;
    r.keylen = keylen;
    r.time   = time;
    return(replication(REPLICATION_DEFER_DEL, &r));
}
Пример #4
0
TEST(ReplicatedPingTest, testPingSendsProposeExitCluster)
{
    MockReplication replication(
        std::vector<dafs::Address>
        {
            dafs::Address("AWAY", 404)
        }
    );

    auto get_endpoints = [](){
        return dafs::ReplicatedEndpoints
        {
            dafs::Endpoint
            {
                dafs::EmptyAddress(),
                dafs::Address("A", 1)
            },
            dafs::Endpoint
            {
                dafs::EmptyAddress(),
                dafs::Address("AWAY", 404)
            },
            dafs::Endpoint
            {
                dafs::EmptyAddress(),
                dafs::Address("C", 3)
            }
        };
    };

    auto is_partition_locked = [](){ return false; };

    auto mock_sender = std::make_shared<MockSender>();
    dafs::ReplicatedPing ping(
        replication,
        dafs::Address("C", 3),
        get_endpoints,
        is_partition_locked,
        std::chrono::seconds(0));
    ping.SendPing(mock_sender);

    ASSERT_EQ(1, mock_sender->sentMessages().size());
    ASSERT_EQ(
        dafs::MessageType::_ProposeExitCluster,
        mock_sender->sentMessages()[0].type);
}
int replication_call_marugoto_end()
{
    R_CMD r;
    r.key = NULL;
    return(replication(REPLICATION_MARUGOTO_END, &r));
}
int replication_call_flush_all()
{
    R_CMD r;
    r.key = NULL;
    return(replication(REPLICATION_FLUSH_ALL, &r));
}