blob: 64e1f0fd27dc12a17298c1d0fbc1515c353f104e (
plain)
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
/**
* Delta data access
*
* Copyright (C) 2010-2019 R-T Specialty, LLC.
*
* This file is part of the Liza Data Collection Framework.
*
* liza is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* These types are used to describe the structure of the token data as it
* is stored in Mongo. It has a number of undesirable properties and
* duplicates data---this was intended to make querying easier and work
* around Mongo limitations.
*
* This structure can be changed in the future, but we'll need to maintain
* compatibility with the existing data.
*/
import { DocumentId } from "../../document/Document";
/** Manage deltas */
export interface DeltaDao
{
/**
* Get documents in need of processing
*
* @return documents in need of processing
*/
getUnprocessedDocuments(): Promise<Record<string, any>[]>
/**
* Set the document's processed index
*
* @param doc_id - Document whose index will be set
* @param type - Delta type
*
* @return any errors that occured
*/
advanceDeltaIndex(
doc_id: DocumentId,
type: string,
): Promise<NullableError>
/**
* Mark a given document as processed. First does a check to make sure that
* the document does not have a newer update timestamp than the provided one
*
* @param doc_id - The document to mark
* @param last_update_ts - The last time this document was updated
*
* @return true if the document was successfully marked as processed
*/
markDocumentAsProcessed(
doc_id: DocumentId,
last_update_ts: UnixTimestamp,
): Promise<NullableError>
}
|