leveldb
Classes | Enumerations | Functions | Variables
leveldb::log Namespace Reference

Classes

class  LogTest
 
class  Reader
 
class  Writer
 

Enumerations

enum  RecordType {
  kZeroType = 0, kFullType = 1, kFirstType = 2, kMiddleType = 3,
  kLastType = 4
}
 

Functions

static std::string BigString (const std::string &partial_string, size_t n)
 
static std::string NumberString (int n)
 
static std::string RandomSkewedString (int i, Random *rnd)
 
 TEST (LogTest, Empty)
 
 TEST (LogTest, ReadWrite)
 
 TEST (LogTest, ManyBlocks)
 
 TEST (LogTest, Fragmentation)
 
 TEST (LogTest, MarginalTrailer)
 
 TEST (LogTest, MarginalTrailer2)
 
 TEST (LogTest, ShortTrailer)
 
 TEST (LogTest, AlignedEof)
 
 TEST (LogTest, OpenForAppend)
 
 TEST (LogTest, RandomRead)
 
 TEST (LogTest, ReadError)
 
 TEST (LogTest, BadRecordType)
 
 TEST (LogTest, TruncatedTrailingRecordIsIgnored)
 
 TEST (LogTest, BadLength)
 
 TEST (LogTest, BadLengthAtEndIsIgnored)
 
 TEST (LogTest, ChecksumMismatch)
 
 TEST (LogTest, UnexpectedMiddleType)
 
 TEST (LogTest, UnexpectedLastType)
 
 TEST (LogTest, UnexpectedFullType)
 
 TEST (LogTest, UnexpectedFirstType)
 
 TEST (LogTest, MissingLastIsIgnored)
 
 TEST (LogTest, PartialLastIsIgnored)
 
 TEST (LogTest, SkipIntoMultiRecord)
 
 TEST (LogTest, ErrorJoinsRecords)
 
 TEST (LogTest, ReadStart)
 
 TEST (LogTest, ReadSecondOneOff)
 
 TEST (LogTest, ReadSecondTenThousand)
 
 TEST (LogTest, ReadSecondStart)
 
 TEST (LogTest, ReadThirdOneOff)
 
 TEST (LogTest, ReadThirdStart)
 
 TEST (LogTest, ReadFourthOneOff)
 
 TEST (LogTest, ReadFourthFirstBlockTrailer)
 
 TEST (LogTest, ReadFourthMiddleBlock)
 
 TEST (LogTest, ReadFourthLastBlock)
 
 TEST (LogTest, ReadFourthStart)
 
 TEST (LogTest, ReadInitialOffsetIntoBlockPadding)
 
 TEST (LogTest, ReadEnd)
 
 TEST (LogTest, ReadPastEnd)
 
static void InitTypeCrc (uint32_t *type_crc)
 

Variables

static const int kMaxRecordType = kLastType
 
static const int kBlockSize = 32768
 
static const int kHeaderSize = 4 + 2 + 1
 

Enumeration Type Documentation

§ RecordType

Enumerator
kZeroType 
kFullType 
kFirstType 
kMiddleType 
kLastType 

Definition at line 14 of file log_format.h.

14  {
15  // Zero is reserved for preallocated files
16  kZeroType = 0,
17 
18  kFullType = 1,
19 
20  // For fragments
21  kFirstType = 2,
22  kMiddleType = 3,
23  kLastType = 4
24 };

Function Documentation

§ BigString()

static std::string leveldb::log::BigString ( const std::string &  partial_string,
size_t  n 
)
static

Definition at line 18 of file log_test.cc.

18  {
19  std::string result;
20  while (result.size() < n) {
21  result.append(partial_string);
22  }
23  result.resize(n);
24  return result;
25 }
Here is the caller graph for this function:

§ InitTypeCrc()

static void leveldb::log::InitTypeCrc ( uint32_t *  type_crc)
static

Definition at line 15 of file log_writer.cc.

