• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

tari-project / tari / 16123384529

07 Jul 2025 05:11PM UTC coverage: 64.327% (-7.6%) from 71.89%
16123384529

push

github

web-flow
chore: new release v4.9.0-pre.0 (#7289)

Description
---
new release esmeralda

77151 of 119935 relevant lines covered (64.33%)

227108.34 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/base_layer/core/src/base_node/state_machine_service/handle.rs
1
// Copyright 2020. The Tari Project
2
//
3
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
4
// following conditions are met:
5
//
6
// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
7
// disclaimer.
8
//
9
// 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
10
// following disclaimer in the documentation and/or other materials provided with the distribution.
11
//
12
// 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote
13
// products derived from this software without specific prior written permission.
14
//
15
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
16
// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
18
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
19
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
20
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
21
// USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22

23
use std::sync::Arc;
24

25
use tari_shutdown::ShutdownSignal;
26
use tokio::sync::{broadcast, watch};
27

28
use crate::base_node::state_machine_service::states::{StateEvent, StatusInfo};
29

30
#[derive(Clone)]
31
pub struct StateMachineHandle {
32
    state_change_event_subscriber: broadcast::Sender<Arc<StateEvent>>,
33
    status_event_receiver: watch::Receiver<StatusInfo>,
34
    shutdown_signal: ShutdownSignal,
35
}
36

37
impl StateMachineHandle {
38
    pub fn new(
×
39
        state_change_event_subscriber: broadcast::Sender<Arc<StateEvent>>,
×
40
        status_event_receiver: watch::Receiver<StatusInfo>,
×
41
        shutdown_signal: ShutdownSignal,
×
42
    ) -> Self {
×
43
        Self {
×
44
            state_change_event_subscriber,
×
45
            status_event_receiver,
×
46
            shutdown_signal,
×
47
        }
×
48
    }
×
49

50
    /// This clones the receiver end of the channel and gives out a copy to the caller
51
    /// This allows multiple subscribers to this channel by only keeping one channel and cloning the receiver for every
52
    /// caller.
53
    pub fn get_state_change_event_stream(&self) -> broadcast::Receiver<Arc<StateEvent>> {
×
54
        self.state_change_event_subscriber.subscribe()
×
55
    }
×
56

57
    /// This clones the receiver end of the channel and gives out a copy to the caller.
58
    /// This allows multiple subscribers to this channel by only keeping one channel and cloning the receiver for every
59
    /// caller.
60
    pub fn get_status_info_watch(&self) -> watch::Receiver<StatusInfo> {
×
61
        self.status_event_receiver.clone()
×
62
    }
×
63

64
    pub fn shutdown_signal(&self) -> ShutdownSignal {
×
65
        self.shutdown_signal.clone()
×
66
    }
×
67
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc