1 | /* |
2 | * drv_ssd_ce.c |
3 | * |
4 | * Copyright (C) 2014-2019 Aerospike, Inc. |
5 | * |
6 | * Portions may be licensed to Aerospike, Inc. under one or more contributor |
7 | * license agreements. |
8 | * |
9 | * This program is free software: you can redistribute it and/or modify it under |
10 | * the terms of the GNU Affero General Public License as published by the Free |
11 | * Software Foundation, either version 3 of the License, or (at your option) any |
12 | * later version. |
13 | * |
14 | * This program is distributed in the hope that it will be useful, but WITHOUT |
15 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
16 | * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more |
17 | * details. |
18 | * |
19 | * You should have received a copy of the GNU Affero General Public License |
20 | * along with this program. If not, see http://www.gnu.org/licenses/ |
21 | */ |
22 | |
23 | #include "storage/drv_ssd.h" |
24 | #include <stdbool.h> |
25 | #include <stddef.h> |
26 | #include <stdint.h> |
27 | #include "fault.h" |
28 | #include "base/datamodel.h" |
29 | #include "storage/flat.h" |
30 | #include "storage/storage.h" |
31 | |
32 | |
33 | void |
34 | ssd_resume_devices(drv_ssds* ssds) |
35 | { |
36 | // Should not get here - for enterprise version only. |
37 | cf_crash(AS_DRV_SSD, "community edition called ssd_resume_devices()" ); |
38 | } |
39 | |
40 | void* |
41 | run_ssd_cool_start(void* udata) |
42 | { |
43 | // Should not get here - for enterprise version only. |
44 | cf_crash(AS_DRV_SSD, "community edition called run_ssd_cool_start()" ); |
45 | |
46 | return NULL; |
47 | } |
48 | |
49 | void |
50 | (const as_namespace* ns, drv_ssd* ssd, |
51 | ssd_device_header* ) |
52 | { |
53 | if (ns->single_bin) { |
54 | header->common.prefix.flags |= SSD_HEADER_FLAG_SINGLE_BIN; |
55 | } |
56 | } |
57 | |
58 | void |
59 | (const as_namespace* ns, drv_ssd* ssd, |
60 | const ssd_device_header* ) |
61 | { |
62 | if ((header->common.prefix.flags & SSD_HEADER_FLAG_SINGLE_BIN) != 0) { |
63 | if (! ns->single_bin) { |
64 | cf_crash(AS_DRV_SSD, "device has 'single-bin' data but 'single-bin' is not configured" ); |
65 | } |
66 | } |
67 | else { |
68 | if (ns->single_bin) { |
69 | cf_crash(AS_DRV_SSD, "device has multi-bin data but 'single-bin' is configured" ); |
70 | } |
71 | } |
72 | } |
73 | |
74 | void |
75 | ssd_flush_final_cfg(as_namespace* ns) |
76 | { |
77 | } |
78 | |
79 | bool |
80 | ssd_cold_start_is_valid_n_bins(uint32_t n_bins) |
81 | { |
82 | // FIXME - what should we do here? |
83 | cf_assert(n_bins != 0, AS_DRV_SSD, |
84 | "community edition found tombstone - erase drive and restart" ); |
85 | |
86 | return n_bins <= BIN_NAMES_QUOTA; |
87 | } |
88 | |
89 | void |
90 | ssd_cold_start_adjust_cenotaph(as_namespace* ns, bool block_has_bins, |
91 | uint32_t block_void_time, as_record* r) |
92 | { |
93 | // Nothing to do - relevant for enterprise version only. |
94 | } |
95 | |
96 | void |
97 | ssd_cold_start_transition_record(as_namespace* ns, const as_flat_record* flat, |
98 | as_record* r, bool is_create) |
99 | { |
100 | // Nothing to do - relevant for enterprise version only. |
101 | } |
102 | |
103 | void |
104 | ssd_cold_start_drop_cenotaphs(as_namespace* ns) |
105 | { |
106 | // Nothing to do - relevant for enterprise version only. |
107 | } |
108 | |
109 | void |
110 | ssd_adjust_versions(as_namespace* ns, ssd_common_pmeta* pmeta) |
111 | { |
112 | // Nothing to do - relevant for enterprise version only. |
113 | } |
114 | |
115 | conflict_resolution_pol |
116 | ssd_cold_start_policy(as_namespace *ns) |
117 | { |
118 | return AS_NAMESPACE_CONFLICT_RESOLUTION_POLICY_LAST_UPDATE_TIME; |
119 | } |
120 | |
121 | void |
122 | ssd_cold_start_init_repl_state(as_namespace* ns, as_record* r) |
123 | { |
124 | // Nothing to do - relevant for enterprise version only. |
125 | } |
126 | |
127 | void |
128 | ssd_init_commit(drv_ssd *ssd) |
129 | { |
130 | // Nothing to do - relevant for enterprise version only. |
131 | } |
132 | |
133 | uint64_t |
134 | ssd_flush_max_us(const as_namespace *ns) |
135 | { |
136 | return ns->storage_flush_max_us; |
137 | } |
138 | |
139 | int |
140 | ssd_write_bins(as_storage_rd *rd) |
141 | { |
142 | return ssd_buffer_bins(rd); |
143 | } |
144 | |
145 | void |
146 | as_storage_start_tomb_raider_ssd(as_namespace* ns) |
147 | { |
148 | // Tomb raider is for enterprise version only. |
149 | } |
150 | |
151 | int |
152 | as_storage_record_write_ssd(as_storage_rd* rd) |
153 | { |
154 | // All record writes except defrag come through here! |
155 | return as_bin_inuse_has(rd) ? ssd_write(rd) : 0; |
156 | } |
157 | |
158 | void |
159 | as_storage_cfg_init_ssd(as_namespace* ns) |
160 | { |
161 | } |
162 | |
163 | void |
164 | ssd_encrypt(drv_ssd *ssd, uint64_t off, as_flat_record *flat) |
165 | { |
166 | } |
167 | |
168 | void |
169 | ssd_decrypt(drv_ssd *ssd, uint64_t off, as_flat_record *flat) |
170 | { |
171 | } |
172 | |
173 | void |
174 | ssd_decrypt_whole(drv_ssd *ssd, uint64_t off, uint32_t n_rblocks, |
175 | as_flat_record *flat) |
176 | { |
177 | } |
178 | |
179 | void |
180 | ssd_prefetch_wblock(drv_ssd *ssd, uint64_t file_offset, uint8_t *read_buf) |
181 | { |
182 | // Should not get here - for enterprise version only. |
183 | cf_crash(AS_DRV_SSD, "community edition called ssd_prefetch_wblock()" ); |
184 | } |
185 | |