15  {
16  for (int i = 0; i <= kMaxRecordType; i++) {
17  char t = static_cast<char>(i);
18  type_crc[i] = crc32c::Value(&t, 1);
19  }
20 }
uint32_t Value(const char *data, size_t n)
Definition: crc32c.h:20
static const int kMaxRecordType
Definition: log_format.h:25
Here is the call graph for this function:
Here is the caller graph for this function:

§ NumberString()

static std::string leveldb::log::NumberString ( int  n)
static

Definition at line 28 of file log_test.cc.

28  {
29  char buf[50];
30  snprintf(buf, sizeof(buf), "%d.", n);
31  return std::string(buf);
32 }
Here is the caller graph for this function:

§ RandomSkewedString()

static std::string leveldb::log::RandomSkewedString ( int  i,
Random rnd 
)
static

Definition at line 35 of file log_test.cc.

35  {
36  return BigString(NumberString(i), rnd->Skewed(17));
37 }
static std::string BigString(const std::string &partial_string, size_t n)
Definition: log_test.cc:18
static std::string NumberString(int n)
Definition: log_test.cc:28
Here is the call graph for this function:
Here is the caller graph for this function:

§ TEST() [1/38]

leveldb::log::TEST ( LogTest  ,
Empty   
)

Definition at line 270 of file log_test.cc.

270  {
271  ASSERT_EQ("EOF", Read());
272 }
#define ASSERT_EQ(a, b)
Definition: testharness.h:107
Here is the call graph for this function:

§ TEST() [2/38]

leveldb::log::TEST ( LogTest  ,
ReadWrite   
)

Definition at line 274 of file log_test.cc.

274  {
275  Write("foo");
276  Write("bar");
277  Write("");
278  Write("xxxx");
279  ASSERT_EQ("foo", Read());
280  ASSERT_EQ("bar", Read());
281  ASSERT_EQ("", Read());
282  ASSERT_EQ("xxxx", Read());
283  ASSERT_EQ("EOF", Read());
284  ASSERT_EQ("EOF", Read()); // Make sure reads at eof work
285 }
#define ASSERT_EQ(a, b)
Definition: testharness.h:107
Here is the call graph for this function:

§ TEST() [3/38]

leveldb::log::TEST ( LogTest  ,
ManyBlocks   
)

Definition at line 287 of file log_test.cc.

287  {
288  for (int i = 0; i < 100000; i++) {
289  Write(NumberString(i));
290  }
291  for (int i = 0; i < 100000; i++) {
292  ASSERT_EQ(NumberString(i), Read());
293  }
294  ASSERT_EQ("EOF", Read());
295 }
#define ASSERT_EQ(a, b)
Definition: testharness.h:107
static std::string NumberString(int n)
Definition: log_test.cc:28
Here is the call graph for this function:

§ TEST() [4/38]

leveldb::log::TEST ( LogTest  ,
Fragmentation   
)

Definition at line 297 of file log_test.cc.

297  {
298  Write("small");
299  Write(BigString("medium", 50000));
300  Write(BigString("large", 100000));
301  ASSERT_EQ("small", Read());
302  ASSERT_EQ(BigString("medium", 50000), Read());
303  ASSERT_EQ(BigString("large", 100000), Read());
304  ASSERT_EQ("EOF", Read());
305 }
static std::string BigString(const std::string &partial_string, size_t n)
Definition: log_test.cc:18
#define ASSERT_EQ(a, b)
Definition: testharness.h:107
Here is the call graph for this function:

§ TEST() [5/38]

leveldb::log::TEST ( LogTest  ,
MarginalTrailer   
)

Definition at line 307 of file log_test.cc.

