Documentation
¶
Overview ¶
Package productpaths resolves application roots and leaf paths without creating files. The host supplies configuration layers and an explicit platform-default lookup.
Index ¶
- Constants
- func ReadConfiguration(ctx context.Context, input ConfigurationInput) ([]byte, error)
- func ReadDotenv(ctx context.Context, path string, maxBytes int64) ([]byte, error)
- func ValidateInstanceID(id string) error
- type ConfigurationInput
- type ExternalFiles
- type FileEntry
- type FileInspection
- type FileManifest
- type FileObservation
- type FileOwner
- type FilePolicy
- type Layer
- type Lookup
- type Path
- type Product
- type Root
- type Roots
- type SourceDirectories
- type WindowsSecurity
Constants ¶
const DefaultInspectionEntries = 10000
DefaultInspectionEntries bounds the default metadata scan, including unmatched entries.
const MaximumInspectionEntries = 100000
MaximumInspectionEntries caps an explicit metadata scan budget.
Variables ¶
This section is empty.
Functions ¶
func ReadConfiguration ¶
func ReadConfiguration(ctx context.Context, input ConfigurationInput) ([]byte, error)
ReadConfiguration reads a bounded primary file through the shared native access checks. Service-managed access requires an explicit path. The function never changes permissions.
func ReadDotenv ¶
ReadDotenv reads a bounded private dotenv file without the service configuration exception. The caller parses the returned bytes and selects their precedence.
func ValidateInstanceID ¶
ValidateInstanceID requires a portable lowercase component with at most 63 bytes.
Types ¶
type ConfigurationInput ¶
type ConfigurationInput struct {
// Path names the selected file. The host resolves its configured anchor before reading.
Path string
AccessPolicy string
Explicit bool
MaxBytes int64
}
ConfigurationInput selects a primary file and its access policy before reading its contents.
type ExternalFiles ¶
type ExternalFiles struct {
ID string `json:"id" yaml:"id"`
Selection string `json:"selection" yaml:"selection"`
Recovery string `json:"recovery" yaml:"recovery"`
Policy FilePolicy `json:"policy" yaml:"policy"`
}
ExternalFiles describes destinations that operators select outside the product roots. The report omits destinations that the current configuration does not select.
type FileEntry ¶
type FileEntry struct {
ID string `json:"id" yaml:"id"`
Location Path `json:"location" yaml:"location"`
Kind string `json:"kind" yaml:"kind"`
Patterns []string `json:"patterns,omitempty" yaml:"patterns,omitempty"`
Availability string `json:"availability" yaml:"availability"`
Creation string `json:"creation" yaml:"creation"`
Recovery string `json:"recovery" yaml:"recovery"`
Policy FilePolicy `json:"policy" yaml:"policy"`
}
FileEntry identifies a file or a bounded tree and its creation and recovery rules. Patterns use slash-separated relative names. A double star includes nested content. For a patterns entry, Policy applies to matches, not to the Location scan parent. Availability is available, disabled, or planned. Planned paths have no implemented writer.
func WorkspaceFiles ¶
WorkspaceFiles describes a selected authoring tree and its adjacent recovery files. An empty workspace disables the tree and omits sibling artifacts. The function does not access files. Selectors name the host settings that select this workspace.
type FileInspection ¶
type FileInspection struct {
ObservedAt time.Time `json:"observed_at" yaml:"observed_at"`
Complete bool `json:"complete" yaml:"complete"`
EntryLimit int `json:"entry_limit" yaml:"entry_limit"`
Examined int `json:"examined" yaml:"examined"`
Observations []FileObservation `json:"observations" yaml:"observations"`
Limitations []string `json:"limitations" yaml:"limitations"`
}
FileInspection contains bounded metadata observations, not a readiness or access verdict.
func InspectManifest ¶
func InspectManifest(ctx context.Context, manifest FileManifest, limit int) (FileInspection, error)
InspectManifest reads metadata and bounded directory entries without reading file contents. It skips observed symbolic-link targets and makes no file writes or runtime lock attempts.
type FileManifest ¶
type FileManifest struct {
SchemaVersion int `json:"schema_version" yaml:"schema_version"`
Product Product `json:"product" yaml:"product"`
BuildVersion string `json:"build_version" yaml:"build_version"`
DeploymentID string `json:"deployment_id" yaml:"deployment_id"`
InstanceID string `json:"instance_id" yaml:"instance_id"`
RelativePathBase string `json:"relative_path_base" yaml:"relative_path_base"`
RelativePathBaseOrigin string `json:"relative_path_base_origin" yaml:"relative_path_base_origin"`
Roots Roots `json:"roots" yaml:"roots"`
Files []FileEntry `json:"files" yaml:"files"`
External []ExternalFiles `json:"external" yaml:"external"`
Inspection *FileInspection `json:"inspection,omitempty" yaml:"inspection,omitempty"`
}
FileManifest describes file locations without claiming that the files exist. The host supplies the selected configuration and implementation availability.
type FileObservation ¶
type FileObservation struct {
ID string `json:"id" yaml:"id"`
Path string `json:"path" yaml:"path"`
State string `json:"state" yaml:"state"`
Kind string `json:"kind,omitempty" yaml:"kind,omitempty"`
Mode string `json:"mode,omitempty" yaml:"mode,omitempty"`
PermissionScope string `json:"permission_scope,omitempty" yaml:"permission_scope,omitempty"`
Owner *FileOwner `json:"owner,omitempty" yaml:"owner,omitempty"`
WindowsSecurity *WindowsSecurity `json:"windows_security,omitempty" yaml:"windows_security,omitempty"`
OwnerBinding string `json:"owner_binding,omitempty" yaml:"owner_binding,omitempty"`
Reason string `json:"reason,omitempty" yaml:"reason,omitempty"`
AccessPolicy string `json:"access_policy,omitempty" yaml:"access_policy,omitempty"`
AccessStatus string `json:"access_status,omitempty" yaml:"access_status,omitempty"`
AccessReason string `json:"access_reason,omitempty" yaml:"access_reason,omitempty"`
}
FileObservation describes one selected location or matching managed artifact.
type FileOwner ¶
type FileOwner struct {
UID uint32 `json:"uid" yaml:"uid"`
GID uint32 `json:"gid" yaml:"gid"`
MatchesEffectiveUser bool `json:"matches_effective_user" yaml:"matches_effective_user"`
}
FileOwner reports filesystem ownership without asserting runtime or fleet ownership.
type FilePolicy ¶
type FilePolicy struct {
Selectors []string `json:"selectors" yaml:"selectors"`
Applicability string `json:"applicability" yaml:"applicability"`
Access string `json:"access" yaml:"access"`
Retention string `json:"retention" yaml:"retention"`
Removal string `json:"removal" yaml:"removal"`
}
FilePolicy describes required access and operator-controlled retention. It does not assert effective permissions or enable automatic deletion.
type Layer ¶
Layer supplies explicit root values. Earlier layers take precedence at equal specificity. A specific root replaces that child of Home, regardless of Home's layer.
type Lookup ¶
Lookup returns an absolute platform default for one root. Resolve calls it only when no configured root or grouped home supplies the path.
func UserDefaults ¶
UserDefaults returns a native user-directory lookup for the selected product. This explicit host adapter reads platform directory inputs only when called.
type Path ¶
type Path struct {
Path string `json:"path"`
Origin string `json:"origin"`
Anchor string `json:"anchor,omitempty"`
}
Path reports a resolved absolute path and the authority that selected it. Anchor names the parent used for a relative leaf or grouped root.
type Root ¶
type Root string
Root identifies one application directory role.
const ( // Home groups the four roots under one directory. Home Root = "home" // Config contains application configuration. Config Root = "config" // Data contains durable application data. Data Root = "data" // State contains process state. State Root = "state" // Cache contains disposable application data. Cache Root = "cache" )
type SourceDirectories ¶
SourceDirectories names parent directories for HTTP caches and managed Git checkouts. Each source appends its own name below these directories.
func DefaultSourceDirectories ¶
func DefaultSourceDirectories(product Product) (SourceDirectories, error)
DefaultSourceDirectories resolves the selected product's native source directories. It reads platform directory inputs and creates no files.
func SourceDirectoriesAt ¶
func SourceDirectoriesAt(cacheRoot string) (SourceDirectories, error)
SourceDirectoriesAt places source storage beneath one absolute cache root. It does not access the filesystem.
func (SourceDirectories) Validate ¶
func (directories SourceDirectories) Validate() error
Validate requires absolute paths for both source directory roles.
type WindowsSecurity ¶
type WindowsSecurity struct {
OwnerSID string `json:"owner_sid,omitempty" yaml:"owner_sid,omitempty"`
ProcessSID string `json:"process_sid,omitempty" yaml:"process_sid,omitempty"`
DACLState string `json:"dacl_state" yaml:"dacl_state"`
EntryCount int `json:"entry_count" yaml:"entry_count"`
PolicyStatus string `json:"policy_status" yaml:"policy_status"`
// ServicePolicyStatus checks the explicit primary configuration exception.
ServicePolicyStatus string `json:"service_policy_status,omitempty" yaml:"service_policy_status,omitempty"`
ServicePolicyReason string `json:"service_policy_reason,omitempty" yaml:"service_policy_reason,omitempty"`
Reason string `json:"reason,omitempty" yaml:"reason,omitempty"`
}
WindowsSecurity reports native ownership and a limited private DACL assessment. A compatible policy does not establish effective access or ancestor safety.