forked from bloomberg/comdb2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bdb_verify.h
77 lines (66 loc) · 2.88 KB
/
bdb_verify.h
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
73
74
75
76
77
/*
Copyright 2015-2020 Bloomberg Finance L.P.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#ifndef __bdb_verify_h
#define __bdb_verify_h
#include "verify.h"
struct bdb_state_type;
typedef struct thdpool thdpool;
typedef enum {
PROCESS_SEQUENTIAL,
PROCESS_DATA,
PROCESS_KEY,
PROCESS_BLOB
} processing_type;
// common data for all verify threads
typedef struct {
bdb_state_type *bdb_state;
struct dbtable *db_table;
const char *tablename;
int (*partial_datacopy_callback)(const struct dbtable *tbl, const int pd_ix, const void *inbuf, void *outbuf);
int (*formkey_callback)(const struct dbtable *tbl, void *dta, void *blob_parm,
int ix, void *keyout, int *keysz);
int (*get_blob_sizes_callback)(const struct dbtable *tbl, void *dta, int blobs[16],
int bloboffs[16], int *nblobs);
int (*vtag_callback)(void *parm, void *dta, int *dtasz, uint8_t ver);
int (*add_blob_buffer_callback)(void *parm, void *dta, int dtasz, int blobno);
void (*free_blob_buffer_callback)(void *parm);
unsigned long long (*verify_indexes_callback)(void *parm, void *dta, void *blob_parm);
char *header; // header string for printing for prog rep in default mode
uint64_t items_processed; // atomic inc: for progres report
uint64_t saved_progress; // previous progress counter
uint64_t records_processed; // progress report in default mode
int nrecs_progress; // progress done in this time window
unsigned int last_connection_check; // last reported time in ms
int progress_report_seconds; // freq of report in seconds
int progress_report_counter; // counter used to print progress
int attempt_fix;
unsigned int threads_spawned;
unsigned int threads_completed; // atomic inc
verify_mode_t verify_mode;
uint8_t client_dropped_connection;
uint8_t lock_desired;
uint8_t verify_status; // 0 success, 1 failure
verify_peer_check_func *peer_check;
verify_response_func *verify_response;
void *arg;
} verify_common_t;
// verify per thread processing info
typedef struct td_processing_info {
verify_common_t *common_params;
processing_type type;
int8_t blobno;
int8_t dtastripe;
int8_t index;
} td_processing_info_t;
void bdb_verify_enqueue(td_processing_info_t *, thdpool *);
#endif