307  {
308  // Make a trailer that is exactly the same length as an empty record.
309  const int n = kBlockSize - 2*kHeaderSize;
310  Write(BigString("foo", n));
311  ASSERT_EQ(kBlockSize - kHeaderSize, WrittenBytes());
312  Write("");
313  Write("bar");
314  ASSERT_EQ(BigString("foo", n), Read());
315  ASSERT_EQ("", Read());
316  ASSERT_EQ("bar", Read());
317  ASSERT_EQ("EOF", Read());
318 }
static const int kHeaderSize
Definition: log_format.h:30
static std::string BigString(const std::string &partial_string, size_t n)
Definition: log_test.cc:18
static const int kBlockSize
Definition: log_format.h:27
#define ASSERT_EQ(a, b)
Definition: testharness.h:107
Here is the call graph for this function:

§ TEST() [6/38]

leveldb::log::TEST ( LogTest  ,
MarginalTrailer2   
)

Definition at line 320 of file log_test.cc.

320  {
321  // Make a trailer that is exactly the same length as an empty record.
322  const int n = kBlockSize - 2*kHeaderSize;
323  Write(BigString("foo", n));
324  ASSERT_EQ(kBlockSize - kHeaderSize, WrittenBytes());
325  Write("bar");
326  ASSERT_EQ(BigString("foo", n), Read());
327  ASSERT_EQ("bar", Read());
328  ASSERT_EQ("EOF", Read());
329  ASSERT_EQ(0, DroppedBytes());
330  ASSERT_EQ("", ReportMessage());
331 }
static const int kHeaderSize
Definition: log_format.h:30
static std::string BigString(const std::string &partial_string, size_t n)
Definition: log_test.cc:18
static const int kBlockSize
Definition: log_format.h:27
#define ASSERT_EQ(a, b)
Definition: testharness.h:107
Here is the call graph for this function:

§ TEST() [7/38]

leveldb::log::TEST ( LogTest  ,
ShortTrailer   
)

Definition at line 333 of file log_test.cc.

333  {
334  const int n = kBlockSize - 2*kHeaderSize + 4;
335  Write(BigString("foo", n));
336  ASSERT_EQ(kBlockSize - kHeaderSize + 4, WrittenBytes());
337  Write("");
338  Write("bar");
339  ASSERT_EQ(BigString("foo", n), Read());
340  ASSERT_EQ("", Read());
341  ASSERT_EQ("bar", Read());
342  ASSERT_EQ("EOF", Read());
343 }
static const int kHeaderSize
Definition: log_format.h:30
static std::string BigString(const std::string &partial_string, size_t n)
Definition: log_test.cc:18
static const int kBlockSize
Definition: log_format.h:27
#define ASSERT_EQ(a, b)
Definition: testharness.h:107
Here is the call graph for this function:

§ TEST() [8/38]

leveldb::log::TEST ( LogTest  ,
AlignedEof   
)

Definition at line 345 of file log_test.cc.

345  {
346  const int n = kBlockSize - 2*kHeaderSize + 4;
347  Write(BigString("foo", n));
348  ASSERT_EQ(kBlockSize - kHeaderSize + 4, WrittenBytes());
349  ASSERT_EQ(BigString("foo", n), Read());
350  ASSERT_EQ("EOF", Read());
351 }
static const int kHeaderSize
Definition: log_format.h:30
static std::string BigString(const std::string &partial_string, size_t n)
Definition: log_test.cc:18
static const int kBlockSize
Definition: log_format.h:27
#define ASSERT_EQ(a, b)
Definition: testharness.h:107
Here is the call graph for this function:

§ TEST() [9/38]

leveldb::log::TEST ( LogTest  ,
OpenForAppend   
)

Definition at line 353 of file log_test.cc.

353  {
354  Write("hello");
355  ReopenForAppend();
356  Write("world");
357  ASSERT_EQ("hello", Read());
358  ASSERT_EQ("world", Read());
359  ASSERT_EQ("EOF", Read());
360 }
#define ASSERT_EQ(a, b)
Definition: testharness.h:107
Here is the call graph for this function:

§ TEST() [10/38]

