#ifndef INCLUDE_git_odb_backend_h__
#define INCLUDE_git_odb_backend_h__
#include "common.h"
#include "types.h"
GIT_BEGIN_DECL
GIT_EXTERN(int) git_odb_backend_pack(git_odb_backend **out, const char *objects_dir);
GIT_EXTERN(int) git_odb_backend_loose(
git_odb_backend **out,
const char *objects_dir,
int compression_level,
int do_fsync,
unsigned int dir_mode,
unsigned int file_mode);
GIT_EXTERN(int) git_odb_backend_one_pack(git_odb_backend **out, const char *index_file);
typedef enum {
GIT_STREAM_RDONLY = (1 << 1),
GIT_STREAM_WRONLY = (1 << 2),
GIT_STREAM_RW = (GIT_STREAM_RDONLY | GIT_STREAM_WRONLY),
} git_odb_stream_t;
struct git_odb_stream {
git_odb_backend *backend;
unsigned int mode;
void *hash_ctx;
git_off_t declared_size;
git_off_t received_bytes;
int (*read)(git_odb_stream *stream, char *buffer, size_t len);
int (*write)(git_odb_stream *stream, const char *buffer, size_t len);
int (*finalize_write)(git_odb_stream *stream, const git_oid *oid);
void (*free)(git_odb_stream *stream);
};
struct git_odb_writepack {
git_odb_backend *backend;
int (*append)(git_odb_writepack *writepack, const void *data, size_t size, git_transfer_progress *stats);
int (*commit)(git_odb_writepack *writepack, git_transfer_progress *stats);
void (*free)(git_odb_writepack *writepack);
};
GIT_END_DECL
#endif