1 // Copyright 2018 The Fuchsia Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #pragma once
6 
7 #include <lib/ftl/volume.h>
8 
9 #include "ndm-ram-driver.h"
10 
11 // Placeholder for an FTL driver, for testing purposes. The implementation uses
12 // an NdmRamDriver at the lower layer interface.
13 class FtlShell : public ftl::FtlInstance {
14   public:
FtlShell()15     FtlShell() : volume_(this) {}
~FtlShell()16     virtual ~FtlShell() {}
17 
18     bool Init(const ftl::VolumeOptions& options);
19     bool ReAttach();
20 
volume()21     ftl::Volume* volume() { return &volume_; }
page_size()22     uint32_t page_size() const { return page_size_; }
num_pages()23     uint32_t num_pages() const { return num_pages_; }
24 
25     // FtlInstance interface.
26     bool OnVolumeAdded(uint32_t page_size, uint32_t num_pages) final;
27 
28   private:
29     ftl::VolumeImpl volume_;
30     uint32_t page_size_ = 0;
31     uint32_t num_pages_ = 0;
32 };
33