leveldb::log::TEST ( LogTest  ,
RandomRead   
)

Definition at line 362 of file log_test.cc.

362  {
363  const int N = 500;
364  Random write_rnd(301);
365  for (int i = 0; i < N; i++) {
366  Write(RandomSkewedString(i, &write_rnd));
367  }
368  Random read_rnd(301);
369  for (int i = 0; i < N; i++) {
370  ASSERT_EQ(RandomSkewedString(i, &read_rnd), Read());
371  }
372  ASSERT_EQ("EOF", Read());
373 }
#define ASSERT_EQ(a, b)
Definition: testharness.h:107
static std::string RandomSkewedString(int i, Random *rnd)
Definition: log_test.cc:35
Here is the call graph for this function:

§ TEST() [11/38]

leveldb::log::TEST ( LogTest  ,
ReadError   
)

Definition at line 377 of file log_test.cc.

377  {
378  Write("foo");
379  ForceError();
380  ASSERT_EQ("EOF", Read());
381  ASSERT_EQ(kBlockSize, DroppedBytes());
382  ASSERT_EQ("OK", MatchError("read error"));
383 }
static const int kBlockSize
Definition: log_format.h:27
#define ASSERT_EQ(a, b)
Definition: testharness.h:107
Here is the call graph for this function:

§ TEST() [12/38]

leveldb::log::TEST ( LogTest  ,
BadRecordType   
)

Definition at line 385 of file log_test.cc.

385  {
386  Write("foo");
387  // Type is stored in header[6]
388  IncrementByte(6, 100);
389  FixChecksum(0, 3);
390  ASSERT_EQ("EOF", Read());
391  ASSERT_EQ(3, DroppedBytes());
392  ASSERT_EQ("OK", MatchError("unknown record type"));
393 }
#define ASSERT_EQ(a, b)
Definition: testharness.h:107
Here is the call graph for this function:

§ TEST() [13/38]

leveldb::log::TEST ( LogTest  ,
TruncatedTrailingRecordIsIgnored   
)

Definition at line 395 of file log_test.cc.

395  {
396  Write("foo");
397  ShrinkSize(4); // Drop all payload as well as a header byte
398  ASSERT_EQ("EOF", Read());
399  // Truncated last record is ignored, not treated as an error.
400  ASSERT_EQ(0, DroppedBytes());
401  ASSERT_EQ("", ReportMessage());
402 }
#define ASSERT_EQ(a, b)
Definition: testharness.h:107
Here is the call graph for this function:

§ TEST() [14/38]

leveldb::log::TEST ( LogTest  ,
BadLength   
)

Definition at line 404 of file log_test.cc.

404  {
405  const int kPayloadSize = kBlockSize - kHeaderSize;
406  Write(BigString("bar", kPayloadSize));
407  Write("foo");
408  // Least significant size byte is stored in header[4].
409  IncrementByte(4, 1);
410  ASSERT_EQ("foo", Read());
411  ASSERT_EQ(kBlockSize, DroppedBytes());
412  ASSERT_EQ("OK", MatchError("bad record length"));
413 }
static const int kHeaderSize
Definition: log_format.h:30
static std::string BigString(const std::string &partial_string, size_t n)
Definition: log_test.cc:18
static const int kBlockSize
Definition: log_format.h:27
#define ASSERT_EQ(a, b)
Definition: testharness.h:107
Here is the call graph for this function:

§ TEST() [15/38]

leveldb::log::TEST ( LogTest  ,
BadLengthAtEndIsIgnored   
)

Definition at line 415 of file log_test.cc.

415  {
416  Write("foo");
417  ShrinkSize(1);
418  ASSERT_EQ("EOF", Read());
419  ASSERT_EQ(0, DroppedBytes());
420  ASSERT_EQ("", ReportMessage());
421 }
#define ASSERT_EQ(a, b)
Definition: testharness.h:107
Here is the call graph for this function:

§ TEST() [16/38]

