Documentation
¶
Index ¶
- Constants
- func EachMessage[T any](recv recvFunc[T], fn func(*T) error) error
- func EncodeResources(cmd *cli.Command, resources resourcetypes.Resources) (map[string][]byte, error)
- func EnvParser(b []byte) ([]byte, error)
- func ExitCoder(f cli.ActionFunc) cli.ActionFunc
- func ExtraResourcesFlag() *cli.StringFlag
- func FileFlag(usage string) *cli.StringSliceFlag
- func ForceFlag(usage string) *cli.BoolFlag
- func GetHostname() string
- func GetNetworks(network string) map[string]string
- func NewCoreRPCClient(ctx context.Context, cmd *cli.Command) (corepb.CoreRPCClient, error)
- func ParseDeployStrategy(name string) (corepb.DeployOptions_Strategy, error)
- func Positional(name, usage string, max int) []cli.Argument
- func ReadAllFiles(files []string) (map[string]*types.LinuxFile, error)
- func ReadSpecURI(ctx context.Context, uri string) ([]byte, error)
- func SplitEquality(elements []string) map[string]string
- func SplitFiles(files []string) (map[string]string, error)
- func StorageParams(storageRequest, storageLimit int64, volumesRequest, volumesLimit []string) resourcetypes.RawParams
- func StreamToChan[T any](recv recvFunc[T]) (<-chan *T, func() error)
- func TarDirectory(dir string) ([]byte, error)
- type FileOptions
- type FileSpec
Constants ¶
const ( ResourceCPUMem = "cpumem" ResourceStorage = "resource-storage" FlagExtraResources = "extra-resources" FlagFile = "file" FlagForce = "force" )
Variables ¶
This section is empty.
Functions ¶
func EachMessage ¶
func EncodeResources ¶
func EncodeResources(cmd *cli.Command, resources resourcetypes.Resources) (map[string][]byte, error)
EncodeResources encodes plugin params for the core rpc; --extra-resources fills only the plugins not already present.
func ExitCoder ¶
func ExitCoder(f cli.ActionFunc) cli.ActionFunc
ExitCoder turns an action error into a cli.ExitCoder.
func ExtraResourcesFlag ¶ added in v0.1.4
func ExtraResourcesFlag() *cli.StringFlag
ExtraResourcesFlag is the one --extra-resources every resource-taking command shares.
func FileFlag ¶ added in v0.1.4
func FileFlag(usage string) *cli.StringSliceFlag
FileFlag is the one --file every file-carrying command shares; usage says what the command does with the files.
func GetHostname ¶
func GetHostname() string
GetHostname returns the local hostname, empty when it cannot be read.
func GetNetworks ¶
GetNetworks returns a networkmode -> ip map.
func NewCoreRPCClient ¶
NewCoreRPCClient dials the core address in cmd and returns its RPC client.
func ParseDeployStrategy ¶
func ParseDeployStrategy(name string) (corepb.DeployOptions_Strategy, error)
ParseDeployStrategy maps a --deploy-strategy value onto the core enum.
func Positional ¶ added in v0.1.5
Positional declares one required positional argument, max -1 for an unlimited list.
func ReadAllFiles ¶
ReadAllFiles reads srcfile:dstfile[:mode[:uid:gid]] pairs into a dstfile keyed map.
func ReadSpecURI ¶ added in v0.1.4
func SplitEquality ¶
SplitEquality turns a list of key=value strings into a map.
func SplitFiles ¶
SplitFiles turns a list of src:dst strings into a map.
func StorageParams ¶ added in v0.1.2
func StorageParams(storageRequest, storageLimit int64, volumesRequest, volumesLimit []string) resourcetypes.RawParams
StorageParams builds the storage plugin request; zero values stay out, so an untouched entry defers to --extra-resources.
func StreamToChan ¶
StreamToChan returns a wait func that reports the recv error once the channel is drained.
func TarDirectory ¶ added in v0.1.1
TarDirectory packs dir into an uncompressed tar whose entry names are relative to dir.
Types ¶
type FileOptions ¶
type FileOptions struct {
Data map[string][]byte
Modes map[string]*corepb.FileMode
Owners map[string]*corepb.FileOwner
}
FileOptions carries the --file pairs in the shape the core rpc expects.
func GenerateFileOptions ¶
func GenerateFileOptions(cmd *cli.Command) (*FileOptions, error)
type FileSpec ¶ added in v0.1.4
FileSpec is one --file value: a local path and where it lands in the workload.
func ParseFileSpec ¶ added in v0.1.4
ParseFileSpec parses src:dst[:mode[:uid:gid]] without touching the file.