blob: 36a8883700d73c3a4f2711372d9735b431bc92d4 [file] [log] [blame]
// Copyright 2016 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SRC_LEDGER_BIN_STORAGE_IMPL_COMMIT_RANDOM_IMPL_H_
#define SRC_LEDGER_BIN_STORAGE_IMPL_COMMIT_RANDOM_IMPL_H_
#include <memory>
#include <string>
#include <vector>
#include "peridot/lib/rng/random.h"
#include "src/ledger/bin/storage/public/commit.h"
namespace storage {
// Implementaton of Commit returning random values (fixed for each instance).
class CommitRandomImpl : public Commit {
public:
CommitRandomImpl(rng::Random* random);
~CommitRandomImpl() override;
CommitRandomImpl(const CommitRandomImpl& other);
CommitRandomImpl& operator=(const CommitRandomImpl& other);
// Commit:
std::unique_ptr<const Commit> Clone() const override;
const CommitId& GetId() const override;
std::vector<CommitIdView> GetParentIds() const override;
zx::time_utc GetTimestamp() const override;
uint64_t GetGeneration() const override;
ObjectIdentifier GetRootIdentifier() const override;
fxl::StringView GetStorageBytes() const override;
private:
CommitId id_;
zx::time_utc timestamp_;
uint64_t generation_;
ObjectIdentifier root_node_identifier_;
std::vector<CommitId> parent_ids_;
std::vector<CommitIdView> parent_ids_views_;
std::string storage_bytes_;
};
} // namespace storage
#endif // SRC_LEDGER_BIN_STORAGE_IMPL_COMMIT_RANDOM_IMPL_H_