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

#pragma once

#include "encoded_cluster_state_bundle.h"

namespace storage::lib { class ClusterStateBundle; }

namespace storage::rpc {

/**
 * Provides opaque encoding and decoding of ClusterStateBundles for transmission over RPC.
 *
 * Implementations may choose to compress the encoded representation of the bundle.
 *
 * It is important that the input given to decode() is exactly equal to that given from
 * encode() for the results to be correct. Implementations must ensure that this information
 * is enough to losslessly reconstruct the full encoded ClusterStateBundle.
 */
class ClusterStateBundleCodec {
public:
    virtual ~ClusterStateBundleCodec() = default;

    virtual EncodedClusterStateBundle encode(const lib::ClusterStateBundle&) const = 0;
    virtual std::shared_ptr<const lib::ClusterStateBundle> decode(const EncodedClusterStateBundle&) const = 0;
};

}