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

#include "documentreply.h"
#include <vespa/document/bucket/bucketid.h>

namespace documentapi {

class GetBucketListReply : public DocumentReply {
public:
    class BucketInfo {
    public:
        document::BucketId _bucket;
        string        _bucketInformation;

        BucketInfo();
        BucketInfo(const document::BucketId &bucketId,
                   const string &bucketInformation);
        bool operator==(const BucketInfo &rhs) const;
    };

private:
    std::vector<BucketInfo> _buckets;

public:
    GetBucketListReply() noexcept;
    ~GetBucketListReply() override;

    /**
     * Returns the bucket state contained in this.
     *
     * @return The state object.
     */
    std::vector<BucketInfo> &getBuckets() { return _buckets; }

    /**
     * Returns a const reference to the bucket state contained in this.
     *
     * @return The state object.
     */
    [[nodiscard]] const std::vector<BucketInfo> &getBuckets() const { return _buckets; }

    [[nodiscard]] string toString() const override { return "getbucketlistreply"; }
};

std::ostream & operator<<(std::ostream &out, const GetBucketListReply::BucketInfo &info);

} // documentapi