File indexing completed on 2025-01-18 09:59:38
0001
0002
0003
0004
0005
0006
0007 #ifndef INCLUDE_git_odb_backend_h__
0008 #define INCLUDE_git_odb_backend_h__
0009
0010 #include "common.h"
0011 #include "types.h"
0012 #include "indexer.h"
0013
0014
0015
0016
0017
0018
0019
0020
0021 GIT_BEGIN_DECL
0022
0023
0024
0025
0026
0027
0028 typedef struct {
0029 unsigned int version;
0030
0031
0032
0033
0034
0035 git_oid_t oid_type;
0036 } git_odb_backend_pack_options;
0037
0038
0039 #define GIT_ODB_BACKEND_PACK_OPTIONS_VERSION 1
0040
0041
0042
0043
0044 #define GIT_ODB_BACKEND_PACK_OPTIONS_INIT \
0045 { GIT_ODB_BACKEND_PACK_OPTIONS_VERSION }
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055 #ifdef GIT_EXPERIMENTAL_SHA256
0056 GIT_EXTERN(int) git_odb_backend_pack(
0057 git_odb_backend **out,
0058 const char *objects_dir,
0059 const git_odb_backend_pack_options *opts);
0060 #else
0061 GIT_EXTERN(int) git_odb_backend_pack(
0062 git_odb_backend **out,
0063 const char *objects_dir);
0064 #endif
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077 #ifdef GIT_EXPERIMENTAL_SHA256
0078 GIT_EXTERN(int) git_odb_backend_one_pack(
0079 git_odb_backend **out,
0080 const char *index_file,
0081 const git_odb_backend_pack_options *opts);
0082 #else
0083 GIT_EXTERN(int) git_odb_backend_one_pack(
0084 git_odb_backend **out,
0085 const char *index_file);
0086 #endif
0087
0088 typedef enum {
0089 GIT_ODB_BACKEND_LOOSE_FSYNC = (1 << 0)
0090 } git_odb_backend_loose_flag_t;
0091
0092
0093 typedef struct {
0094 unsigned int version;
0095
0096
0097 uint32_t flags;
0098
0099
0100
0101
0102
0103
0104
0105
0106 int compression_level;
0107
0108
0109 unsigned int dir_mode;
0110
0111
0112 unsigned int file_mode;
0113
0114
0115
0116
0117
0118 git_oid_t oid_type;
0119 } git_odb_backend_loose_options;
0120
0121
0122 #define GIT_ODB_BACKEND_LOOSE_OPTIONS_VERSION 1
0123
0124
0125
0126
0127 #define GIT_ODB_BACKEND_LOOSE_OPTIONS_INIT \
0128 { GIT_ODB_BACKEND_LOOSE_OPTIONS_VERSION, 0, -1 }
0129
0130
0131
0132
0133
0134
0135
0136
0137
0138
0139 #ifdef GIT_EXPERIMENTAL_SHA256
0140 GIT_EXTERN(int) git_odb_backend_loose(
0141 git_odb_backend **out,
0142 const char *objects_dir,
0143 git_odb_backend_loose_options *opts);
0144 #else
0145 GIT_EXTERN(int) git_odb_backend_loose(
0146 git_odb_backend **out,
0147 const char *objects_dir,
0148 int compression_level,
0149 int do_fsync,
0150 unsigned int dir_mode,
0151 unsigned int file_mode);
0152 #endif
0153
0154
0155 typedef enum {
0156 GIT_STREAM_RDONLY = (1 << 1),
0157 GIT_STREAM_WRONLY = (1 << 2),
0158 GIT_STREAM_RW = (GIT_STREAM_RDONLY | GIT_STREAM_WRONLY)
0159 } git_odb_stream_t;
0160
0161
0162
0163
0164
0165
0166
0167
0168
0169 struct git_odb_stream {
0170 git_odb_backend *backend;
0171 unsigned int mode;
0172 void *hash_ctx;
0173
0174 #ifdef GIT_EXPERIMENTAL_SHA256
0175 git_oid_t oid_type;
0176 #endif
0177
0178 git_object_size_t declared_size;
0179 git_object_size_t received_bytes;
0180
0181
0182
0183
0184 int GIT_CALLBACK(read)(git_odb_stream *stream, char *buffer, size_t len);
0185
0186
0187
0188
0189 int GIT_CALLBACK(write)(git_odb_stream *stream, const char *buffer, size_t len);
0190
0191
0192
0193
0194
0195
0196
0197
0198
0199
0200
0201 int GIT_CALLBACK(finalize_write)(git_odb_stream *stream, const git_oid *oid);
0202
0203
0204
0205
0206
0207
0208
0209 void GIT_CALLBACK(free)(git_odb_stream *stream);
0210 };
0211
0212
0213 struct git_odb_writepack {
0214 git_odb_backend *backend;
0215
0216 int GIT_CALLBACK(append)(git_odb_writepack *writepack, const void *data, size_t size, git_indexer_progress *stats);
0217 int GIT_CALLBACK(commit)(git_odb_writepack *writepack, git_indexer_progress *stats);
0218 void GIT_CALLBACK(free)(git_odb_writepack *writepack);
0219 };
0220
0221 GIT_END_DECL
0222
0223 #endif