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:
@@ -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);
|
||||
|
||||
|
||||
@@ -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> {
|
||||
|
||||
Reference in New Issue
Block a user