containers / common

Location for shared common files in github.com/containers repos.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[optimize] add a new parameter to LoadOptions

kakaZhou719 opened this issue · comments

hi containers team,

when i learning our code, I found that If i knew the format of the tar file in advance , the program wouldn't need to guess the format, which will save a lot of time.

so , should we add a new parameter to indicate the format of load package on LoadOptions ?

FYI:

for _, f := range []func() ([]string, string, error){

Hi @kakaZhou719,

Thanks for reaching out and offering help, very much appreciated!

I found that If i knew the format of the tar file in advance , the program wouldn't need to guess the format, which will save a lot of time.

That sounds like a nice improvement assuming the user knows exactly the format of the archive.

Before starting, I want to ask @mtrmac and @rhatdan what they think about your proposal.

Fine with me. But I would like to hear from @mtrmac

If this is for a new caller, I think a set of separate functions (Runtime.LoadDockerArchive etc.) would be simpler.

If this is for the primary podman load $path code path, yes, an option probably makes sense — and it would be great to update as many callers as possible to use that option; heuristically guessing among four possibly quite expensive readers is very inefficient and historically resulted in bad error messages (which we have, sort of, fixed by just listing all of the error messages…)

@rhatdan @mtrmac @vrothberg ,thanks for your kind reply.

BTW, could we support to set temporary directory when loading?

the reason is that some image is very large, and require at least three times free disk to load. I see that current default temporary directory is the /var/tmp/ directory. If we could set the work temporary directory, we can separate it from the system disk which will avoid load failure.

BTW, could we support to set temporary directory when loading?

That’s configurable in c/image via BigFilesTemporaryDir, and c/common/libimage seems to read containers.conf for that at least in some places, so that would be the setting to tweak. (I didn’t check if LoadDockerArchive applies this setting; if not, that should be added.)

Yes setting this in containers.conf, or setting the TMPDIR environment variable allow you to customize this.

@rhatdan @mtrmac @vrothberg , do we have a plan to support a set of separate functions (Runtime.LoadDockerArchive) ?

@rhatdan @mtrmac @vrothberg , do we have a plan to support a set of separate functions (Runtime.LoadDockerArchive) ?

I would rather add a Format string field to the LoadOptions. Otherwise, all callers would have the same dispatch table (switch Format case ... case ... case ...).