sui_core/
runtime.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// Copyright (c) Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0

use sui_config::NodeConfig;
use tokio::runtime::Runtime;

pub struct SuiRuntimes {
    // Order in this struct is the order in which runtimes are stopped
    pub sui_node: Runtime,
    pub metrics: Runtime,
}

impl SuiRuntimes {
    pub fn new(_confg: &NodeConfig) -> Self {
        let sui_node = tokio::runtime::Builder::new_multi_thread()
            .thread_name("sui-node-runtime")
            .enable_all()
            .build()
            .unwrap();
        let metrics = tokio::runtime::Builder::new_multi_thread()
            .thread_name("metrics-runtime")
            .worker_threads(2)
            .enable_all()
            .build()
            .unwrap();

        Self { sui_node, metrics }
    }
}