blob: 4cc435f628c9a5ad19704ef3413b24c53fcb4590 (
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
38
39
40
41
42
43
44
45
46
|
// 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/reply.h>
#include <vespa/storageapi/messageapi/storagereply.h>
namespace storage::mbusprot {
class StorageReply : public mbus::Reply, public StorageMessage {
const ProtocolSerialization* _serializer;
size_t _sz;
mutable vespalib::alloc::Alloc _buffer;
uint32_t _mbusType;
mutable api::StorageReply::SP _reply;
public:
using UP = std::unique_ptr<StorageReply>;
StorageReply(mbus::BlobRef data, const ProtocolSerialization&);
StorageReply(api::StorageReply::SP reply);
~StorageReply();
const mbus::string& getProtocol() const override { return StorageProtocol::NAME; }
uint32_t getType() const override { return _mbusType; }
const api::StorageReply::SP& getReply() { deserialize(); return _reply; }
api::StorageReply::CSP getReply() const { deserialize(); return _reply; }
api::StorageMessage::SP getInternalMessage() override { deserialize(); return _reply; }
api::StorageMessage::CSP getInternalMessage() const override { deserialize(); return _reply; }
uint8_t priority() const override {
if (_reply) {
return _reply->getPriority();
}
return 0;
}
private:
void deserialize() const;
};
}
|