|
1 | 1 | #ifndef OBJECT_STORE_H
|
2 | 2 | #define OBJECT_STORE_H
|
3 | 3 |
|
4 |
| -#include "cache.h" |
| 4 | +#include "object.h" |
5 | 5 | #include "oidmap.h"
|
6 | 6 | #include "list.h"
|
7 | 7 | #include "oid-array.h"
|
@@ -284,6 +284,69 @@ int pretend_object_file(void *, unsigned long, enum object_type,
|
284 | 284 |
|
285 | 285 | int force_object_loose(const struct object_id *oid, time_t mtime);
|
286 | 286 |
|
| 287 | +struct object_info { |
| 288 | + /* Request */ |
| 289 | + enum object_type *typep; |
| 290 | + unsigned long *sizep; |
| 291 | + off_t *disk_sizep; |
| 292 | + struct object_id *delta_base_oid; |
| 293 | + struct strbuf *type_name; |
| 294 | + void **contentp; |
| 295 | + |
| 296 | + /* Response */ |
| 297 | + enum { |
| 298 | + OI_CACHED, |
| 299 | + OI_LOOSE, |
| 300 | + OI_PACKED, |
| 301 | + OI_DBCACHED |
| 302 | + } whence; |
| 303 | + union { |
| 304 | + /* |
| 305 | + * struct { |
| 306 | + * ... Nothing to expose in this case |
| 307 | + * } cached; |
| 308 | + * struct { |
| 309 | + * ... Nothing to expose in this case |
| 310 | + * } loose; |
| 311 | + */ |
| 312 | + struct { |
| 313 | + struct packed_git *pack; |
| 314 | + off_t offset; |
| 315 | + unsigned int is_delta; |
| 316 | + } packed; |
| 317 | + } u; |
| 318 | +}; |
| 319 | + |
| 320 | +/* |
| 321 | + * Initializer for a "struct object_info" that wants no items. You may |
| 322 | + * also memset() the memory to all-zeroes. |
| 323 | + */ |
| 324 | +#define OBJECT_INFO_INIT { 0 } |
| 325 | + |
| 326 | +/* Invoke lookup_replace_object() on the given hash */ |
| 327 | +#define OBJECT_INFO_LOOKUP_REPLACE 1 |
| 328 | +/* Allow reading from a loose object file of unknown/bogus type */ |
| 329 | +#define OBJECT_INFO_ALLOW_UNKNOWN_TYPE 2 |
| 330 | +/* Do not retry packed storage after checking packed and loose storage */ |
| 331 | +#define OBJECT_INFO_QUICK 8 |
| 332 | +/* |
| 333 | + * Do not attempt to fetch the object if missing (even if fetch_is_missing is |
| 334 | + * nonzero). |
| 335 | + */ |
| 336 | +#define OBJECT_INFO_SKIP_FETCH_OBJECT 16 |
| 337 | +/* |
| 338 | + * This is meant for bulk prefetching of missing blobs in a partial |
| 339 | + * clone. Implies OBJECT_INFO_SKIP_FETCH_OBJECT and OBJECT_INFO_QUICK |
| 340 | + */ |
| 341 | +#define OBJECT_INFO_FOR_PREFETCH (OBJECT_INFO_SKIP_FETCH_OBJECT | OBJECT_INFO_QUICK) |
| 342 | + |
| 343 | +/* Die if object corruption (not just an object being missing) was detected. */ |
| 344 | +#define OBJECT_INFO_DIE_IF_CORRUPT 32 |
| 345 | + |
| 346 | +int oid_object_info_extended(struct repository *r, |
| 347 | + const struct object_id *, |
| 348 | + struct object_info *, unsigned flags); |
| 349 | + |
287 | 350 | /*
|
288 | 351 | * Open the loose object at path, check its hash, and return the contents,
|
289 | 352 | * use the "oi" argument to assert things about the object, or e.g. populate its
|
@@ -381,69 +444,6 @@ static inline void obj_read_unlock(void)
|
381 | 444 | pthread_mutex_unlock(&obj_read_mutex);
|
382 | 445 | }
|
383 | 446 |
|
384 |
| -struct object_info { |
385 |
| - /* Request */ |
386 |
| - enum object_type *typep; |
387 |
| - unsigned long *sizep; |
388 |
| - off_t *disk_sizep; |
389 |
| - struct object_id *delta_base_oid; |
390 |
| - struct strbuf *type_name; |
391 |
| - void **contentp; |
392 |
| - |
393 |
| - /* Response */ |
394 |
| - enum { |
395 |
| - OI_CACHED, |
396 |
| - OI_LOOSE, |
397 |
| - OI_PACKED, |
398 |
| - OI_DBCACHED |
399 |
| - } whence; |
400 |
| - union { |
401 |
| - /* |
402 |
| - * struct { |
403 |
| - * ... Nothing to expose in this case |
404 |
| - * } cached; |
405 |
| - * struct { |
406 |
| - * ... Nothing to expose in this case |
407 |
| - * } loose; |
408 |
| - */ |
409 |
| - struct { |
410 |
| - struct packed_git *pack; |
411 |
| - off_t offset; |
412 |
| - unsigned int is_delta; |
413 |
| - } packed; |
414 |
| - } u; |
415 |
| -}; |
416 |
| - |
417 |
| -/* |
418 |
| - * Initializer for a "struct object_info" that wants no items. You may |
419 |
| - * also memset() the memory to all-zeroes. |
420 |
| - */ |
421 |
| -#define OBJECT_INFO_INIT { 0 } |
422 |
| - |
423 |
| -/* Invoke lookup_replace_object() on the given hash */ |
424 |
| -#define OBJECT_INFO_LOOKUP_REPLACE 1 |
425 |
| -/* Allow reading from a loose object file of unknown/bogus type */ |
426 |
| -#define OBJECT_INFO_ALLOW_UNKNOWN_TYPE 2 |
427 |
| -/* Do not retry packed storage after checking packed and loose storage */ |
428 |
| -#define OBJECT_INFO_QUICK 8 |
429 |
| -/* |
430 |
| - * Do not attempt to fetch the object if missing (even if fetch_is_missing is |
431 |
| - * nonzero). |
432 |
| - */ |
433 |
| -#define OBJECT_INFO_SKIP_FETCH_OBJECT 16 |
434 |
| -/* |
435 |
| - * This is meant for bulk prefetching of missing blobs in a partial |
436 |
| - * clone. Implies OBJECT_INFO_SKIP_FETCH_OBJECT and OBJECT_INFO_QUICK |
437 |
| - */ |
438 |
| -#define OBJECT_INFO_FOR_PREFETCH (OBJECT_INFO_SKIP_FETCH_OBJECT | OBJECT_INFO_QUICK) |
439 |
| - |
440 |
| -/* Die if object corruption (not just an object being missing) was detected. */ |
441 |
| -#define OBJECT_INFO_DIE_IF_CORRUPT 32 |
442 |
| - |
443 |
| -int oid_object_info_extended(struct repository *r, |
444 |
| - const struct object_id *, |
445 |
| - struct object_info *, unsigned flags); |
446 |
| - |
447 | 447 | /*
|
448 | 448 | * Iterate over the files in the loose-object parts of the object
|
449 | 449 | * directory "path", triggering the following callbacks:
|
|
0 commit comments