bottle

package
v1.16.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 15, 2025 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package bottle provides command and subcommands for manipulating bottles and bottle metadata.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompressionLevelFlags

func CompressionLevelFlags(flags *pflag.FlagSet, action *bottleactions.CompressionLevelOptions)

CompressionLevelFlags adds a flag for changing the default compression level for part compression.

func NewBottleCmd

func NewBottleCmd(tool *actions.DataTool) *cobra.Command

NewBottleCmd is the top level command that aggregates subcommands for interacting with bottles.

func PartSelectorFlags

func PartSelectorFlags(flags *pflag.FlagSet, action *bottle.PartSelectorOptions)

PartSelectorFlags adds flags for part selectors.

Types

type FSUtil

type FSUtil struct {
	RootDir string
	// contains filtered or unexported fields
}

FSUtil contains common utilities for working with a filesystem. NewFSUtil should be used to create a new instance. Using the struct directly is not recommended as it may not be initialized properly.

func NewFSUtil

func NewFSUtil(prefix string) (*FSUtil, error)

NewFSUtil creates a new FSUtil instance. A temporary directory is created with the given prefix. The directory needs to be removed by the caller with the built in `Close` method. Defer `Close` is not recommended as it ignores any errors while closing the complex filesystem.

func NewFSUtilWithSource

func NewFSUtilWithSource(prefix string, source rand.Source) (*FSUtil, error)

NewFSUtilWithSource is identical to NewFSUtil but allows a custom math/rand.Source to be used.

func (*FSUtil) AddDir

func (f *FSUtil) AddDir(fPath string) error

AddDir creates a directory. fPath is required to be a relative path.

func (*FSUtil) AddFileOfSize

func (f *FSUtil) AddFileOfSize(fPath string, size int64) error

AddFileOfSize creates a file with the given size, filled with random data. fPath is required to be a relative path.

func (*FSUtil) AddFileOfSizeDeterministic

func (f *FSUtil) AddFileOfSizeDeterministic(fPath string, size int64) error

AddFileOfSizeDeterministic creates a file with the given size, filled with deterministic data. fPath is required to be a relative path.

func (*FSUtil) AddFileWithData

func (f *FSUtil) AddFileWithData(fPath string, data []byte) error

AddFileWithData creates a file with the given data. fPath is required to be a relative path.

func (*FSUtil) Close

func (f *FSUtil) Close() error

Close removes the root directory.

func (*FSUtil) Open

func (f *FSUtil) Open(name string) (fs.File, error)

Open implements the io/fs.FS interface. name is required to be a relative path.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL