From fbdc9db3643e89e26d6e49f7b4e4ec1c668a4f0d Mon Sep 17 00:00:00 2001 From: Edward Thomson Date: Thu, 22 Jan 2015 16:10:06 -0600 Subject: filters: introduce streaming filters Add structures and preliminary functions to take a buffer, file or blob and write the contents in chunks through an arbitrary number of chained filters, finally writing into a user-provided function accept the contents. --- include/git2/sys/filter.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'include/git2/sys') diff --git a/include/git2/sys/filter.h b/include/git2/sys/filter.h index 60248271a..cc06c54ad 100644 --- a/include/git2/sys/filter.h +++ b/include/git2/sys/filter.h @@ -208,6 +208,19 @@ typedef int (*git_filter_apply_fn)( const git_buf *from, const git_filter_source *src); +struct git_filter_stream { + int (*write)(git_filter_stream *stream, const char *buffer, size_t len); + int (*close)(git_filter_stream *stream); + void (*free)(git_filter_stream *stream); +}; + +typedef int (*git_filter_stream_fn)( + git_filter_stream **out, + git_filter *self, + void **payload, + const git_filter_source *src, + git_filter_stream *next); + /** * Callback to clean up after filtering has been applied * @@ -247,6 +260,7 @@ struct git_filter { git_filter_shutdown_fn shutdown; git_filter_check_fn check; git_filter_apply_fn apply; + git_filter_stream_fn stream; git_filter_cleanup_fn cleanup; }; -- cgit v1.2.1