Skip to main content

hyperactor_mesh/
transport.rs

1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * LICENSE file in the root directory of this source tree.
7 */
8
9//! Default transport configuration for hyperactor_mesh.
10
11use hyperactor::channel::BindSpec;
12use hyperactor::channel::ChannelTransport;
13use hyperactor_config::CONFIG;
14use hyperactor_config::ConfigAttr;
15use hyperactor_config::attrs::declare_attrs;
16use hyperactor_config::global;
17
18declare_attrs! {
19    /// Default transport type to use across the application.
20    @meta(CONFIG = ConfigAttr::new(
21        Some("HYPERACTOR_MESH_DEFAULT_TRANSPORT".to_string()),
22        Some("default_transport".to_string()),
23    ))
24    pub attr DEFAULT_TRANSPORT: BindSpec = BindSpec::Any(ChannelTransport::Unix);
25}
26
27/// Get the default bind spec to use across the application.
28pub fn default_bind_spec() -> BindSpec {
29    global::get_cloned(DEFAULT_TRANSPORT)
30}