add: monitor_and_connect_endpoints

This commit is contained in:
weisd
2024-09-19 18:06:44 +08:00
parent c71e86b8d1
commit bc9868f926
5 changed files with 163 additions and 82 deletions
+13 -2
View File
@@ -1,7 +1,7 @@
use super::{endpoint::Endpoint, error::DiskError, format::FormatV3};
use super::{
DeleteOptions, DiskAPI, FileInfoVersions, FileReader, FileWriter, MetaCacheEntry, ReadMultipleReq, ReadMultipleResp,
ReadOptions, RenameDataResp, VolumeInfo, WalkDirOptions,
DeleteOptions, DiskAPI, DiskLocation, FileInfoVersions, FileReader, FileWriter, MetaCacheEntry, ReadMultipleReq,
ReadMultipleResp, ReadOptions, RenameDataResp, VolumeInfo, WalkDirOptions,
};
use crate::disk::{LocalFileReader, LocalFileWriter, STORAGE_FORMAT_FILE};
use crate::{
@@ -452,6 +452,9 @@ impl DiskAPI for LocalDisk {
fn is_local(&self) -> bool {
true
}
async fn is_online(&self) -> bool {
true
}
async fn close(&self) -> Result<()> {
Ok(())
}
@@ -459,6 +462,14 @@ impl DiskAPI for LocalDisk {
self.root.clone()
}
fn get_location(&self) -> DiskLocation {
DiskLocation {
pool_idx: self.endpoint.pool_idx,
set_idx: self.endpoint.set_idx,
disk_idx: self.endpoint.pool_idx,
}
}
async fn get_disk_id(&self) -> Result<Option<Uuid>> {
warn!("local get_disk_id");
// TODO: check format file