Skip to content

Commit a819a3d

Browse files
committed
Merge branch 'ps/reftable-api-revamp'
Overhaul of the reftable API. * ps/reftable-api-revamp: reftable/table: move printing logic into test helper reftable/constants: make block types part of the public interface reftable/table: introduce iterator for table blocks reftable/table: add `reftable_table` to the public interface reftable/block: expose a generic iterator over reftable records reftable/block: make block iterators reseekable reftable/block: store block pointer in the block iterator reftable/block: create public interface for reading blocks git-zlib: use `struct z_stream_s` instead of typedef reftable/block: rename `block_reader` to `reftable_block` reftable/block: rename `block` to `block_data` reftable/table: move reading block into block reader reftable/block: simplify how we track restart points reftable/blocksource: consolidate code into a single file reftable/reader: rename data structure to "table" reftable: fix formatting of the license header
2 parents 0c9d6b7 + e001118 commit a819a3d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1635
-1274
lines changed

Documentation/howto/recover-corrupted-object-harder.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ static int try_zlib(unsigned char *buf, int len)
125125
{
126126
/* make this absurdly large so we don't have to loop */
127127
static unsigned char out[1024*1024];
128-
z_stream z;
128+
struct z_stream_s z;
129129
int ret;
130130
131131
memset(&z, 0, sizeof(z));
@@ -278,7 +278,7 @@ int main(int argc, char **argv)
278278
static unsigned char buf[25 * 1024 * 1024];
279279
static unsigned char out[25 * 1024 * 1024];
280280
int len;
281-
z_stream z;
281+
struct z_stream_s z;
282282
int ret;
283283
284284
len = read(0, buf, sizeof(buf));

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1377,10 +1377,10 @@ UNIT_TEST_PROGRAMS += t-reftable-basics
13771377
UNIT_TEST_PROGRAMS += t-reftable-block
13781378
UNIT_TEST_PROGRAMS += t-reftable-merged
13791379
UNIT_TEST_PROGRAMS += t-reftable-pq
1380-
UNIT_TEST_PROGRAMS += t-reftable-reader
13811380
UNIT_TEST_PROGRAMS += t-reftable-readwrite
13821381
UNIT_TEST_PROGRAMS += t-reftable-record
13831382
UNIT_TEST_PROGRAMS += t-reftable-stack
1383+
UNIT_TEST_PROGRAMS += t-reftable-table
13841384
UNIT_TEST_PROGS = $(patsubst %,$(UNIT_TEST_BIN)/%$X,$(UNIT_TEST_PROGRAMS))
13851385
UNIT_TEST_OBJS += $(UNIT_TEST_DIR)/test-lib.o
13861386
UNIT_TEST_OBJS += $(UNIT_TEST_DIR)/lib-reftable.o
@@ -2737,10 +2737,10 @@ REFTABLE_OBJS += reftable/blocksource.o
27372737
REFTABLE_OBJS += reftable/iter.o
27382738
REFTABLE_OBJS += reftable/merged.o
27392739
REFTABLE_OBJS += reftable/pq.o
2740-
REFTABLE_OBJS += reftable/reader.o
27412740
REFTABLE_OBJS += reftable/record.o
27422741
REFTABLE_OBJS += reftable/stack.o
27432742
REFTABLE_OBJS += reftable/system.o
2743+
REFTABLE_OBJS += reftable/table.o
27442744
REFTABLE_OBJS += reftable/tree.o
27452745
REFTABLE_OBJS += reftable/writer.o
27462746

compat/zlib-compat.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
#ifdef HAVE_ZLIB_NG
55
# include <zlib-ng.h>
66

7-
# define z_stream zng_stream
8-
#define gz_header_s zng_gz_header_s
7+
# define z_stream_s zng_stream_s
8+
# define gz_header_s zng_gz_header_s
99

1010
# define crc32(crc, buf, len) zng_crc32(crc, buf, len)
1111

git-zlib.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include "compat/zlib-compat.h"
55

66
typedef struct git_zstream {
7-
z_stream z;
7+
struct z_stream_s z;
88
unsigned long avail_in;
99
unsigned long avail_out;
1010
unsigned long total_in;

meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,10 +446,10 @@ libgit_sources = [
446446
'reftable/iter.c',
447447
'reftable/merged.c',
448448
'reftable/pq.c',
449-
'reftable/reader.c',
450449
'reftable/record.c',
451450
'reftable/stack.c',
452451
'reftable/system.c',
452+
'reftable/table.c',
453453
'reftable/tree.c',
454454
'reftable/writer.c',
455455
'remote.c',

reftable/basics.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/*
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-
*/
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+
*/
88

99
#define REFTABLE_ALLOW_BANNED_ALLOCATORS
1010
#include "basics.h"

reftable/basics.h

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/*
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-
*/
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+
*/
88

99
#ifndef BASICS_H
1010
#define BASICS_H
@@ -18,13 +18,6 @@ license that can be found in the LICENSE file or at
1818

1919
#define REFTABLE_UNUSED __attribute__((__unused__))
2020

21-
struct reftable_buf {
22-
size_t alloc;
23-
size_t len;
24-
char *buf;
25-
};
26-
#define REFTABLE_BUF_INIT { 0 }
27-
2821
/*
2922
* Initialize the buffer such that it is ready for use. This is equivalent to
3023
* using REFTABLE_BUF_INIT for stack-allocated variables.

0 commit comments

Comments
 (0)