-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[aptos-workspace-server] indexer support and graceful shutdown (#15183)
- Loading branch information
Showing
14 changed files
with
1,572 additions
and
310 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Copyright (c) Aptos Foundation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
//! Common utilities and constants for networking and asynchronous operations. | ||
use futures::{future::Shared, FutureExt}; | ||
use std::{ | ||
future::Future, | ||
net::{IpAddr, Ipv4Addr}, | ||
sync::Arc, | ||
}; | ||
|
||
/// The local IP address services are bound to. | ||
pub(crate) const IP_LOCAL_HOST: IpAddr = IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)); | ||
|
||
/// Converts a future into a shared future by wrapping the error in an `Arc`. | ||
pub(crate) fn make_shared<F, T, E>(fut: F) -> Shared<impl Future<Output = Result<T, Arc<E>>>> | ||
where | ||
T: Clone, | ||
F: Future<Output = Result<T, E>>, | ||
{ | ||
fut.map(|r| r.map_err(|err| Arc::new(err))).shared() | ||
} |
Oops, something went wrong.