leveldb::log::TEST ( LogTest  ,
ChecksumMismatch   
)

Definition at line 423 of file log_test.cc.

423  {
424  Write("foo");
425  IncrementByte(0, 10);
426  ASSERT_EQ("EOF", Read());
427  ASSERT_EQ(10, DroppedBytes());
428  ASSERT_EQ("OK", MatchError("checksum mismatch"));
429 }
#define ASSERT_EQ(a, b)
Definition: testharness.h:107
Here is the call graph for this function:

§ TEST() [17/38]

leveldb::log::TEST ( LogTest  ,
UnexpectedMiddleType   
)

Definition at line 431 of file log_test.cc.

431  {
432  Write("foo");
433  SetByte(6, kMiddleType);
434  FixChecksum(0, 3);
435  ASSERT_EQ("EOF", Read());
436  ASSERT_EQ(3, DroppedBytes());
437  ASSERT_EQ("OK", MatchError("missing start"));
438 }
#define ASSERT_EQ(a, b)
Definition: testharness.h:107
Here is the call graph for this function:

§ TEST() [18/38]

leveldb::log::TEST ( LogTest  ,
UnexpectedLastType   
)

Definition at line 440 of file log_test.cc.

440  {
441  Write("foo");
442  SetByte(6, kLastType);
443  FixChecksum(0, 3);
444  ASSERT_EQ("EOF", Read());
445  ASSERT_EQ(3, DroppedBytes());
446  ASSERT_EQ("OK", MatchError("missing start"));
447 }
#define ASSERT_EQ(a, b)
Definition: testharness.h:107
Here is the call graph for this function:

§ TEST() [19/38]

leveldb::log::TEST ( LogTest  ,
UnexpectedFullType   
)

Definition at line 449 of file log_test.cc.

449  {
450  Write("foo");
451  Write("bar");
452  SetByte(6, kFirstType);
453  FixChecksum(0, 3);
454  ASSERT_EQ("bar", Read());
455  ASSERT_EQ("EOF", Read());
456  ASSERT_EQ(3, DroppedBytes());
457  ASSERT_EQ("OK", MatchError("partial record without end"));
458 }
#define ASSERT_EQ(a, b)
Definition: testharness.h:107
Here is the call graph for this function:

§ TEST() [20/38]

leveldb::log::TEST ( LogTest  ,
UnexpectedFirstType   
)

Definition at line 460 of file log_test.cc.

460  {
461  Write("foo");
462  Write(BigString("bar", 100000));
463  SetByte(6, kFirstType);
464  FixChecksum(0, 3);
465  ASSERT_EQ(BigString("bar", 100000), Read());
466  ASSERT_EQ("EOF", Read());
467  ASSERT_EQ(3, DroppedBytes());
468  ASSERT_EQ("OK", MatchError("partial record without end"));
469 }
static std::string BigString(const std::string &partial_string, size_t n)
Definition: log_test.cc:18
#define ASSERT_EQ(a, b)
Definition: testharness.h:107
Here is the call graph for this function:

§ TEST() [21/38]

leveldb::log::TEST ( LogTest  ,
MissingLastIsIgnored   
)

Definition at line 471 of file log_test.cc.

471  {
472  Write(BigString("bar", kBlockSize));
473  // Remove the LAST block, including header.
474  ShrinkSize(14);
475  ASSERT_EQ("EOF", Read());
476  ASSERT_EQ("", ReportMessage());
477  ASSERT_EQ(0, DroppedBytes());
478 }
static std::string BigString(const std::string &partial_string, size_t n)
Definition: log_test.cc:18
static const int kBlockSize
Definition: log_format.h:27
#define ASSERT_EQ(a, b)
Definition: testharness.h:107
Here is the call graph for this function:

§ TEST() [22/38]

leveldb::log::TEST ( LogTest  ,
PartialLastIsIgnored   
)

Definition at line 480 of file log_test.cc.

