Documentation
¶
Overview ¶
**************************************************************
* * Copyright (C) 2025, Pelican Project, Morgridge Institute for Research * * Licensed under the Apache License, Version 2.0 (the "License"); you * may not use this file except in compliance with the License. You may * obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * **************************************************************
Index ¶
- Constants
- func CheckCacheXrootdEnv(server server_structs.XRootDServer, uid int, gid int) error
- func CheckOriginXrootdEnv(exportPath string, server server_structs.XRootDServer, uid int, gid int, ...) error
- func CheckXrootdEnv(server server_structs.XRootDServer) error
- func CheckXrootdVersion() error
- func ClearXrootdDaemons()
- func ConfigXrootd(ctx context.Context, isOrigin bool) (string, error)
- func ConfigureLaunchers(privileged bool, configPath string, useCMSD bool, enableCache bool) (launchers []daemon.Launcher, err error)
- func EmitAuthfile(server server_structs.XRootDServer, isFirstRun bool) error
- func EmitIssuerMetadata(exportPath string, xServeUrl string) error
- func EmitScitokensConfig(server server_structs.XRootDServer) error
- func FileCopyToXrootdDir(isOrigin bool, cmd int, file *os.File) error
- func GetTrackedPIDs() []int
- func InitSelfTestDir() error
- func LaunchDaemons(ctx context.Context, launchers []daemon.Launcher, egrp *errgroup.Group, ...) (pids []int, err error)
- func LaunchXrootdMaintenance(ctx context.Context, server server_structs.XRootDServer, ...)
- func PeriodicSelfTest(ctx context.Context, ergp *errgroup.Group, isOrigin bool)
- func RegisterXrootdLoggingCallback()
- func ResetRestartState()
- func RestartServer(ctx context.Context, server server_structs.XRootDServer) error
- func RestartXrootd(ctx context.Context, oldPids []int) (newPids []int, err error)
- func ScanLinesWithCont(data []byte, atEOF bool) (advance int, token []byte, err error)
- func SetUpMonitoring(ctx context.Context, egrp *errgroup.Group) error
- func StoreRestartInfo(launchers []daemon.Launcher, pids []int, egrp *errgroup.Group, ...)
- func WriteCacheScitokensConfig(nsAds []server_structs.NamespaceAdV2, isFirstRun bool) error
- func WriteOriginScitokensConfig(isFirstRun bool) error
- type CacheConfig
- type GlobalCfg
- type Issuer
- func GenerateCacheIssuers(nsAds []server_structs.NamespaceAdV2) []Issuer
- func GenerateDirectorMonitoringIssuer() (issuer Issuer, err error)
- func GenerateFederationIssuer() (issuer Issuer, err error)
- func GenerateMonitoringIssuer() (issuer Issuer, err error)
- func GenerateOriginIssuers() (issuers []Issuer, err error)
- type LoggingConfig
- type LotmanCfg
- type OriginConfig
- type PrivilegedXrootdLauncher
- type ScitokensCfg
- type ServerConfig
- type UnprivilegedXrootdLauncher
- type XrootdConfig
- type XrootdOptions
Constants ¶
const MinXrootdVersion = "5.8.2"
MinXrootdVersion is the minimum required XRootD version for Pelican cache and origin components. This version must be kept in sync with the version specified in .goreleaser.yml (two locations: RPM and DEB dependencies).
Variables ¶
This section is empty.
Functions ¶
func CheckCacheXrootdEnv ¶ added in v1.0.4
func CheckCacheXrootdEnv(server server_structs.XRootDServer, uid int, gid int) error
func CheckOriginXrootdEnv ¶ added in v1.0.4
func CheckOriginXrootdEnv(exportPath string, server server_structs.XRootDServer, uid int, gid int, username, groupname string) error
CheckOriginXrootdEnv is almost a misnomer -- it does both checking and configuring. In partcicular, it is responsible for setting up the exports and handling all the symlinking we use to export our directories.
func CheckXrootdEnv ¶ added in v1.0.4
func CheckXrootdEnv(server server_structs.XRootDServer) error
func CheckXrootdVersion ¶
func CheckXrootdVersion() error
* CheckXrootdVersion checks if the installed XRootD version meets the minimum requirement. * It executes 'xrootd -v' to retrieve the version and compares it against MinXrootdVersion. * Returns an error if: * - The xrootd binary is not found in PATH * - The version cannot be determined * - The version is below the minimum requirement
func ClearXrootdDaemons ¶
func ClearXrootdDaemons()
ClearXrootdDaemons clears registered servers and resets the logging callback. This is primarily intended for testing.
func ConfigXrootd ¶ added in v1.0.4
func ConfigureLaunchers ¶ added in v1.0.4
func EmitAuthfile ¶ added in v1.0.4
func EmitAuthfile(server server_structs.XRootDServer, isFirstRun bool) error
Parse the input xrootd authfile, add any default configurations, and then save it into the xrootd runtime directory
isFirstRun is true if this is the first time we are writing the authfile, false otherwise. If the drop privileges feature is enabled, the first run is by the root user, and the subsequent runs are by the unprivileged pelican user via the xrdhttp-pelican plugin.
func EmitIssuerMetadata ¶ added in v1.0.4
func EmitScitokensConfig ¶
func EmitScitokensConfig(server server_structs.XRootDServer) error
Writes out the server's scitokens.cfg configuration
func GetTrackedPIDs ¶
func GetTrackedPIDs() []int
GetTrackedPIDs returns a snapshot of currently tracked XRootD PIDs This is useful for tests that need to verify XRootD restarts
func InitSelfTestDir ¶
func InitSelfTestDir() error
Add self-test directories to xrootd data location of the cache
func LaunchDaemons ¶
func LaunchXrootdMaintenance ¶
func LaunchXrootdMaintenance(ctx context.Context, server server_structs.XRootDServer, sleepTime time.Duration)
Launch a separate goroutine that performs the XRootD maintenance tasks. For maintenance that is periodic, `sleepTime` is the maintenance period.
func PeriodicSelfTest ¶
Start self-test monitoring of the origin/cache. This will upload, download, and delete a generated filename every 15 seconds to the local origin. On failure, it will set the xrootd component's status to critical.
func RegisterXrootdLoggingCallback ¶
func RegisterXrootdLoggingCallback()
RegisterXrootdLoggingCallback installs the callback (once) to trigger a restart when any XRootD logging parameter changes.
func ResetRestartState ¶
func ResetRestartState()
ResetRestartState clears restart tracking and callbacks for tests.
func RestartServer ¶
func RestartServer(ctx context.Context, server server_structs.XRootDServer) error
RestartServer is a helper function that restarts XRootD and updates the server's PIDs This avoids circular dependencies by being in the xrootd package
func RestartXrootd ¶
RestartXrootd gracefully restarts the XRootD server processes This function is thread-safe and will prevent concurrent restart attempts
func ScanLinesWithCont ¶
Scan through the lines of a file, respecting line continuation characters. That is,
``` foo \ bar ```
Would be parsed as a single line, `foo bar`.
Follows the ScanFunc interface defined by bufio.
func SetUpMonitoring ¶ added in v1.0.4
Set up xrootd monitoring
The `ctx` is the context for listening to server shutdown event in order to cleanup internal cache eviction goroutine and `wg` is the wait group to notify when the clean up goroutine finishes
func StoreRestartInfo ¶
func StoreRestartInfo(launchers []daemon.Launcher, pids []int, egrp *errgroup.Group, callback func(int), cache bool, cmsd bool, priv bool)
StoreRestartInfo stores the information needed for restarting XRootD This should be called during initial launch after PIDs are known.
func WriteCacheScitokensConfig ¶ added in v1.0.4
func WriteCacheScitokensConfig(nsAds []server_structs.NamespaceAdV2, isFirstRun bool) error
Writes out the cache's scitokens.cfg configuration
func WriteOriginScitokensConfig ¶ added in v1.0.4
Writes out the origin's scitokens.cfg configuration
Types ¶
type CacheConfig ¶ added in v1.0.4
type CacheConfig struct {
UseCmsd bool
EnablePrefetch bool
EnableVoms bool
Port int
HighWaterMark string
LowWatermark string
FilesBaseSize string
FilesNominalSize string
FilesMaxSize string
ExportLocation string
RunLocation string
DataLocations []string
MetaLocations []string
NamespaceLocation string
PSSOrigin string
BlocksToPrefetch int
Concurrency int
LotmanCfg LotmanCfg
EnableTLSClientAuth bool
EvictionMonitoringInterval int
EvictionMonitoringMaxDepth int
}
type GlobalCfg ¶ added in v1.0.4
type GlobalCfg struct {
Audience []string
}
XRootD server-wide configurations for SciTokens.
type Issuer ¶ added in v1.0.4
type Issuer struct {
Name string
Issuer string
BasePaths []string
RestrictedPaths []string
MapSubject bool
DefaultUser string
UsernameClaim string
NameMapfile string
RequiredAuth string
AcceptableAuth string
}
Per-issuer configuration
func GenerateCacheIssuers ¶
func GenerateCacheIssuers(nsAds []server_structs.NamespaceAdV2) []Issuer
GenerateCacheIssuers takes a slice of NamespaceAdV2 and generates a list of Issuer objects for the cache's scitokens configuration. It aggregates base paths for each issuer and removes duplicates, returning a slice of Issuer objects. This could be easily accomplished directly in WriteCacheScitokensConfig, but this split makes it slightly easier to test, as it doesn't require checking file contents for equality.
func GenerateDirectorMonitoringIssuer ¶ added in v1.0.4
We have a special issuer just for director-based monitoring of the origin.
func GenerateFederationIssuer ¶
Generate the federation issuer to ensure the client is federation authorized
func GenerateMonitoringIssuer ¶ added in v1.0.4
We have a special issuer just for self-monitoring the origin.
func GenerateOriginIssuers ¶
Generate the scitokens issuer config for each export in the Origin.Exports block
Exports map prefix --> issuers, but we need to remap that to issuer --> basePaths here. Because this function calls GetOriginExports(), anything that calls it must first have called `InitServer()` with the Origin module to initialize the relevant defaults for export generation.
type LoggingConfig ¶
type LoggingConfig struct {
OriginCms string
OriginHttp string
OriginOfs string
OriginOss string
OriginScitokens string
OriginXrd string
OriginXrootd string
CacheHttp string
CacheLotman string
CacheOfs string
CachePfc string
CachePss string
PssSetOptCache string
CacheScitokens string
CacheXrd string
CacheXrootd string
}
type OriginConfig ¶ added in v1.0.4
type OriginConfig struct {
Multiuser bool
DirectorTest bool
EnableCmsd bool
EnableMacaroons bool
EnableVoms bool
EnablePublicReads bool
EnableListings bool
EnableAtomicUploads bool
SelfTest bool
MonitoringPrefix string
Concurrency int
Port int
FederationPrefix string
HttpServiceUrl string
HttpAuthTokenFile string
XRootServiceUrl string
RunLocation string
StorageType string
UploadTempLocation string
// S3 specific options that are kept top-level because
// they aren't specific to each export
S3Region string
S3ServiceUrl string
S3UrlStyle string
// Globus specific options
GlobusTransferTokenFile string
Exports []server_utils.OriginExport
}
type PrivilegedXrootdLauncher ¶
type PrivilegedXrootdLauncher struct {
// contains filtered or unexported fields
}
func (PrivilegedXrootdLauncher) KillFunc ¶
func (launcher PrivilegedXrootdLauncher) KillFunc() func(pid int, sig int) error
func (PrivilegedXrootdLauncher) Name ¶ added in v1.0.4
func (launcher PrivilegedXrootdLauncher) Name() string
type ScitokensCfg ¶ added in v1.0.4
Top-level configuration object for the template
func LoadScitokensConfig ¶ added in v1.0.4
func LoadScitokensConfig(fileName string) (cfg ScitokensCfg, err error)
Given a filename, load and parse the file into a ScitokensCfg object
type ServerConfig ¶ added in v1.0.4
type UnprivilegedXrootdLauncher ¶
type UnprivilegedXrootdLauncher struct {
daemon.DaemonLauncher
// contains filtered or unexported fields
}
type XrootdConfig ¶ added in v1.0.4
type XrootdConfig struct {
Server ServerConfig
Origin OriginConfig
Xrootd XrootdOptions
Cache CacheConfig
Logging LoggingConfig
}
type XrootdOptions ¶ added in v1.0.4
type XrootdOptions struct {
Port int
ManagerHost string
ManagerPort string
ConfigFile string
MacaroonsKeyFile string
RobotsTxtFile string
Sitename string
SummaryMonitoringHost string
SummaryMonitoringPort int
DetailedMonitoringHost string
DetailedMonitoringPort int
Authfile string
AuthRefreshInterval int // In the raw config we use a duration, but Xrootd needs this as a seconds integer. Conversion happens during the unmarshal
ScitokensConfig string
Mount string
LocalMonitoringPort int
HttpMaxDelay int
MaxThreads int
}