-
Notifications
You must be signed in to change notification settings - Fork 534
cache: reuse object cache for delta resolution, use LRU policy #514
Conversation
plumbing/cache/object_lru.go
Outdated
c.actualSize += objSize | ||
} | ||
|
||
// Get returns an object by its hash. If the object is not found in the cache. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the object is not found in the cache, what happens?
plumbing/cache/object_lru.go
Outdated
} | ||
|
||
// Put puts an object into the cache. | ||
func (c *ObjectLRU) Put(obj plumbing.EncodedObject) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain more what will happen if the object is already into the cache?
storage/filesystem/object.go
Outdated
dir *dotgit.DotGit | ||
index map[plumbing.Hash]*packfile.Index | ||
} | ||
|
||
func newObjectStorage(dir *dotgit.DotGit) (ObjectStorage, error) { | ||
s := ObjectStorage{ | ||
dir: dir, | ||
DeltaBaseCache: cache.NewObjectLRU(92 * cache.MiByte), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we put the 92 * cache.MiByte
as a constant?
* renamed Add to Put * Get returns a second bool value to indicate if there was hit or miss.
Reuse delta base object cache for packfile decoders across multiple instances.
Codecov Report
@@ Coverage Diff @@
## master #514 +/- ##
==========================================
- Coverage 78.42% 77.66% -0.77%
==========================================
Files 128 128
Lines 9519 9539 +20
==========================================
- Hits 7465 7408 -57
- Misses 1246 1338 +92
+ Partials 808 793 -15
Continue to review full report at Codecov.
|
No description provided.