Skip to content

Commit

Permalink
indexer: start writing the stream indexer
Browse files Browse the repository at this point in the history
This will allow us to index a packfile as soon as we receive it from
the network as well as storing it with its final name so we don't need
to pass temporary file names around.
  • Loading branch information
carlosmn committed Apr 16, 2012
1 parent 75dd7fd commit 201ebf2
Show file tree
Hide file tree
Showing 4 changed files with 336 additions and 45 deletions.
22 changes: 14 additions & 8 deletions include/git2/indexer.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,22 @@
GIT_BEGIN_DECL

/**
* This is passed as the first argument to the callback to allow the
* user to see the progress.
* Create a new streaming indexer instance
*
* @param out where to store the inexer instance
* @param path to the gitdir (metadata directory)
*/
typedef struct git_indexer_stats {
unsigned int total;
unsigned int processed;
} git_indexer_stats;

GIT_EXTERN(int) git_indexer_stream_new(git_indexer_stream **out, const char *gitdir);

typedef struct git_indexer git_indexer;
/**
* Add data to the indexer
*
* @param idx the indexer
* @param data the data to add
* @param size the size of the data
* @param stats stat storage
*/
GIT_EXTERN(int) git_indexer_stream_add(git_indexer_stream *idx, const void *data, size_t size, git_indexer_stats *stats);

/**
* Create a new indexer instance
Expand Down
9 changes: 9 additions & 0 deletions include/git2/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,15 @@ typedef struct git_remote git_remote;

typedef struct git_remote_head git_remote_head;

/** Information about the progress of the indexer */
typedef struct git_indexer_stats {
unsigned int total;
unsigned int processed;
} git_indexer_stats;

typedef struct git_indexer git_indexer;
typedef struct git_indexer_stream git_indexer_stream;

/** @} */
GIT_END_DECL

Expand Down
Loading

0 comments on commit 201ebf2

Please sign in to comment.