Skip to content

Commit

Permalink
[aptos-workspace-server] indexer support and graceful shutdown (#15183)
Browse files Browse the repository at this point in the history
  • Loading branch information
vgao1996 authored Nov 20, 2024
1 parent 389c6c1 commit 40a7425
Show file tree
Hide file tree
Showing 14 changed files with 1,572 additions and 310 deletions.
8 changes: 8 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions aptos-move/aptos-workspace-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,30 @@ repository = { workspace = true }
rust-version = { workspace = true }

[dependencies]
# aptos deps
aptos = { workspace = true }
aptos-cached-packages = { workspace = true }
aptos-config = { workspace = true }
aptos-faucet-core = { workspace = true }
aptos-node = { workspace = true }
aptos-types = { workspace = true }

# third party deps
anyhow = { workspace = true }
bollard = { workspace = true }
diesel = { workspace = true, features = [
"postgres_backend",
] }
diesel-async = { workspace = true }
futures = { workspace = true }
maplit = { workspace = true }
rand = { workspace = true }
tempfile = { workspace = true }
tokio = { workspace = true }
tokio-util = { workspace = true }
url = { workspace = true }
uuid = { workspace = true }

# indexer deps
processor = { git = "https://github.com/aptos-labs/aptos-indexer-processors.git", rev = "51a34901b40d7f75767ac907b4d2478104d6a515", default-features = false }
server-framework = { git = "https://github.com/aptos-labs/aptos-indexer-processors.git", rev = "51a34901b40d7f75767ac907b4d2478104d6a515" }
23 changes: 23 additions & 0 deletions aptos-move/aptos-workspace-server/src/common.rs
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()
}
Loading

0 comments on commit 40a7425

Please sign in to comment.