aboutsummaryrefslogtreecommitdiffstats
path: root/messagebus/src/vespa/messagebus/routing/routedirective.h
blob: 86b2a453ed52820702e0e07b5470f0f49536c649 (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
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once

#include "ihopdirective.h"

namespace mbus {

/**
 * This class represents a route directive within a {@link Hop}'s selector. This will be replaced by the named route
 * when evaluated. If the route is not present in the running protocol's routing table, routing will fail.
 *
 * @author Simon Thoresen Hult
 * @version $Id$
 */
class RouteDirective : public IHopDirective {
private:
    string _name;

public:

    /**
     * Constructs a new directive to insert a route.
     *
     * @param name The name of the route to insert.
     */
    explicit RouteDirective(vespalib::stringref name);
    ~RouteDirective() override;

    /**
     * Returns the name of the route to insert.
     *
     * @return The name name.
     */
    [[nodiscard]] const string &getName() const { return _name; }

    [[nodiscard]] Type getType() const override { return TYPE_ROUTE; }
    [[nodiscard]] bool matches(const IHopDirective &dir) const override;
    [[nodiscard]] string toString() const override;
    [[nodiscard]] string toDebugString() const override;
};

} // mbus