480  {
481  Write(BigString("bar", kBlockSize));
482  // Cause a bad record length in the LAST block.
483  ShrinkSize(1);
484  ASSERT_EQ("EOF", Read());
485  ASSERT_EQ("", ReportMessage());
486  ASSERT_EQ(0, DroppedBytes());
487 }
static std::string BigString(const std::string &partial_string, size_t n)
Definition: log_test.cc:18
static const int kBlockSize
Definition: log_format.h:27
#define ASSERT_EQ(a, b)
Definition: testharness.h:107
Here is the call graph for this function:

§ TEST() [23/38]

leveldb::log::TEST ( LogTest  ,
SkipIntoMultiRecord   
)

Definition at line 489 of file log_test.cc.

489  {
490  // Consider a fragmented record:
491  // first(R1), middle(R1), last(R1), first(R2)
492  // If initial_offset points to a record after first(R1) but before first(R2)
493  // incomplete fragment errors are not actual errors, and must be suppressed
494  // until a new first or full record is encountered.
495  Write(BigString("foo", 3*kBlockSize));
496  Write("correct");
497  StartReadingAt(kBlockSize);
498 
499  ASSERT_EQ("correct", Read());
500  ASSERT_EQ("", ReportMessage());
501  ASSERT_EQ(0, DroppedBytes());
502  ASSERT_EQ("EOF", Read());
503 }
static std::string BigString(const std::string &partial_string, size_t n)
Definition: log_test.cc:18
static const int kBlockSize
Definition: log_format.h:27
#define ASSERT_EQ(a, b)
Definition: testharness.h:107
Here is the call graph for this function:

§ TEST() [24/38]

leveldb::log::TEST ( LogTest  ,
ErrorJoinsRecords   
)

Definition at line 505 of file log_test.cc.

505  {
506  // Consider two fragmented records:
507  // first(R1) last(R1) first(R2) last(R2)
508  // where the middle two fragments disappear. We do not want
509  // first(R1),last(R2) to get joined and returned as a valid record.
510 
511  // Write records that span two blocks
512  Write(BigString("foo", kBlockSize));
513  Write(BigString("bar", kBlockSize));
514  Write("correct");
515 
516  // Wipe the middle block
517  for (int offset = kBlockSize; offset < 2*kBlockSize; offset++) {
518  SetByte(offset, 'x');
519  }
520 
521  ASSERT_EQ("correct", Read());
522  ASSERT_EQ("EOF", Read());
523  const size_t dropped = DroppedBytes();
524  ASSERT_LE(dropped, 2*kBlockSize + 100);
525  ASSERT_GE(dropped, 2*kBlockSize);
526 }
#define ASSERT_LE(a, b)
Definition: testharness.h:111
static std::string BigString(const std::string &partial_string, size_t n)
Definition: log_test.cc:18
static const int kBlockSize
Definition: log_format.h:27
#define ASSERT_EQ(a, b)
Definition: testharness.h:107
#define ASSERT_GE(a, b)
Definition: testharness.h:109
Here is the call graph for this function:

§ TEST() [25/38]

leveldb::log::TEST ( LogTest  ,
ReadStart   
)

Definition at line 528 of file log_test.cc.

528  {
529  CheckInitialOffsetRecord(0, 0);
530 }
Here is the call graph for this function:

§ TEST() [26/38]

leveldb::log::TEST ( LogTest  ,
ReadSecondOneOff   
)

Definition at line 532 of file log_test.cc.

532  {
533  CheckInitialOffsetRecord(1, 1);
534 }
Here is the call graph for this function:

§ TEST() [27/38]

leveldb::log::TEST ( LogTest  ,
ReadSecondTenThousand   
)

Definition at line 536 of file log_test.cc.

536  {
537  CheckInitialOffsetRecord(10000, 1);
538 }
Here is the call graph for this function:

§ TEST() [28/38]

leveldb::log::TEST ( LogTest  ,
ReadSecondStart   
)

