@@ -122,12 +122,12 @@ void WriteComponentLabel(std::string *dest, ComponentLabel label) {
122
122
* unread byte, and label will be set to the decoded label value.
123
123
*/
124
124
bool ReadComponentLabel (absl::string_view *contents, ComponentLabel *label) {
125
- int64_t rawResult = 0 ;
125
+ int64_t raw_result = 0 ;
126
126
absl::string_view tmp (contents->data (), contents->size ());
127
- if (OrderedCode::ReadSignedNumIncreasing (&tmp, &rawResult )) {
128
- if (rawResult >= ComponentLabel::Terminator &&
129
- rawResult <= ComponentLabel::Unknown) {
130
- *label = static_cast <ComponentLabel>(rawResult );
127
+ if (OrderedCode::ReadSignedNumIncreasing (&tmp, &raw_result )) {
128
+ if (raw_result >= ComponentLabel::Terminator &&
129
+ raw_result <= ComponentLabel::Unknown) {
130
+ *label = static_cast <ComponentLabel>(raw_result );
131
131
*contents = absl::string_view (tmp.data (), tmp.size ());
132
132
return true ;
133
133
}
@@ -139,18 +139,18 @@ bool ReadComponentLabel(absl::string_view *contents, ComponentLabel *label) {
139
139
* Reads a component label from the given key contents.
140
140
*
141
141
* If the read is unsuccessful or if the read was successful but the label that
142
- * was read did not match the expectedLabel returns false and changes none of
142
+ * was read did not match the expected_label returns false and changes none of
143
143
* its arguments.
144
144
*
145
145
* If the read is successful, returns true and contents will be updated to the
146
146
* next unread byte.
147
147
*/
148
148
bool ReadComponentLabelMatching (absl::string_view *contents,
149
- ComponentLabel expectedLabel ) {
150
- int64_t rawResult = 0 ;
149
+ ComponentLabel expected_label ) {
150
+ int64_t raw_result = 0 ;
151
151
absl::string_view tmp = *contents;
152
- if (OrderedCode::ReadSignedNumIncreasing (&tmp, &rawResult )) {
153
- if (rawResult == expectedLabel ) {
152
+ if (OrderedCode::ReadSignedNumIncreasing (&tmp, &raw_result )) {
153
+ if (raw_result == expected_label ) {
154
154
*contents = tmp;
155
155
return true ;
156
156
}
@@ -169,12 +169,12 @@ bool ReadComponentLabelMatching(absl::string_view *contents,
169
169
* unread byte, and result will be set to the decoded integer value.
170
170
*/
171
171
bool ReadInt32 (absl::string_view *contents, int32_t *result) {
172
- int64_t rawResult = 0 ;
172
+ int64_t raw_result = 0 ;
173
173
absl::string_view tmp (contents->data (), contents->size ());
174
- if (OrderedCode::ReadSignedNumIncreasing (&tmp, &rawResult )) {
175
- if (rawResult >= INT32_MIN && rawResult <= INT32_MAX) {
174
+ if (OrderedCode::ReadSignedNumIncreasing (&tmp, &raw_result )) {
175
+ if (raw_result >= INT32_MIN && raw_result <= INT32_MAX) {
176
176
*contents = absl::string_view (tmp.data (), tmp.size ());
177
- *result = static_cast <int32_t >(rawResult );
177
+ *result = static_cast <int32_t >(raw_result );
178
178
return true ;
179
179
}
180
180
}
@@ -191,7 +191,7 @@ void WriteLabeledInt32(std::string *dest, ComponentLabel label, int32_t value) {
191
191
192
192
/* *
193
193
* Reads a component label and signed number from the given key contents and
194
- * verifies that the label matches the expectedLabel and the value fits in a
194
+ * verifies that the label matches the expected_label and the value fits in a
195
195
* 32-bit integer.
196
196
*
197
197
* If the read is unsuccessful, the label didn't match, or the number that was
@@ -202,13 +202,13 @@ void WriteLabeledInt32(std::string *dest, ComponentLabel label, int32_t value) {
202
202
* unread byte, and value will be set to the decoded integer value.
203
203
*/
204
204
bool ReadLabeledInt32 (absl::string_view *contents,
205
- ComponentLabel expectedLabel ,
205
+ ComponentLabel expected_label ,
206
206
int32_t *value) {
207
207
absl::string_view tmp (contents->data (), contents->size ());
208
- if (ReadComponentLabelMatching (&tmp, expectedLabel )) {
209
- absl::string_view tmpSlice = absl::string_view (tmp.data (), tmp.size ());
210
- if (ReadInt32 (&tmpSlice , value)) {
211
- *contents = tmpSlice ;
208
+ if (ReadComponentLabelMatching (&tmp, expected_label )) {
209
+ absl::string_view tmp_slice = absl::string_view (tmp.data (), tmp.size ());
210
+ if (ReadInt32 (&tmp_slice , value)) {
211
+ *contents = tmp_slice ;
212
212
return true ;
213
213
}
214
214
}
@@ -227,7 +227,7 @@ void WriteLabeledString(std::string *dest,
227
227
228
228
/* *
229
229
* Reads a component label and a string from the given key contents and verifies
230
- * that the label matches the expectedLabel .
230
+ * that the label matches the expected_label .
231
231
*
232
232
* If the read is unsuccessful or the label didn't match, returns false, and
233
233
* changes none of its arguments.
@@ -236,10 +236,10 @@ void WriteLabeledString(std::string *dest,
236
236
* unread byte, and value will be set to the decoded string value.
237
237
*/
238
238
bool ReadLabeledString (absl::string_view *contents,
239
- ComponentLabel expectedLabel ,
239
+ ComponentLabel expected_label ,
240
240
std::string *value) {
241
241
absl::string_view tmp (contents->data (), contents->size ());
242
- if (ReadComponentLabelMatching (&tmp, expectedLabel )) {
242
+ if (ReadComponentLabelMatching (&tmp, expected_label )) {
243
243
if (OrderedCode::ReadString (&tmp, value)) {
244
244
*contents = absl::string_view (tmp.data (), tmp.size ());
245
245
return true ;
@@ -251,8 +251,8 @@ bool ReadLabeledString(absl::string_view *contents,
251
251
252
252
/* *
253
253
* Reads a component label and a string from the given key contents and verifies
254
- * that the label matches the expectedLabel and the string matches the
255
- * expectedValue .
254
+ * that the label matches the expected_label and the string matches the
255
+ * expected_value .
256
256
*
257
257
* If the read is unsuccessful, the label or didn't match, or the string value
258
258
* didn't match, returns false, and changes none of its arguments.
@@ -261,12 +261,12 @@ bool ReadLabeledString(absl::string_view *contents,
261
261
* unread byte.
262
262
*/
263
263
bool ReadLabeledStringMatching (absl::string_view *contents,
264
- ComponentLabel expectedLabel ,
265
- const char *expectedValue ) {
264
+ ComponentLabel expected_label ,
265
+ const char *expected_value ) {
266
266
std::string value;
267
267
absl::string_view tmp = *contents;
268
- if (ReadLabeledString (&tmp, expectedLabel , &value)) {
269
- if (value == expectedValue ) {
268
+ if (ReadLabeledString (&tmp, expected_label , &value)) {
269
+ if (value == expected_value ) {
270
270
*contents = tmp;
271
271
return true ;
272
272
}
@@ -299,33 +299,33 @@ void WriteResourcePath(std::string *dest, const ResourcePath &path) {
299
299
* unread byte, and value will be set to the decoded document key.
300
300
*/
301
301
bool ReadDocumentKey (absl::string_view *contents, DocumentKey *result) {
302
- absl::string_view completeSegments = *contents;
302
+ absl::string_view complete_segments = *contents;
303
303
304
304
std::string segment;
305
305
std::vector<std::string> path_segments{};
306
306
for (;;) {
307
307
// Advance a temporary slice to avoid advancing contents into the next key
308
308
// component which may not be a path segment.
309
- absl::string_view readPosition (completeSegments .data (),
310
- completeSegments .size ());
311
- if (!ReadComponentLabelMatching (&readPosition ,
309
+ absl::string_view read_position (complete_segments .data (),
310
+ complete_segments .size ());
311
+ if (!ReadComponentLabelMatching (&read_position ,
312
312
ComponentLabel::PathSegment)) {
313
313
break ;
314
314
}
315
- if (!OrderedCode::ReadString (&readPosition , &segment)) {
315
+ if (!OrderedCode::ReadString (&read_position , &segment)) {
316
316
return false ;
317
317
}
318
318
319
319
path_segments.push_back (std::move (segment));
320
320
segment.clear ();
321
321
322
- completeSegments =
323
- absl::string_view (readPosition .data (), readPosition .size ());
322
+ complete_segments =
323
+ absl::string_view (read_position .data (), read_position .size ());
324
324
}
325
325
326
326
ResourcePath path{std::move (path_segments)};
327
327
if (path.size () > 0 && DocumentKey::IsDocumentKey (path)) {
328
- *contents = completeSegments ;
328
+ *contents = complete_segments ;
329
329
*result = DocumentKey (std::move (path));
330
330
return true ;
331
331
}
@@ -346,14 +346,14 @@ inline bool ReadTerminator(absl::string_view *contents) {
346
346
return result;
347
347
}
348
348
349
- inline void WriteTableName (std::string *dest, const char *tableName ) {
350
- WriteLabeledString (dest, ComponentLabel::TableName, tableName );
349
+ inline void WriteTableName (std::string *dest, const char *table_name ) {
350
+ WriteLabeledString (dest, ComponentLabel::TableName, table_name );
351
351
}
352
352
353
353
inline bool ReadTableNameMatching (absl::string_view *contents,
354
- const char *expectedTableName ) {
354
+ const char *expected_table_name ) {
355
355
return ReadLabeledStringMatching (contents, ComponentLabel::TableName,
356
- expectedTableName );
356
+ expected_table_name );
357
357
}
358
358
359
359
inline void WriteBatchID (std::string *dest, model::BatchId batch_id) {
@@ -405,7 +405,7 @@ std::string InvalidKey(const absl::string_view key) {
405
405
406
406
std::string Describe (const absl::string_view key) {
407
407
absl::string_view contents = key;
408
- bool isTerminated = false ;
408
+ bool is_terminated = false ;
409
409
410
410
std::string description;
411
411
absl::StrAppend (&description, " [" );
@@ -418,7 +418,7 @@ std::string Describe(const absl::string_view key) {
418
418
}
419
419
420
420
if (label == ComponentLabel::Terminator) {
421
- isTerminated = true ;
421
+ is_terminated = true ;
422
422
contents = tmp;
423
423
break ;
424
424
}
@@ -428,12 +428,12 @@ std::string Describe(const absl::string_view key) {
428
428
tmp = contents;
429
429
430
430
if (label == ComponentLabel::PathSegment) {
431
- DocumentKey documentKey ;
432
- if (!ReadDocumentKey (&tmp, &documentKey )) {
431
+ DocumentKey document_key ;
432
+ if (!ReadDocumentKey (&tmp, &document_key )) {
433
433
break ;
434
434
}
435
435
absl::StrAppend (&description,
436
- " key=" , documentKey .path ().CanonicalString ());
436
+ " key=" , document_key .path ().CanonicalString ());
437
437
438
438
} else if (label == ComponentLabel::TableName) {
439
439
std::string table;
@@ -481,7 +481,7 @@ std::string Describe(const absl::string_view key) {
481
481
if (contents.size () > 0 ) {
482
482
absl::StrAppend (&description, " invalid key=<" , InvalidKey (key), " >" );
483
483
484
- } else if (!isTerminated ) {
484
+ } else if (!is_terminated ) {
485
485
absl::StrAppend (&description, " incomplete key" );
486
486
}
487
487
@@ -674,11 +674,11 @@ std::string LevelDbTargetDocumentKey::KeyPrefix(model::TargetId target_id) {
674
674
}
675
675
676
676
std::string LevelDbTargetDocumentKey::Key (model::TargetId target_id,
677
- const DocumentKey &documentKey ) {
677
+ const DocumentKey &document_key ) {
678
678
std::string result;
679
679
WriteTableName (&result, kTargetDocumentsTable );
680
680
WriteTargetID (&result, target_id);
681
- WriteResourcePath (&result, documentKey .path ());
681
+ WriteResourcePath (&result, document_key .path ());
682
682
WriteTerminator (&result);
683
683
return result;
684
684
}
@@ -707,11 +707,11 @@ std::string LevelDbDocumentTargetKey::KeyPrefix(
707
707
return result;
708
708
}
709
709
710
- std::string LevelDbDocumentTargetKey::Key (const DocumentKey &documentKey ,
710
+ std::string LevelDbDocumentTargetKey::Key (const DocumentKey &document_key ,
711
711
model::TargetId target_id) {
712
712
std::string result;
713
713
WriteTableName (&result, kDocumentTargetsTable );
714
- WriteResourcePath (&result, documentKey .path ());
714
+ WriteResourcePath (&result, document_key .path ());
715
715
WriteTargetID (&result, target_id);
716
716
WriteTerminator (&result);
717
717
return result;
0 commit comments