Skip to content

Commit ffc9a34

Browse files
pks-tgitster
authored andcommitted
streaming: make the odb_read_stream definition public
Subsequent commits will move the backend-specific logic of setting up an object read stream into the specific subsystems. As the backends are now the ones that are responsible for allocating the stream they'll need to have the stream definition available to them. Make the stream definition public to prepare for this. Signed-off-by: Patrick Steinhardt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent c26da34 commit ffc9a34

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

streaming.c

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,8 @@
1212
#include "replace-object.h"
1313
#include "packfile.h"
1414

15-
typedef int (*close_istream_fn)(struct odb_read_stream *);
16-
typedef ssize_t (*read_istream_fn)(struct odb_read_stream *, char *, size_t);
17-
1815
#define FILTER_BUFFER (1024*16)
1916

20-
struct odb_read_stream {
21-
close_istream_fn close;
22-
read_istream_fn read;
23-
24-
enum object_type type;
25-
unsigned long size; /* inflated size of full object */
26-
};
27-
2817
/*****************************************************************
2918
*
3019
* Filtered stream

streaming.h

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,23 @@
77
#include "object.h"
88

99
struct object_database;
10-
/* opaque */
1110
struct odb_read_stream;
1211
struct stream_filter;
1312

13+
typedef int (*odb_read_stream_close_fn)(struct odb_read_stream *);
14+
typedef ssize_t (*odb_read_stream_read_fn)(struct odb_read_stream *, char *, size_t);
15+
16+
/*
17+
* A stream that can be used to read an object from the object database without
18+
* loading all of it into memory.
19+
*/
20+
struct odb_read_stream {
21+
odb_read_stream_close_fn close;
22+
odb_read_stream_read_fn read;
23+
enum object_type type;
24+
unsigned long size; /* inflated size of full object */
25+
};
26+
1427
struct odb_read_stream *open_istream(struct repository *, const struct object_id *,
1528
enum object_type *, unsigned long *,
1629
struct stream_filter *);

0 commit comments

Comments
 (0)