aboutsummaryrefslogtreecommitdiffstats
path: root/storage/src/vespa/storage/persistence/simplemessagehandler.h
blob: deeb7188f65753774fe82f785f19a53424bc877e (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include "types.h"
#include "messages.h"
#include <vespa/storageapi/message/persistence.h>

namespace document { class BucketIdFactory; }

namespace storage {

namespace spi { struct PersistenceProvider; }
class PersistenceUtil;

/**
 * Handles most of the messages that are 'simple' to handle and do not
 * logically belong together with any particular group.
 * It is stateless and thread safe.
 */
class SimpleMessageHandler : public Types {
public:
    SimpleMessageHandler(const PersistenceUtil&,
                         spi::PersistenceProvider&,
                         const document::BucketIdFactory&);
    MessageTrackerUP handleGet(api::GetCommand& cmd, MessageTrackerUP tracker) const;
    MessageTrackerUP handleCreateIterator(CreateIteratorCommand& cmd, MessageTrackerUP tracker) const;
    MessageTrackerUP handleGetIter(GetIterCommand& cmd, MessageTrackerUP tracker) const;
private:
    MessageTrackerUP handle_conditional_get(api::GetCommand& cmd, MessageTrackerUP tracker) const;

    const PersistenceUtil&           _env;
    spi::PersistenceProvider&        _spi;
    const document::BucketIdFactory& _bucket_id_factory;
};

} // storage