initial support for kernel data download (#2765)

* initial support for kernel data download

* fix vec backend for tests

* cleanup after rebase
This commit is contained in:
Antioch Peverell
2019-05-14 17:17:38 +01:00
committed by GitHub
parent ff1c55193f
commit e56cd55980
19 changed files with 280 additions and 10 deletions
+7
View File
@@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use std::fs::File;
use croaring::Bitmap;
use crate::core::hash::Hash;
@@ -59,6 +61,11 @@ pub trait Backend<T: PMMRable> {
/// triggered removal).
fn remove(&mut self, position: u64) -> Result<(), String>;
/// Creates a temp file containing the contents of the underlying data file
/// from the backend storage. This allows a caller to see a consistent view
/// of the data without needing to lock the backend storage.
fn data_as_temp_file(&self) -> Result<File, String>;
/// Release underlying datafiles and locks
fn release_files(&mut self);
+5
View File
@@ -49,6 +49,11 @@ where
}
}
/// Reference to the underlying storage backend.
pub fn backend(&'a self) -> &Backend<T> {
self.backend
}
/// Build a new readonly PMMR pre-initialized to
/// last_pos with the provided backend.
pub fn at(backend: &'a B, last_pos: u64) -> RewindablePMMR<'_, T, B> {