Documentation ¶
Index ¶
- func Dial(socket string, timeout time.Duration) (net.Conn, error)
- func GenIsoImage(isoPath string, volumeId string, srcDir string) error
- func MapToJson(m map[string]interface{}) string
- func MapToJsonUnindented(m map[string]interface{}) string
- func NewFakeDownloader(baseDir string) *fakeDownloader
- func NewUuid() string
- func NewUuid5(nsUuid, s string) string
- func ReadJson(filename string, v interface{}) error
- func Tempfile() (string, error)
- func WaitLoop(test func() (bool, error), retryPeriod time.Duration, timeout time.Duration, ...) error
- func WriteFiles(targetDir string, content map[string][]byte) error
- func WriteJson(filename string, v interface{}, perm os.FileMode) error
- type Downloader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenIsoImage ¶
GenIsoImage generates an ISO 9660 filesystem image containing files from srcDir. It uses specified volumeId as the volume id.
func MapToJson ¶
MapToJson converts the specified map object to indented JSON. It panics in case if the map connot be converted.
func MapToJsonUnindented ¶
MapToJson converts the specified map object to unindented JSON. It panics in case if the map connot be converted.
func NewFakeDownloader ¶
func NewFakeDownloader(baseDir string) *fakeDownloader
NewFakeDownloader returns a fake downloader that places fake downloaded files under the specified dir. The fake downloader writes the location passed to it into the file instead of actually downloading it.
func WaitLoop ¶
func WaitLoop(test func() (bool, error), retryPeriod time.Duration, timeout time.Duration, clock clockwork.Clock) error
WaitLoop executes test func in loop until it returns error, true, or the timeout elapses. clock argument denotes a clock object to use for waiting. When clock is nil, WaitLoop uses clockwork.NewRealClock()
func WriteFiles ¶
WriteFiles writes the files specified as a map under `targetDir`. The keys of the map are subpaths and values are file contents. WriteFiles automatically creates any non-existing directories mentioned in subpaths.
Types ¶
type Downloader ¶
type Downloader interface { // DownloadFile downloads the specified file and returns path // to it DownloadFile(location string) (string, error) }
Downloader is an interface for downloading files from web
func NewDownloader ¶
func NewDownloader(protocol string) Downloader
NewDownloader returns the default downloader for 'protocol'. The default downloader downloads a file via an URL constructed as 'protocol://location' and saves it in temporary file in default system directory for temporary files