mirror of
https://github.com/0glabs/0g-storage-node.git
synced 2024-11-10 10:05: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>>;
|
||||
|
||||
#[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())
|
||||
}
|
||||
|
||||
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? {
|
||||
Some(tx) => tx,
|
||||
None => {
|
||||
@ -221,7 +225,7 @@ impl RpcServer for RpcServerImpl {
|
||||
shard_config: shard_config.unwrap(),
|
||||
})
|
||||
.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))
|
||||
} else {
|
||||
Ok(None)
|
||||
|
Loading…
Reference in New Issue
Block a user