forked from LoopKit/LoopKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCriticalEventLog.swift
More file actions
41 lines (33 loc) · 1.59 KB
/
CriticalEventLog.swift
File metadata and controls
41 lines (33 loc) · 1.59 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
//
// CriticalEventLog.swift
// LoopKit
//
// Created by Darin Krauss on 7/15/20.
// Copyright © 2020 LoopKit Authors. All rights reserved.
//
import Foundation
public protocol CriticalEventLog {
/// The name for the critical event log export.
var exportName: String { get }
/// Calculate the progress total unit count for the critical event log export for the specified date range.
///
/// - Parameters:
/// - startDate: The start date for the critical events to export.
/// - endDate: The end date for the critical events to export. Optional. If not specified, default to now.
/// - Returns: An progress total unit count, or an error.
func exportProgressTotalUnitCount(startDate: Date, endDate: Date?) -> Result<Int64, Error>
/// Export the critical event log for the specified date range.
///
/// - Parameters:
/// - startDate: The start date for the critical events to export.
/// - endDate: The end date for the critical events to export.
/// - stream: The output stream to write the critical event log to. Typically writes JSON UTF-8 text.
/// - progressor: The estimated duration progress to use to check if cancelled and report progress.
/// - Returns: Any error that occurs during the export, or nil if successful.
func export(startDate: Date, endDate: Date, to stream: DataOutputStream, progress: Progress) -> Error?
}
public enum CriticalEventLogError: Error {
/// The export was cancelled either by the user or the OS.
case cancelled
}
public let criticalEventLogExportProgressUnitCountPerFetch: Int64 = 250