aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src/vespa/searchcore/proton/server/i_shared_threading_service.h
blob: 0bfd874b90f0fa6ed995002a26c321abdf586417 (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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once

class FNET_Transport;

namespace storage::spi { struct BucketExecutor; }

namespace vespalib {
class ISequencedTaskExecutor;
class ThreadExecutor;
class InvokeService;
class Clock;
}

namespace proton {

/**
 * Interface containing the thread executors that are shared across all document dbs.
 */
class ISharedThreadingService {
public:
    virtual ~ISharedThreadingService() = default;

    /**
     * Returns the executor used for warmup (e.g. index warmup).
     */
    virtual vespalib::ThreadExecutor& warmup() = 0;

    /**
     * Returns the shared executor used for various assisting tasks in a document db.
     *
     * Example usages include:
     *   - Disk index fusion.
     *   - Updating nearest neighbor index (in DenseTensorAttribute).
     *   - Loading nearest neighbor index (in DenseTensorAttribute).
     *   - Writing of data in the document store.
     */
    virtual vespalib::ThreadExecutor& shared() = 0;

    /**
     * Returns the sequenced executor used to write index and attribute fields in a document db.
     */
    virtual vespalib::ISequencedTaskExecutor& field_writer() = 0;

    /**
     * Returns an InvokeService intended for regular wakeup calls.
     */
    virtual vespalib::InvokeService & invokeService() = 0;

    /**
     * Returns a shared transport object that can be utilized by multiple services.
     */
    virtual FNET_Transport & transport() = 0;


    /**
     * Returns the executor for running a BucketTask in the persistence layer above the SPI.
     */
    virtual storage::spi::BucketExecutor& bucket_executor() = 0;

    /**
     * Return a very cheap clock.
     */
    virtual const vespalib::Clock & clock() const = 0;
};

}