aboutsummaryrefslogtreecommitdiffstats
path: root/storage/src/vespa/storage/common/messagesender.cpp
blob: 7d5a548d2f21600029bd6a44ba6ff74ac8aa3a95 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "messagesender.h"
#include <vespa/storageapi/messageapi/storagemessage.h>
#include <vespa/storageapi/messageapi/storagereply.h>
#include <vespa/storageapi/messageapi/storagecommand.h>

namespace storage {

void
MessageSender::send(const std::shared_ptr<api::StorageMessage>& msg)
{
    if (msg->getType().isReply()) {
        sendReply(std::static_pointer_cast<api::StorageReply>(msg));
    } else {
        sendCommand(std::static_pointer_cast<api::StorageCommand>(msg));
    }
}

void
MessageSender::sendReplyDirectly(const std::shared_ptr<api::StorageReply>& reply) {
    sendReply(reply);
}

}