-
Notifications
You must be signed in to change notification settings - Fork 45
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
allow configuring larger max layer size in build time #314
Conversation
add unit tests Signed-off-by: 2rigor <[email protected]>
Signed-off-by: 2rigor <[email protected]>
@wagoodman I don't know how it works. I see you were involved in many PRs. Will you guys automatically have a look at new PR or I should assign it (to whom)? Thanks! |
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.
Hey @2rigor -- thanks for the contribution. We might like to take a different approach to allow for modifying the per-file read limit. Specifying this at build time doesn't allow configuration at runtime, which is probably the most important spot.
What if instead of making the change as you've implemented it, we just change the perFileReadLimit
to a var
, and add an exported function to set it; e.g.:
var perFileReadLimit = 2 * GB
func SetPerFileReadLimit(maxBytes int64) {
// some reasonable validation like maxBytes > 0?
perFileReadLimit = maxBytes
}
... this allows library users including Syft to configure this value via configuration files at runtime.
Hi @kzantow. There is a minor disadvantage of providing an ability to update during runtime - since this variable can be read from multiple goroutines (even if today it is not). I think I saw PR in syft about handling layers in parallel. Practically setting the variable would happen (should happen) before starting the traversal over the image, but having such a function provides an option to change the variable at any time. I still think it's acceptable. Just wanted to share my thoughts. |
f8d2d5d
to
6ee4035
Compare
Signed-off-by: 2rigor <[email protected]>
Yes, I don't think this is a problem, though -- if the value gets changed, it gets changed for the next reader; I don't think there's a concurrency issue with this. You can set this at initialization time by creating an |
Signed-off-by: 2rigor <[email protected]>
Got you, I agree it's better. Implemented as you originally suggested |
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.
LGTM -- thanks for the contribution @2rigor !
how can i set this value via syft? @kzantow |
@tomersein -- there is no way to configure this in Syft at the moment, but you could add a configuration to one of the options that in a |
hi, the 1st part I think I understand, maybe under catalogers field (because it is related to scan) |
Closes #311
E.g., for 10Gb (10*10^9 bytes) append to go build command:
-ldflags "-w -s -X github.com/anchore/stereoscope/pkg/file.perFileReadLimitStr=10000000000"