diff options
author | Carlos Martín Nieto <cmn@dwim.me> | 2012-12-21 13:59:10 +0400 |
---|---|---|
committer | Carlos Martín Nieto <cmn@dwim.me> | 2013-01-11 20:32:59 +0400 |
commit | c8f79c2bdf9dd237d5c407526bcfc20d4eff5e64 (patch) | |
tree | 03ba825bfa94cf1144218749118941a5a8082433 /src/pack.h | |
parent | 525d961c2442f3947517201113e375375fcf4280 (diff) |
pack: abstract out the cache into its own functions
Diffstat (limited to 'src/pack.h')
-rw-r--r-- | src/pack.h | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/pack.h b/src/pack.h index 732bfc3ff..4e5c12765 100644 --- a/src/pack.h +++ b/src/pack.h @@ -54,6 +54,7 @@ struct git_pack_idx_header { }; typedef struct git_pack_cache_entry { + int uses; /* enough? */ git_atomic refcount; git_rawobj raw; } git_pack_cache_entry; @@ -62,6 +63,15 @@ typedef struct git_pack_cache_entry { GIT__USE_OFFMAP; +#define GIT_PACK_CACHE_MEMORY_LIMIT 2 * 1024 * 1024; + +typedef struct { + size_t memory_used; + size_t memory_limit; + git_mutex lock; + git_offmap *entries; +} git_pack_cache; + struct git_pack_file { git_mwindow_file mwf; git_map index_map; @@ -77,8 +87,7 @@ struct git_pack_file { git_vector cache; git_oid **oids; - git_mutex bases_lock; - git_offmap *bases; /* delta base cache */ + git_pack_cache bases; /* delta base cache */ /* something like ".git/objects/pack/xxxxx.pack" */ char pack_name[GIT_FLEX_ARRAY]; /* more */ |