Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notary client refactor - simpler reader interface #1377

Merged
merged 1 commit into from
Aug 30, 2018

Conversation

cyli
Copy link
Contributor

@cyli cyli commented Aug 1, 2018

Refactor the notary client library to have a separate reader and loader that may be easier to use for clients that do not need any publishing capabilities.

Originally proposed something similar in #968 - this just makes it easier to set up a downloading client that can read to an in-memory cache, or just something that will load from cache without having to provide a CryptoService, etc.

The plan is, if this PR passes design and code review, for a new PR converting all the client_update_tests to just use the LoadTUFRepo function and an in-memory cache.

cc @justincormack

@cyli
Copy link
Contributor Author

cyli commented Aug 2, 2018

(Test issues are due to GAS being renamed - I’ll fix that in a separate PR)

// Repository represents the set of options that must be supported over a TUF repo.
// Reader represents the set of options that must be supported over a TUF repo for
// reading
type Reader interface {
Copy link
Contributor

Choose a reason for hiding this comment

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

Wondering if there is a better name than Reader as that usually means an io.Reader...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am happy to name it something else. Alternately we could just make those methods that take a TUF repo instead of having a wrapper

@cyli cyli force-pushed the notary-client-refactor branch from 3b71249 to 88698de Compare August 6, 2018 19:01
Copy link
Contributor

@endophage endophage left a comment

Choose a reason for hiding this comment

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

LGTM, this is great.

I agree with @justincormack's comment on Reader, maybe call it ReadOnly? Then one would be doing something like

import "github.com/theupdateframework/notary/client"

...
client.NewReadOnly(...)

When combined with the package name I think it's very clear semantics.

@cyli cyli force-pushed the notary-client-refactor branch from 88698de to ad5ee33 Compare August 13, 2018 17:36
@cyli
Copy link
Contributor Author

cyli commented Aug 13, 2018

Thanks for the feedback @justincormack and @endophage! Renamed to ReadOnly.

@cyli cyli force-pushed the notary-client-refactor branch from ad5ee33 to 8f41690 Compare August 13, 2018 18:19
@cyli
Copy link
Contributor Author

cyli commented Aug 23, 2018

I think there were some gosec ci issues in this branch, and I’ll rebase but ci will probably still fail until #1382 is merged

cc @riyazdf @ecordell if you could have a look as well, since we had discussed this possible refactor way way earlier?

@cyli cyli force-pushed the notary-client-refactor branch from 8f41690 to 4096cf4 Compare August 23, 2018 23:25
Copy link
Contributor

@riyazdf riyazdf left a comment

Choose a reason for hiding this comment

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

big 👍 for this change!

// Repository represents the set of options that must be supported over a TUF repo.
// ReadOnly represents the set of options that must be supported over a TUF repo for
// reading
type ReadOnly interface {
Copy link
Contributor

Choose a reason for hiding this comment

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

nice 👍

…loader

that may be easier to use for clients that do not need any publishing
capabilities.

Signed-off-by: Ying Li <[email protected]>
@cyli cyli force-pushed the notary-client-refactor branch from 4096cf4 to c6360bf Compare August 29, 2018 21:57
@cyli cyli merged commit fb795b0 into notaryproject:master Aug 30, 2018
@cyli cyli deleted the notary-client-refactor branch August 31, 2018 04:33
@thaJeztah
Copy link
Contributor

🎉

/cc @tiborvass @anusha-ragunathan this one's merged

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

Successfully merging this pull request may close these issues.

5 participants