Skip to content

Commit e303bf2

Browse files
hanwengitster
authored andcommitted
reftable: (de)serialization for the polymorphic record type.
The reftable format is structured as a sequence of blocks, and each block contains a sequence of prefix-compressed key-value records. There are 4 types of records, and they have similarities in how they must be handled. This is achieved by introducing a polymorphic 'record' type that encapsulates ref, log, index and object records. Signed-off-by: Han-Wen Nienhuys <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 1214aa8 commit e303bf2

File tree

7 files changed

+1901
-1
lines changed

7 files changed

+1901
-1
lines changed

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2453,7 +2453,9 @@ REFTABLE_OBJS += reftable/basics.o
24532453
REFTABLE_OBJS += reftable/error.o
24542454
REFTABLE_OBJS += reftable/blocksource.o
24552455
REFTABLE_OBJS += reftable/publicbasics.o
2456+
REFTABLE_OBJS += reftable/record.o
24562457

2458+
REFTABLE_TEST_OBJS += reftable/record_test.o
24572459
REFTABLE_TEST_OBJS += reftable/test_framework.o
24582460
REFTABLE_TEST_OBJS += reftable/basics_test.o
24592461

reftable/constants.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
Copyright 2020 Google LLC
3+
4+
Use of this source code is governed by a BSD-style
5+
license that can be found in the LICENSE file or at
6+
https://developers.google.com/open-source/licenses/bsd
7+
*/
8+
9+
#ifndef CONSTANTS_H
10+
#define CONSTANTS_H
11+
12+
#define BLOCK_TYPE_LOG 'g'
13+
#define BLOCK_TYPE_INDEX 'i'
14+
#define BLOCK_TYPE_REF 'r'
15+
#define BLOCK_TYPE_OBJ 'o'
16+
#define BLOCK_TYPE_ANY 0
17+
18+
#define MAX_RESTARTS ((1 << 16) - 1)
19+
#define DEFAULT_BLOCK_SIZE 4096
20+
21+
#endif

0 commit comments

Comments
 (0)