Git-Raw

 view release on metacpan or  search on metacpan

deps/libgit2/include/git2/odb.h  view on Meta::CPAN


/**
 * Write an object directly into the ODB
 *
 * This method writes a full object straight into the ODB.
 * For most cases, it is preferred to write objects through a write
 * stream, which is both faster and less memory intensive, specially
 * for big objects.
 *
 * This method is provided for compatibility with custom backends
 * which are not able to support streaming writes
 *
 * @param out pointer to store the OID result of the write
 * @param odb object database where to store the object
 * @param data buffer with the data to store
 * @param len size of the buffer
 * @param type type of the data to store
 * @return 0 or an error code
 */
GIT_EXTERN(int) git_odb_write(git_oid *out, git_odb *odb, const void *data, size_t len, git_object_t type);

deps/libgit2/include/git2/odb.h  view on Meta::CPAN

 *
 * @param out pointer to store the resulting object's id
 * @param stream the stream
 * @return 0 on success, an error code otherwise
 */
GIT_EXTERN(int) git_odb_stream_finalize_write(git_oid *out, git_odb_stream *stream);

/**
 * Read from an odb stream
 *
 * Most backends don't implement streaming reads
 *
 * @param stream the stream
 * @param buffer a user-allocated buffer to store the data in.
 * @param len the buffer's length
 * @return 0 if the read succeeded, error code otherwise
 */
GIT_EXTERN(int) git_odb_stream_read(git_odb_stream *stream, char *buffer, size_t len);

/**
 * Free an odb stream
 *
 * @param stream the stream to free
 */
GIT_EXTERN(void) git_odb_stream_free(git_odb_stream *stream);

/**
 * Open a stream to read an object from the ODB
 *
 * Note that most backends do *not* support streaming reads
 * because they store their objects as compressed/delta'ed blobs.
 *
 * It's recommended to use `git_odb_read` instead, which is
 * assured to work on all backends.
 *
 * The returned stream will be of type `GIT_STREAM_RDONLY` and
 * will have the following methods:
 *
 *		- stream->read: read `n` bytes from the stream
 *		- stream->free: free the stream

deps/libgit2/include/git2/sys/filter.h  view on Meta::CPAN

	void                   **payload, /* may be read and/or set */
	git_buf                 *to,
	const git_buf           *from,
	const git_filter_source *src);
#endif

/**
 * Callback to perform the data filtering.
 *
 * Specified as `filter.stream`, this is a callback that filters data
 * in a streaming manner.  This function will provide a
 * `git_writestream` that will the original data will be written to;
 * with that data, the `git_writestream` will then perform the filter
 * translation and stream the filtered data out to the `next` location.
 */
typedef int GIT_CALLBACK(git_filter_stream_fn)(
	git_writestream        **out,
	git_filter              *self,
	void                   **payload,
	const git_filter_source *src,
	git_writestream         *next);

deps/libgit2/include/git2/types.h  view on Meta::CPAN

 *                                    commit not already in local clone
 */
typedef enum {
	GIT_SUBMODULE_RECURSE_NO = 0,
	GIT_SUBMODULE_RECURSE_YES = 1,
	GIT_SUBMODULE_RECURSE_ONDEMAND = 2
} git_submodule_recurse_t;

typedef struct git_writestream git_writestream;

/** A type to write in a streaming fashion, for example, for filters. */
struct git_writestream {
	int GIT_CALLBACK(write)(git_writestream *stream, const char *buffer, size_t len);
	int GIT_CALLBACK(close)(git_writestream *stream);
	void GIT_CALLBACK(free)(git_writestream *stream);
};

/** Representation of .mailmap file state. */
typedef struct git_mailmap git_mailmap;

/** @} */

deps/libgit2/src/libgit2/blob.c  view on Meta::CPAN

			 * directly from disk */
			error = write_file_stream(id, odb, content_path, size);
		else {
			/* We need to apply one or more filters */
			error = write_file_filtered(id, &size, odb, content_path, fl, repo);

			git_filter_list_free(fl);
		}

		/*
		 * TODO: eventually support streaming filtered files, for files
		 * which are bigger than a given threshold. This is not a priority
		 * because applying a filter in streaming mode changes the final
		 * size of the blob, and without knowing its final size, the blob
		 * cannot be written in stream mode to the ODB.
		 *
		 * The plan is to do streaming writes to a tempfile on disk and then
		 * opening streaming that file to the ODB, using
		 * `write_file_stream`.
		 *
		 * CAREFULLY DESIGNED APIS YO
		 */
	}

done:
	git_odb_free(odb);
	git_str_dispose(&path);

deps/libgit2/src/libgit2/odb.c  view on Meta::CPAN


		if (b->write != NULL)
			error = b->write(b, oid, data, len, type);
	}
	git_mutex_unlock(&db->lock);

	if (!error || error == GIT_PASSTHROUGH)
		return 0;

	/* if no backends were able to write the object directly, we try a
	 * streaming write to the backends; just write the whole object into the
	 * stream in one push
	 */
	if ((error = git_odb_open_wstream(&stream, db, len, type)) != 0)
		return error;

	if ((error = stream->write(stream, data, len)) == 0)
		error = stream->finalize_write(stream, oid);

	git_odb_stream_free(stream);
	return error;



( run in 0.259 second using v1.01-cache-2.11-cpan-a5abf4f5562 )