1/* -*- mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2// vim: ft=cpp:expandtab:ts=8:sw=4:softtabstop=4:
3#ident "$Id$"
4/*======
5This file is part of PerconaFT.
6
7
8Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
9
10 PerconaFT is free software: you can redistribute it and/or modify
11 it under the terms of the GNU General Public License, version 2,
12 as published by the Free Software Foundation.
13
14 PerconaFT is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
21
22----------------------------------------
23
24 PerconaFT is free software: you can redistribute it and/or modify
25 it under the terms of the GNU Affero General Public License, version 3,
26 as published by the Free Software Foundation.
27
28 PerconaFT is distributed in the hope that it will be useful,
29 but WITHOUT ANY WARRANTY; without even the implied warranty of
30 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
31 GNU Affero General Public License for more details.
32
33 You should have received a copy of the GNU Affero General Public License
34 along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
35======= */
36
37#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
38
39#pragma once
40
41#include "ft/cachetable/cachetable.h"
42
43void toku_rollback_flush_callback(CACHEFILE cachefile, int fd, BLOCKNUM logname, void *rollback_v, void** UU(disk_data), void *extraargs, PAIR_ATTR size, PAIR_ATTR* new_size, bool write_me, bool keep_me, bool for_checkpoint, bool UU(is_clone));
44int toku_rollback_fetch_callback(CACHEFILE cachefile, PAIR p, int fd, BLOCKNUM logname, uint32_t fullhash, void **rollback_pv, void** UU(disk_data), PAIR_ATTR *sizep, int * UU(dirtyp), void *extraargs);
45void toku_rollback_pe_est_callback(
46 void* rollback_v,
47 void* UU(disk_data),
48 long* bytes_freed_estimate,
49 enum partial_eviction_cost *cost,
50 void* UU(write_extraargs)
51 );
52int toku_rollback_pe_callback (
53 void *rollback_v,
54 PAIR_ATTR old_attr,
55 void* UU(extraargs),
56 void (*finalize)(PAIR_ATTR new_attr, void * extra),
57 void *finalize_extra
58 );
59bool toku_rollback_pf_req_callback(void* UU(ftnode_pv), void* UU(read_extraargs)) ;
60int toku_rollback_pf_callback(void* UU(ftnode_pv), void* UU(disk_data), void* UU(read_extraargs), int UU(fd), PAIR_ATTR* UU(sizep));
61void toku_rollback_clone_callback(void* value_data, void** cloned_value_data, long* clone_size, PAIR_ATTR* new_attr, bool for_checkpoint, void* write_extraargs);
62
63int toku_rollback_cleaner_callback (
64 void* UU(ftnode_pv),
65 BLOCKNUM UU(blocknum),
66 uint32_t UU(fullhash),
67 void* UU(extraargs)
68 );
69
70static inline CACHETABLE_WRITE_CALLBACK get_write_callbacks_for_rollback_log(FT ft) {
71 CACHETABLE_WRITE_CALLBACK wc;
72 wc.flush_callback = toku_rollback_flush_callback;
73 wc.pe_est_callback = toku_rollback_pe_est_callback;
74 wc.pe_callback = toku_rollback_pe_callback;
75 wc.cleaner_callback = toku_rollback_cleaner_callback;
76 wc.clone_callback = toku_rollback_clone_callback;
77 wc.checkpoint_complete_callback = nullptr;
78 wc.write_extraargs = ft;
79 return wc;
80}
81