Skip to content
This repository has been archived by the owner on Sep 11, 2020. It is now read-only.

Expose Storage cache. #949

Merged
merged 1 commit into from
Sep 8, 2018
Merged

Expose Storage cache. #949

merged 1 commit into from
Sep 8, 2018

Conversation

kuba--
Copy link
Contributor

@kuba-- kuba-- commented Sep 7, 2018

Signed-off-by: kuba-- [email protected]

If we want to let apps. adjust cache size (or pass own implementation) we need to expose it somehow.
It's related to src-d/gitbase#440
Also we don't need to return an error from constructors like NewStorage.

@kuba-- kuba-- requested a review from mcuadros September 7, 2018 07:32
@ajnavarro ajnavarro requested review from jfontan, erizocosmico, smola and mcuadros and removed request for mcuadros September 7, 2018 07:33

return s, nil
func (s *ObjectStorage) WithCache(cache cache.Object) *ObjectStorage {
s.deltaBaseCache = cache
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cache should be passed to the constructor in the same way we do with the dotgit instance since is required, the options are optional, but if in the case of the cache the LRU is being instanced always in the constructor wasting resources.

func NewObjectStorage(dir *dotgit.DotGit, cache cache.Object) *ObjectStorage {

@kuba--
Copy link
Contributor Author

kuba-- commented Sep 7, 2018

@mcuadros - now cache is required param in constructors.

if oe != nil {
continue
}
o := NewObjectStorage(dg, cache.NewObjectLRUDefault())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we use here s.deltaBaseCache ?

Copy link
Contributor Author

@kuba-- kuba-- Sep 7, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ohh, good question - I think so.
Done (@ajnavarro )

Signed-off-by: kuba-- <[email protected]>
@mcuadros mcuadros merged commit 208b3c3 into src-d:master Sep 8, 2018
@kuba-- kuba-- deleted the custom-cache branch September 8, 2018 22:41
@maguro
Copy link
Contributor

maguro commented Nov 29, 2018

Oy gevalt! A backward incompatible change passed off in a minor release. Thanks!

@vmarkovtsev
Copy link
Contributor

@maguro This is how you learn to use vendoring and dep.

@johanbrandhorst
Copy link

Not sure why the dismissive tone, this is indeed a breaking change, and it should not have been merged. I've raised #1262. I think the signature change should be reverted.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants