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

#pragma once

#include "diskthread.h"
#include "types.h"

namespace storage {

namespace framework {
    class Component;
    class Thread;
}

class PersistenceHandler;
class FileStorHandler;

class PersistenceThread final : public DiskThread, public Types
{
public:
    PersistenceThread(PersistenceHandler & handler, FileStorHandler & fileStorHandler,
                      uint32_t stripeId, framework::Component & component);
    ~PersistenceThread() override;

    /** Waits for current operation to be finished. */
    void flush() override;
    framework::Thread& getThread() override { return *_thread; }

private:
    PersistenceHandler                 & _persistenceHandler;
    FileStorHandler                    & _fileStorHandler;
    uint32_t                             _stripeId;
    std::unique_ptr<framework::Thread>   _thread;

    void run(framework::ThreadHandle&) override;
};

} // storage