blob: 08e8f804813102aba7aef86973aeb87d69cc5888 (
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
25
26
27
28
29
30
31
32
33
34
35
36
37
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include "storagemessage.h"
#include "storageprotocol.h"
#include <vespa/messagebus/message.h>
#include <vespa/storageapi/messageapi/storagecommand.h>
namespace storage::mbusprot {
class StorageCommand : public mbus::Message, public StorageMessage {
public:
using UP = std::unique_ptr<StorageCommand>;
explicit StorageCommand(api::StorageCommand::SP);
const mbus::string & getProtocol() const override { return StorageProtocol::NAME; }
uint32_t getType() const override { return _cmd->getType().getId(); }
const api::StorageCommand::SP& getCommand() { return _cmd; }
api::StorageCommand::CSP getCommand() const { return _cmd; }
api::StorageMessage::SP getInternalMessage() override { return _cmd; }
api::StorageMessage::CSP getInternalMessage() const override { return _cmd; }
bool has_command() const noexcept { return (_cmd.get() != nullptr); }
api::StorageCommand::SP steal_command() { return std::move(_cmd); }
bool hasBucketSequence() const override { return false; }
uint8_t priority() const override {
return ((getInternalMessage()->getPriority()) / 255) * 16;
}
private:
api::StorageCommand::SP _cmd;
};
}
|