mirror of
https://github.com/0glabs/0g-storage-node.git
synced 2025-01-29 16:25:17 +00:00
feat: add all_shards in admin_getFileLocation (#138)
This commit is contained in:
parent
085c34beb0
commit
a782cf2d54
@ -40,5 +40,9 @@ pub trait Rpc {
|
|||||||
async fn get_peers(&self) -> RpcResult<HashMap<String, PeerInfo>>;
|
async fn get_peers(&self) -> RpcResult<HashMap<String, PeerInfo>>;
|
||||||
|
|
||||||
#[method(name = "getFileLocation")]
|
#[method(name = "getFileLocation")]
|
||||||
async fn get_file_location(&self, tx_seq: u64) -> RpcResult<Option<Vec<LocationInfo>>>;
|
async fn get_file_location(
|
||||||
|
&self,
|
||||||
|
tx_seq: u64,
|
||||||
|
all_shards: bool,
|
||||||
|
) -> RpcResult<Option<Vec<LocationInfo>>>;
|
||||||
}
|
}
|
||||||
|
@ -185,7 +185,11 @@ impl RpcServer for RpcServerImpl {
|
|||||||
.collect())
|
.collect())
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn get_file_location(&self, tx_seq: u64) -> RpcResult<Option<Vec<LocationInfo>>> {
|
async fn get_file_location(
|
||||||
|
&self,
|
||||||
|
tx_seq: u64,
|
||||||
|
all_shards: bool,
|
||||||
|
) -> RpcResult<Option<Vec<LocationInfo>>> {
|
||||||
let tx = match self.ctx.log_store.get_tx_by_seq_number(tx_seq).await? {
|
let tx = match self.ctx.log_store.get_tx_by_seq_number(tx_seq).await? {
|
||||||
Some(tx) => tx,
|
Some(tx) => tx,
|
||||||
None => {
|
None => {
|
||||||
@ -221,7 +225,7 @@ impl RpcServer for RpcServerImpl {
|
|||||||
shard_config: shard_config.unwrap(),
|
shard_config: shard_config.unwrap(),
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
if all_shards_available(info.iter().map(|info| info.shard_config).collect()) {
|
if all_shards && all_shards_available(info.iter().map(|info| info.shard_config).collect()) {
|
||||||
Ok(Some(info))
|
Ok(Some(info))
|
||||||
} else {
|
} else {
|
||||||
Ok(None)
|
Ok(None)
|
||||||
|
Loading…
Reference in New Issue
Block a user