Definition at line 540 of file log_test.cc.

540  {
541  CheckInitialOffsetRecord(10007, 1);
542 }
Here is the call graph for this function:

§ TEST() [29/38]

leveldb::log::TEST ( LogTest  ,
ReadThirdOneOff   
)

Definition at line 544 of file log_test.cc.

544  {
545  CheckInitialOffsetRecord(10008, 2);
546 }
Here is the call graph for this function:

§ TEST() [30/38]

leveldb::log::TEST ( LogTest  ,
ReadThirdStart   
)

Definition at line 548 of file log_test.cc.

548  {
549  CheckInitialOffsetRecord(20014, 2);
550 }
Here is the call graph for this function:

§ TEST() [31/38]

leveldb::log::TEST ( LogTest  ,
ReadFourthOneOff   
)

Definition at line 552 of file log_test.cc.

552  {
553  CheckInitialOffsetRecord(20015, 3);
554 }
Here is the call graph for this function:

§ TEST() [32/38]

leveldb::log::TEST ( LogTest  ,
ReadFourthFirstBlockTrailer   
)

Definition at line 556 of file log_test.cc.

556  {
557  CheckInitialOffsetRecord(log::kBlockSize - 4, 3);
558 }
static const int kBlockSize
Definition: log_format.h:27
Here is the call graph for this function:

§ TEST() [33/38]

leveldb::log::TEST ( LogTest  ,
ReadFourthMiddleBlock   
)

Definition at line 560 of file log_test.cc.

560  {
561  CheckInitialOffsetRecord(log::kBlockSize + 1, 3);
562 }
static const int kBlockSize
Definition: log_format.h:27
Here is the call graph for this function:

§ TEST() [34/38]

leveldb::log::TEST ( LogTest  ,
ReadFourthLastBlock   
)

Definition at line 564 of file log_test.cc.

564  {
565  CheckInitialOffsetRecord(2 * log::kBlockSize + 1, 3);
566 }
static const int kBlockSize
Definition: log_format.h:27
Here is the call graph for this function:

§ TEST() [35/38]

leveldb::log::TEST ( LogTest  ,
ReadFourthStart   
)

Definition at line 568 of file log_test.cc.

568  {
569  CheckInitialOffsetRecord(
570  2 * (kHeaderSize + 1000) + (2 * log::kBlockSize - 1000) + 3 * kHeaderSize,
571  3);
572 }
static const int kHeaderSize
Definition: log_format.h:30
static const int kBlockSize
Definition: log_format.h:27
Here is the call graph for this function:

§ TEST() [36/38]

leveldb::log::TEST ( LogTest  ,
ReadInitialOffsetIntoBlockPadding   
)

Definition at line 574 of file log_test.cc.

574  {
575  CheckInitialOffsetRecord(3 * log::kBlockSize - 3, 5);
576 }
static const int kBlockSize
Definition: log_format.h:27
Here is the call graph for this function:

§ TEST() [37/38]

leveldb::log::TEST ( LogTest  ,
ReadEnd   
)

Definition at line 578 of file log_test.cc.

578  {
579  CheckOffsetPastEndReturnsNoRecords(0);
580 }
Here is the call graph for this function:

§ TEST() [38/38]

leveldb::log::TEST ( LogTest  ,
ReadPastEnd   
)

Definition at line 582 of file log_test.cc.

582  {
583  CheckOffsetPastEndReturnsNoRecords(5);
584 }
Here is the call graph for this function:

Variable Documentation

§ kBlockSize

const int leveldb::log::kBlockSize = 32768
static

Definition at line 27 of file log_format.h.

§ kHeaderSize

const int leveldb::log::kHeaderSize = 4 + 2 + 1
static

Definition at line 30 of file log_format.h.

§ kMaxRecordType

const int leveldb::log::kMaxRecordType = kLastType
static

Definition at line 25 of file log_format.h.