diff options
| author | Patrick Steinhardt <ps@pks.im> | 2025-11-23 19:59:43 +0100 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-11-23 12:56:46 -0800 |
| commit | 1599b68d5e960a12f5ac624f81c70ece317db5a6 (patch) | |
| tree | d5ed95793921811cc11010b5f92d239d810cc351 /streaming.h | |
| parent | 378ec56beba161abbef6e2c87d9bc2ac43c355f3 (diff) | |
| download | git-1599b68d5e960a12f5ac624f81c70ece317db5a6.tar.xz | |
streaming: move into object database subsystem
The "streaming" terminology is somewhat generic, so it may not be
immediately obvious that "streaming.{c,h}" is specific to the object
database. Rectify this by moving it into the "odb/" directory so that it
can be immediately attributed to the object subsystem.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'streaming.h')
| -rw-r--r-- | streaming.h | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/streaming.h b/streaming.h deleted file mode 100644 index 7cb55213b7..0000000000 --- a/streaming.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2011, Google Inc. - */ -#ifndef STREAMING_H -#define STREAMING_H 1 - -#include "object.h" - -struct object_database; -struct odb_read_stream; -struct stream_filter; - -typedef int (*odb_read_stream_close_fn)(struct odb_read_stream *); -typedef ssize_t (*odb_read_stream_read_fn)(struct odb_read_stream *, char *, size_t); - -/* - * A stream that can be used to read an object from the object database without - * loading all of it into memory. - */ -struct odb_read_stream { - odb_read_stream_close_fn close; - odb_read_stream_read_fn read; - enum object_type type; - unsigned long size; /* inflated size of full object */ -}; - -/* - * Create a new object stream for the given object database. Populates the type - * and size pointers with the object's info. An optional filter can be used to - * transform the object's content. - * - * Returns the stream on success, a `NULL` pointer otherwise. - */ -struct odb_read_stream *odb_read_stream_open(struct object_database *odb, - const struct object_id *oid, - enum object_type *type, - unsigned long *size, - struct stream_filter *filter); - -/* - * Close the given read stream and release all resources associated with it. - * Returns 0 on success, a negative error code otherwise. - */ -int odb_read_stream_close(struct odb_read_stream *stream); - -/* - * Read data from the stream into the buffer. Returns 0 on EOF and the number - * of bytes read on success. Returns a negative error code in case reading from - * the stream fails. - */ -ssize_t odb_read_stream_read(struct odb_read_stream *stream, void *buf, size_t len); - -/* - * Look up the object by its ID and write the full contents to the file - * descriptor. The object must be a blob, or the function will fail. When - * provided, the filter is used to transform the blob contents. - * - * `can_seek` should be set to 1 in case the given file descriptor can be - * seek(3p)'d on. This is used to support files with holes in case a - * significant portion of the blob contains NUL bytes. - * - * Returns a negative error code on failure, 0 on success. - */ -int odb_stream_blob_to_fd(struct object_database *odb, - int fd, - const struct object_id *oid, - struct stream_filter *filter, - int can_seek); - -#endif /* STREAMING_H */ |
