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

Expose Storage cache.#949

Merged
mcuadros merged 1 commit intosrc-d:masterfrom
kuba--:custom-cache
Sep 8, 2018
Merged

Expose Storage cache.#949
mcuadros merged 1 commit intosrc-d:masterfrom
kuba--:custom-cache

Conversation

@kuba--
Copy link
Copy Markdown
Contributor

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

Signed-off-by: kuba-- kuba@sourced.tech

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 erizocosmico, jfontan, mcuadros and smola and removed request for mcuadros September 7, 2018 07:33
Comment thread storage/filesystem/object.go Outdated

return s, nil
func (s *ObjectStorage) WithCache(cache cache.Object) *ObjectStorage {
s.deltaBaseCache = cache
Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

kuba-- commented Sep 7, 2018

@mcuadros - now cache is required param in constructors.

Comment thread storage/filesystem/object.go Outdated
if oe != nil {
continue
}
o := NewObjectStorage(dg, cache.NewObjectLRUDefault())
Copy link
Copy Markdown
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
Copy Markdown
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-- <kuba@sourced.tech>
@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
Copy Markdown
Contributor

maguro commented Nov 29, 2018

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

@vmarkovtsev
Copy link
Copy Markdown
Contributor

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

@johanbrandhorst
Copy link
Copy Markdown

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