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

tstack / lnav / 17955647695-2537

23 Sep 2025 06:33PM UTC coverage: 64.851% (-0.1%) from 64.974%
17955647695-2537

push

github

tstack
[build] left local path in cargo

45984 of 70907 relevant lines covered (64.85%)

406352.74 hits per line

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

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

30
#ifndef lnav_progress_hh
31
#define lnav_progress_hh
32

33
#include <cstdint>
34
#include <string>
35
#include <vector>
36

37
#include "distributed_slice.hh"
38
#include "lnav.console.hh"
39
#include "safe/safe.h"
40

41
namespace lnav {
42

43
enum class progress_result_t : uint8_t {
44
    ok,
45
    interrupt,
46
};
47

48
enum class progress_status_t : uint8_t {
49
    idle,
50
    working,
51
};
52

53
struct task_progress {
54
    std::string tp_id;
55
    progress_status_t tp_status{progress_status_t::idle};
56
    size_t tp_version{0};
57
    std::string tp_step;
58
    size_t tp_completed{0};
59
    size_t tp_total{0};
60
    std::vector<console::user_message> tp_messages;
61
};
62

63
using progress_reporter_t = task_progress(*)();
64

65
struct progress_tracker {
66
    using task_container = dist_slice_container<progress_reporter_t>;
67

68
    using safe_task_container = safe::Safe<task_container*>;
69

70
    static safe_task_container& get_tasks()
71
    {
72
        static auto pt = progress_tracker();
73

74
        return pt.pt_tasks;
×
75
    }
76

77
private:
78
    safe_task_container pt_tasks;
79

80
    progress_tracker()
×
81
    {
×
82
        static auto inner
83
            = DIST_SLICE_CONTAINER(progress_reporter_t, prog_reps);
84

85
        *this->pt_tasks.writeAccess() = &inner;
×
86
    }
87
};
88

89
}  // namespace lnav
90

91
#endif
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc