Documentation
¶
Overview ¶
Package core implements the specification of repositories and packages for the Forklift package management system.
Index ¶
- Constants
- func CheckResDeps[Res DepChecker[Res]](required []AttachedRes[Res], provided []AttachedRes[Res]) (satisfied []SatisfiedResDep[Res], missing []MissingResDep[Res])
- func ComparePaths(r, s string) int
- func ComparePkgs(p, q Pkg) int
- func CompareRepos(r, s Repo) int
- func CoversPath(pather Pather, path string) bool
- func ErrsWrap(errs []error, message string) []error
- func ErrsWrapf(errs []error, format string, a ...any) []error
- func GetSubdirPath(pather Pather, path string) string
- type AttachedRes
- type ConflictChecker
- type DepChecker
- type FSPkg
- type FSRepo
- type FileExportRes
- type FilesetRes
- type ListenerRes
- type MissingResDep
- type NetworkRes
- type PathedFS
- type Pather
- type Pkg
- func (p Pkg) Check() (errs []error)
- func (p Pkg) Path() string
- func (p Pkg) ProvidedFileExports(parentSource []string, enabledFeatures []string) (provided []AttachedRes[FileExportRes])
- func (p Pkg) ProvidedFilesets(parentSource []string, enabledFeatures []string) (provided []AttachedRes[FilesetRes])
- func (p Pkg) ProvidedListeners(parentSource []string, enabledFeatures []string) (provided []AttachedRes[ListenerRes])
- func (p Pkg) ProvidedNetworks(parentSource []string, enabledFeatures []string) (provided []AttachedRes[NetworkRes])
- func (p Pkg) ProvidedServices(parentSource []string, enabledFeatures []string) (provided []AttachedRes[ServiceRes])
- func (p Pkg) RequiredFilesets(parentSource []string, enabledFeatures []string) (required []AttachedRes[FilesetRes])
- func (p Pkg) RequiredNetworks(parentSource []string, enabledFeatures []string) (required []AttachedRes[NetworkRes])
- func (p Pkg) RequiredServices(parentSource []string, enabledFeatures []string) (required []AttachedRes[ServiceRes])
- func (p Pkg) ResAttachmentSource(parentSource []string) []string
- type PkgDef
- type PkgDeplSpec
- type PkgFeatureSpec
- type PkgHostSpec
- type PkgMaintainer
- type PkgSpec
- type ProvidedRes
- func (r ProvidedRes) AttachedFileExports(source []string) []AttachedRes[FileExportRes]
- func (r ProvidedRes) AttachedFilesets(source []string) []AttachedRes[FilesetRes]
- func (r ProvidedRes) AttachedListeners(source []string) []AttachedRes[ListenerRes]
- func (r ProvidedRes) AttachedNetworks(source []string) []AttachedRes[NetworkRes]
- func (r ProvidedRes) AttachedServices(source []string) []AttachedRes[ServiceRes]
- type Repo
- type RepoDef
- type RepoSpec
- type RequiredRes
- type ResConflict
- type ResDepCandidate
- type SatisfiedResDep
- type ServiceRes
Constants ¶
const ( FileExportSourceTypeLocal = "local" FileExportSourceTypeHTTP = "http" FileExportSourceTypeHTTPArchive = "http-archive" FileExportSourceTypeOCIImage = "oci-image" )
const ( CompareLT = -1 CompareEQ = 0 CompareGT = 1 )
The result of comparison functions is one of these values.
const PkgDefFile = "forklift-package.yml"
PkgDefFile is the name of the file defining each package.
const RepoDefFile = "forklift-repository.yml"
RepoDefFile is the name of the file defining each repository.
Variables ¶
This section is empty.
Functions ¶
func CheckResDeps ¶
func CheckResDeps[Res DepChecker[Res]]( required []AttachedRes[Res], provided []AttachedRes[Res], ) ( satisfied []SatisfiedResDep[Res], missing []MissingResDep[Res], )
CheckResDeps identifies all unsatisfied resource dependencies between the provided list of resource requirements and the provided list of resources.
func ComparePaths ¶
ComparePaths returns an integer comparing two paths. The result will be 0 if the r and s are the same; -1 if r alphabetically comes before s; or +1 if r alphabetically comes after s.
func ComparePkgs ¶
ComparePkgs returns an integer comparing two Pkg instances according to their paths, and their respective repos' versions. The result will be 0 if the p and q have the same paths and versions; -1 if r has a path which alphabetically comes before the path of s, or if the paths are the same but r has a lower version than s; or +1 if r has a path which alphabetically comes after the path of s, or if the paths are the same but r has a higher version than s.
func CompareRepos ¶
CompareRepos returns an integer comparing two Repo instances according to their paths and versions. The result will be 0 if the r and s have the same paths and versions; -1 if r has a path which alphabetically comes before the path of s or if the paths are the same but r has a lower version than s; or +1 if r has a path which alphabetically comes after the path of s or if the paths are the same but r has a higher version than s.
func CoversPath ¶
CoversPath checks whether the provided path would be within a child directory of the Pather if the Pather were a filesystem.
func GetSubdirPath ¶
GetSubdirPath removes the path of the Pather instance from the start of the provided path, resulting in the subdirectory path of the provided path under the path of the Pather instance. If the Pather instance's path is not a parent directory of the provided path, the result is unchanged from the provided path.
Types ¶
type AttachedRes ¶
type AttachedRes[Res interface{}] struct { // Res is a resource subject to various possible constraints. Res Res // Source is a list of strings describing how to locate the resource in a package spec, to be // shown to users when a resource constraint is not met. Typically the elements of the list will // correspond to the parts of a path. Source []string }
An AttachedRes is a binding between a resource and the source of that resource.
func SplitFilesetsByPath ¶ added in v0.5.2
func SplitFilesetsByPath(filesetRes []AttachedRes[FilesetRes]) (split []AttachedRes[FilesetRes])
SplitFilesetsByPath produces a slice of fileset resources from the input slice, where each fileset resource in the input slice with multiple paths results in multiple corresponding fileset resources with one path each.
func SplitServicesByPath ¶
func SplitServicesByPath(serviceRes []AttachedRes[ServiceRes]) (split []AttachedRes[ServiceRes])
SplitServicesByPath produces a slice of network service resources from the input slice, where each network service resource in the input slice with multiple paths results in multiple corresponding network service resources with one path each.
type ConflictChecker ¶
type ConflictChecker[Res interface{}] interface {
CheckConflict(candidate Res) []error
}
A ConflictChecker is something which may conflict with a resource, and which can determine whether it conflicts with another resource. Typically, resource types will implement this interface.
type DepChecker ¶
type DepChecker[Res interface{}] interface {
CheckDep(candidate Res) []error
}
A DepChecker is something which may depend on a resource, and which can determine whether its dependency is satisfied by a resource. Typically, resource requirement types will implement this interface.
type FSPkg ¶
type FSPkg struct { // Pkg is the Forklift package at the root of the filesystem. Pkg // FS is a filesystem which contains the package's contents. FS PathedFS // Repo is a pointer to the [FSRepo] instance which provides the package. Repo *FSRepo }
A FSPkg is a Forklift package stored at the root of a fs.FS filesystem.
func LoadFSPkg ¶
LoadFSPkg loads a FSPkg from the specified directory path in the provided base filesystem. In the loaded FSPkg's embedded Pkg, the repo path is not initialized, nor is the repo subdirectory initialized, nor is the pointer to the repo initialized.
func LoadFSPkgs ¶
LoadFSPkgs loads all FSPkgs from the provided base filesystem matching the specified search pattern. The search pattern should be a doublestar pattern, such as `**`, matching package directories to search for. The repo path, and the package subdirectory, and the pointer to the repo are all left uninitialized.
func (*FSPkg) AttachFSRepo ¶
AttachFSRepo updates the FSPkg instance's RepoPath, Subdir, Pkg.Repo, and Repo fields based on the provided repo.
type FSRepo ¶
type FSRepo struct { // Repo is the Forklift repository at the root of the filesystem. Repo // FS is a filesystem which contains the repository's contents. FS PathedFS }
A FSRepo is a Forklift repository stored at the root of a fs.FS filesystem.
func LoadFSRepo ¶
LoadFSRepo loads a FSRepo from the specified directory path in the provided base filesystem. In the loaded FSRepo's embedded Repo, the version is *not* initialized.
func LoadFSRepoContaining ¶
LoadFSRepoContaining loads the FSRepo containing the specified sub-directory path in the provided base filesystem. The sub-directory path does not have to actually exist. In the loaded FSRepo's embedded Repo, the version is *not* initialized.
func LoadFSRepos ¶
LoadFSRepos loads all FSRepos from the provided base filesystem matching the specified search pattern. The search pattern should be a doublestar pattern, such as `**`, matching repo directories to search for. In the embedded Repo of each loaded FSRepo, the version is *not* initialized.
func (*FSRepo) LoadFSPkg ¶
LoadFSPkg loads a package at the specified filesystem path from the FSRepo instance The loaded package is fully initialized.
func (*FSRepo) LoadFSPkgs ¶
LoadFSPkgs loads all packages in the FSRepo instance. The loaded packages are fully initialized.
func (*FSRepo) LoadReadme ¶
LoadReadme loads the readme file defined by the repo.
type FileExportRes ¶ added in v0.7.0
type FileExportRes struct { // Description is a short description of the file export to be shown to users. Description string `yaml:"description,omitempty"` // Tags is a list of strings associated with the file export. Tags are not considered in checking // resource constraints. Tags []string `yaml:"tags,omitempty"` // SourceType is either `local` (for a file in the package whose path is set by `Source`) or // `http` (for a file which needs to be downloaded from the URL set by `URL`). SourceType string `yaml:"source-type,omitempty"` // Source is the path in the package of the file to be exported, for a `local` source. If omitted, // the source path will be inferred from the Target path. Source string `yaml:"source,omitempty"` // URL is the URL of the file to be downloaded for export, for a `http` source. URL string `yaml:"url,omitempty"` // Target is the path where the file will be exported to, relative to an export directory. Target string `yaml:"target"` }
FileExportRes describes a file exported by Forklift.
func (FileExportRes) CheckConflict ¶ added in v0.7.0
func (r FileExportRes) CheckConflict(candidate FileExportRes) (errs []error)
CheckConflict checks whether the file export resource, represented by the FileExportRes instance, conflicts with the candidate file export resource.
type FilesetRes ¶ added in v0.5.2
type FilesetRes struct { // Description is a short description of the fileset to be shown to users. Description string `yaml:"description,omitempty"` // Tags is a list of strings associated with the fileset. Tags are considered in determining which // fileset resources meet fileset resource requirements. Tags []string `yaml:"tags,omitempty"` // Paths is a list of paths where the fileset exists. A path may also be a prefix, indicated // by ending the path with an asterisk (`*`). Paths []string `yaml:"paths"` // Nonblocking, when specified as a resource requirement, specifies that the program requiring the // fileset does not need to wait for the fileset to exist before the program can start. Nonblocking bool `yaml:"nonblocking,omitempty"` }
FilesetRes describes a set of files/directories.
func (FilesetRes) CheckConflict ¶ added in v0.5.2
func (r FilesetRes) CheckConflict(candidate FilesetRes) (errs []error)
CheckConflict checks whether the fileset resource, represented by the FilesetRes instance, conflicts with the candidate fileset resource.
func (FilesetRes) CheckDep ¶ added in v0.5.2
func (r FilesetRes) CheckDep(candidate FilesetRes) (errs []error)
CheckDep checks whether the fileset resource requirement, represented by the FilesetRes instance, is satisfied by the candidate fileset resource.
type ListenerRes ¶
type ListenerRes struct { // Description is a short description of the host port listener to be shown to users. Description string `yaml:"description,omitempty"` // Port is the port number which the host port listener is bound to. Port int `yaml:"port,omitempty"` // Protocol is the transport protocol (either tcp or udp) which the host port listener is bound // to. Protocol string `yaml:"protocol,omitempty"` }
ListenerRes describes a host port listener.
func (ListenerRes) CheckConflict ¶
func (r ListenerRes) CheckConflict(candidate ListenerRes) (errs []error)
CheckConflict checks whether the host port listener resource, represented by the ListenerRes instance, conflicts with the candidate host port listener resource.
func (ListenerRes) CheckDep ¶
func (r ListenerRes) CheckDep(candidate ListenerRes) (errs []error)
CheckDep checks whether the host port listener resource requirement, represented by the ListenerRes instance, is satisfied by the candidate host port listener resource.
type MissingResDep ¶
type MissingResDep[Res interface{}] struct { // Required is the resource requirement. Required AttachedRes[Res] // BestCandidates is a list of the resources which are closest to satisfying the resource // requirement. BestCandidates []ResDepCandidate[Res] }
A MissingResDep is a report of a resource requirement which is not satisfied by any resources.
type NetworkRes ¶
type NetworkRes struct { // Description is a short description of the Docker network to be shown to users. Description string `yaml:"description,omitempty"` // Name is the name of the Docker network. Name string `yaml:"name"` }
NetworkRes describes a Docker network.
func (NetworkRes) CheckConflict ¶
func (r NetworkRes) CheckConflict(candidate NetworkRes) (errs []error)
CheckConflict checks whether the Docker network resource, represented by the NetworkRes instance, conflicts with the candidate Docker network resource.
func (NetworkRes) CheckDep ¶
func (r NetworkRes) CheckDep(candidate NetworkRes) (errs []error)
CheckDep checks whether the Docker network resource requirement, represented by the NetworkRes instance, is satisfied by the candidate Docker network resource.
type PathedFS ¶
type PathedFS interface { fs.FS Pather // Sub returns a PathedFS corresponding to the subtree rooted at dir. Sub(dir string) (PathedFS, error) }
A PathedFS provides access to a hierarchical file system locatable at some path.
type Pather ¶
type Pather interface { // Path returns the path of the instance. Path() string }
Pather is something with a path.
type Pkg ¶
type Pkg struct { // Path is the path of the Forklift repository which provides the package. RepoPath string // Subdir is the path of the package within the repository which provides the package. Subdir string // Def is the definition of the package. Def PkgDef // Repo is a pointer to the [Repo] which provides the package. Repo *Repo }
A Pkg is a Forklift package, a configuration of a software application which can be deployed on a Docker host.
func (Pkg) ProvidedFileExports ¶ added in v0.7.0
func (p Pkg) ProvidedFileExports( parentSource []string, enabledFeatures []string, ) (provided []AttachedRes[FileExportRes])
ProvidedFileExports returns a slice of all file exports provided by a deployment of the package with the specified features enabled.
func (Pkg) ProvidedFilesets ¶ added in v0.5.2
func (p Pkg) ProvidedFilesets( parentSource []string, enabledFeatures []string, ) (provided []AttachedRes[FilesetRes])
ProvidedFilesets returns a slice of all filesets provided by a deployment of the package with the specified features enabled.
func (Pkg) ProvidedListeners ¶
func (p Pkg) ProvidedListeners( parentSource []string, enabledFeatures []string, ) (provided []AttachedRes[ListenerRes])
ProvidedListeners returns a slice of all host port listeners provided by a deployment of the package with the specified features enabled.
func (Pkg) ProvidedNetworks ¶
func (p Pkg) ProvidedNetworks( parentSource []string, enabledFeatures []string, ) (provided []AttachedRes[NetworkRes])
ProvidedNetworks returns a slice of all Docker networks provided by a deployment of the package with the specified features enabled.
func (Pkg) ProvidedServices ¶
func (p Pkg) ProvidedServices( parentSource []string, enabledFeatures []string, ) (provided []AttachedRes[ServiceRes])
ProvidedServices returns a slice of all network services provided by a deployment of the package with the specified features enabled.
func (Pkg) RequiredFilesets ¶ added in v0.5.2
func (p Pkg) RequiredFilesets( parentSource []string, enabledFeatures []string, ) (required []AttachedRes[FilesetRes])
RequiredFilesets returns a slice of all filesets required by a deployment of the package with the specified features enabled.
func (Pkg) RequiredNetworks ¶
func (p Pkg) RequiredNetworks( parentSource []string, enabledFeatures []string, ) (required []AttachedRes[NetworkRes])
RequiredNetworks returns a slice of all Docker networks required by a deployment of the package with the specified features enabled.
func (Pkg) RequiredServices ¶
func (p Pkg) RequiredServices( parentSource []string, enabledFeatures []string, ) (required []AttachedRes[ServiceRes])
RequiredServices returns a slice of all network services required by a deployment of the package with the specified features enabled.
func (Pkg) ResAttachmentSource ¶
ResAttachmentSource returns the source path for resources under the Pkg instance. The resulting slice is useful for constructing AttachedRes instances.
type PkgDef ¶
type PkgDef struct { // Package defines the basic metadata for the package. Package PkgSpec `yaml:"package,omitempty"` // Host contains information about the Docker host independent of any deployment of the package. Host PkgHostSpec `yaml:"host,omitempty"` // Deployment contains information about any deployment of the package. Deployment PkgDeplSpec `yaml:"deployment,omitempty"` // Features contains optional features which can be enabled or disabled. Features map[string]PkgFeatureSpec `yaml:"features,omitempty"` }
A PkgDef defines a package.
type PkgDeplSpec ¶
type PkgDeplSpec struct { // ComposeFiles is a list of the names of Docker Compose files specifying the Docker Compose // application which will be deployed as part of a package deployment. ComposeFiles []string `yaml:"compose-files,omitempty"` // Tags is a list of strings associated with the deployment. Tags []string `yaml:"tags,omitempty"` // Requires describes resource requirements which must be met for a deployment of the package to // succeed. Requires RequiredRes `yaml:"requires,omitempty"` // Provides describes resources provided by a successful deployment of the package. Provides ProvidedRes `yaml:"provides,omitempty"` }
PkgDeplSpec contains information about any deployment of the package.
func (PkgDeplSpec) ResAttachmentSource ¶
func (s PkgDeplSpec) ResAttachmentSource(parentSource []string) []string
ResAttachmentSource returns the source path for resources under the PkgDeplSpec instance, adding a string to the provided list of source elements which describes the source of the PkgDeplSpec instance. The resulting slice is useful for constructing AttachedRes instances.
type PkgFeatureSpec ¶
type PkgFeatureSpec struct { // Description is a short description of the feature to be shown to users. Description string `yaml:"description"` // ComposeFiles is a list of the names of Docker Compose files specifying the Docker Compose // application which will be merged together with any other Compose files as part of a package // deployment which enables the feature. ComposeFiles []string `yaml:"compose-files,omitempty"` // Tags is a list of strings associated with the feature. Tags []string `yaml:"tags,omitempty"` // Provides describes resource requirements which must be met for a deployment of the package to // succeed, if the feature is enabled. Requires RequiredRes `yaml:"requires,omitempty"` // Provides describes resources provided by a successful deployment of the package, if the feature // is enabled. Provides ProvidedRes `yaml:"provides,omitempty"` }
PkgFeatureSpec defines an optional feature of the package.
func (PkgFeatureSpec) ResAttachmentSource ¶
func (s PkgFeatureSpec) ResAttachmentSource(parentSource []string, featureName string) []string
ResAttachmentSource returns the source path for resources under the PkgFeatureSpec instance, adding a string to the provided list of source elements which describes the source of the PkgFeatureSpec instance. The resulting slice is useful for constructing AttachedRes instances.
type PkgHostSpec ¶
type PkgHostSpec struct { // Tags is a list of strings associated with the host. Tags []string `yaml:"tags,omitempty"` // Provides describes resources ambiently provided by the Docker host. Provides ProvidedRes `yaml:"provides,omitempty"` }
PkgHostSpec contains information about the Docker host independent of any deployment of the package.
func (PkgHostSpec) ResAttachmentSource ¶
func (s PkgHostSpec) ResAttachmentSource(parentSource []string) []string
ResAttachmentSource returns the source path for resources under the PkgHostSpec instance, adding a string to the provided list of source elements which describes the source of the PkgHostSpec instance. The resulting slice is useful for constructing AttachedRes instances.
type PkgMaintainer ¶
type PkgMaintainer struct { // Name is the maintainer's name. Name string `yaml:"name,omitempty"` // Email is an email address for contacting the maintainer. Email string `yaml:"email,omitempty"` }
PkgMaintainer describes a maintainer of a package.
type PkgSpec ¶
type PkgSpec struct { // Description is a short description of the package to be shown to users. Description string `yaml:"description"` // Maintainers is a list of people who maintain the package. Maintainers []PkgMaintainer `yaml:"maintainers,omitempty"` // License is an SPDX 2.1 license expression specifying the licensing terms of the software // provided by the package. License string `yaml:"license"` // LicenseFile is the name of a license file describing the licensing terms of the software // provided by the package. LicenseFile string `yaml:"license-file,omitempty"` // Sources is a list of URLs providing the source code of the software provided by the package. Sources []string `yaml:"sources,omitempty"` }
PkgSpec defines the basic metadata for a package.
type ProvidedRes ¶
type ProvidedRes struct { // Listeners is a list of host port listeners. Listeners []ListenerRes `yaml:"listeners,omitempty"` // Networks is a list of Docker networks. Networks []NetworkRes `yaml:"networks,omitempty"` // Services is a list of network services. Services []ServiceRes `yaml:"services,omitempty"` // Filesets is a list of files/directories. Filesets []FilesetRes `yaml:"filesets,omitempty"` // FileExports is a list of files/directories. FileExports []FileExportRes `yaml:"file-exports,omitempty"` }
ProvidedRes describes a set of resources provided by some aspect of a package.
func (ProvidedRes) AttachedFileExports ¶ added in v0.7.0
func (r ProvidedRes) AttachedFileExports(source []string) []AttachedRes[FileExportRes]
AttachedFileExports returns a list of AttachedRes instances for each respective file export in the ProvidedRes instance, adding a string to the provided list of source elements which describes the source of the ProvidedRes instance.
func (ProvidedRes) AttachedFilesets ¶ added in v0.5.2
func (r ProvidedRes) AttachedFilesets(source []string) []AttachedRes[FilesetRes]
AttachedFilesets returns a list of AttachedRes instances for each respective fileset in the ProvidedRes instance, adding a string to the provided list of source elements which describes the source of the ProvidedRes instance.
func (ProvidedRes) AttachedListeners ¶
func (r ProvidedRes) AttachedListeners(source []string) []AttachedRes[ListenerRes]
AttachedListeners returns a list of AttachedRes instances for each respective host port listener in the ProvidedRes instance, adding a string to the provided list of source elements which describes the source of the ProvidedRes instance.
func (ProvidedRes) AttachedNetworks ¶
func (r ProvidedRes) AttachedNetworks(source []string) []AttachedRes[NetworkRes]
AttachedNetworks returns a list of AttachedRes instances for each respective Docker network in the ProvidedRes instance, adding a string to the provided list of source elements which describes the source of the ProvidedRes instance.
func (ProvidedRes) AttachedServices ¶
func (r ProvidedRes) AttachedServices(source []string) []AttachedRes[ServiceRes]
AttachedServices returns a list of AttachedRes instances for each respective network service in the ProvidedRes instance, adding a string to the provided list of source elements which describes the source of the ProvidedRes instance.
type Repo ¶
type Repo struct { // Def is the definition of the repository. Def RepoDef // Version is the version or pseudoversion of the repository. Version string }
A Repo is a collection of Forklift packages which are tested, released, distributed, and upgraded together.
func (Repo) VersionQuery ¶ added in v0.6.0
VersionQuery represents the Repo instance as a version query.
type RepoDef ¶
type RepoDef struct { // ForkliftVersion indicates that the repo was written assuming the semantics of a given version // of Forklift. The version must be a valid Forklift version, and it sets the minimum version of // Forklift required to use the repository. The Forklift tool refuses to use repositories // declaring newer Forklift versions for any operations beyond printing information. ForkliftVersion string `yaml:"forklift-version"` // Repo defines the basic metadata for the repository. Repo RepoSpec `yaml:"repository"` }
A RepoDef defines a repository.
func LoadRepoDef ¶
LoadRepoDef loads a RepoDef from the specified file path in the provided base filesystem.
type RepoSpec ¶
type RepoSpec struct { // Path is the repository path, which acts as the canonical name for the repository. It should // just be the path of the VCS repository for the Forklift repository. Path string `yaml:"path"` // Description is a short description of the repository to be shown to users. Description string `yaml:"description"` // ReadmeFile is the name of a readme file to be shown to users. ReadmeFile string `yaml:"readme-file"` }
RepoSpec defines the basic metadata for a repository.
type RequiredRes ¶
type RequiredRes struct { // Networks is a list of requirements for Docker networks. Networks []NetworkRes `yaml:"networks,omitempty"` // Services is a list of requirements for network services. Services []ServiceRes `yaml:"services,omitempty"` // Filesets is a list of requirements for files/directories. Filesets []FilesetRes `yaml:"filesets,omitempty"` }
RequiredRes describes a set of resource requirements for some aspect of a package.
func (RequiredRes) AttachedFilesets ¶ added in v0.5.2
func (r RequiredRes) AttachedFilesets(source []string) []AttachedRes[FilesetRes]
AttachedFilesets returns a list of AttachedRes instances for each respective fileset resource requirement in the RequiredRes instance, adding a string to the provided list of source elements which describes the source of the RequiredRes instance.
func (RequiredRes) AttachedNetworks ¶
func (r RequiredRes) AttachedNetworks(source []string) []AttachedRes[NetworkRes]
AttachedNetworks returns a list of AttachedRes instances for each respective Docker network resource requirement in the RequiredRes instance, adding a string to the provided list of source elements which describes the source of the RequiredRes instance.
func (RequiredRes) AttachedServices ¶
func (r RequiredRes) AttachedServices(source []string) []AttachedRes[ServiceRes]
AttachedServices returns a list of AttachedRes instances for each respective network service resource requirement in the RequiredRes instance, adding a string to the provided list of source elements which describes the source of the RequiredRes instance.
type ResConflict ¶
type ResConflict[Res interface{}] struct { // First is one of the two conflicting resources. First AttachedRes[Res] // Second is the other of the two conflicting resources. Second AttachedRes[Res] // Errs is a list of errors describing how the two resources conflict with each other. Errs []error }
A ResConflict is a report of a conflict between two resources.
func CheckResConflicts ¶
func CheckResConflicts[Res ConflictChecker[Res]]( first []AttachedRes[Res], second []AttachedRes[Res], ) (conflicts []ResConflict[Res])
CheckResConflicts identifies all resource conflicts between the first list of resources and the second list of resources. It does not identify resource conflicts within the first list of resources, nor within the second list of resources.
type ResDepCandidate ¶
type ResDepCandidate[Res interface{}] struct { // Provided is the resource which did not satisfy the requirement. Provided AttachedRes[Res] // Errs is a list of errors describing how the resource did not satisfy the requirement. Errs []error }
ResDepCandidate is a report of a resource which either satisfied a resource requirement or (if Errs contains errors) failed to satisfy that resource requirement.
type SatisfiedResDep ¶
type SatisfiedResDep[Res interface{}] struct { // Required is the resource requirement. Required AttachedRes[Res] // Provided is the resource which satisfies the resource requirement. Provided AttachedRes[Res] }
A SatisfiedResDep is a report of a resource requirement which is satisfied by a set of resources.
type ServiceRes ¶
type ServiceRes struct { // Description is a short description of the network service to be shown to users. Description string `yaml:"description,omitempty"` // Port is the network port used for accessing the service. Port int `yaml:"port,omitempty"` // Protocol is the application-level protocol (e.g. http or mqtt) used for accessing the service. Protocol string `yaml:"protocol,omitempty"` // Tags is a list of strings associated with the service. Tags are considered in determining which // service resources meet service resource requirements. Tags []string `yaml:"tags,omitempty"` // Paths is a list of paths used for accessing the service. A path may also be a prefix, indicated // by ending the path with an asterisk (`*`). Paths []string `yaml:"paths,omitempty"` // Nonblocking, when specified as a resource requirement, specifies that the client of the service // does not need to wait for the resource to exist before the client can start. Nonblocking bool `yaml:"nonblocking,omitempty"` }
ServiceRes describes a network service.
func (ServiceRes) CheckConflict ¶
func (r ServiceRes) CheckConflict(candidate ServiceRes) (errs []error)
CheckConflict checks whether the network service resource, represented by the ServiceRes instance, conflicts with the candidate network service resource.
func (ServiceRes) CheckDep ¶
func (r ServiceRes) CheckDep(candidate ServiceRes) (errs []error)
CheckDep checks whether the network service resource requirement, represented by the ServiceRes instance, is satisfied by the candidate network service resource.