Documentation
¶
Overview ¶
Package server_utils shares utility functions used across multiple server packages (origin, cache, registry, director).
It should only import lower level packages (config, param, etc), or server_structs package. It should never import any server packages (origin, cache, registry, director) or upper level packages (launcher_utils, cmd, etc).
For structs used across multiple server packages, put them in common package instead
Index ¶
- Constants
- Variables
- func CheckOriginSentinelLocations(exports []OriginExport) (ok bool, err error)
- func CreateFedTok(ctx context.Context, server server_structs.XRootDServer) (tok string, err error)
- func FilterTopLevelPrefixes(nsAds []server_structs.NamespaceAdV2) []server_structs.NamespaceAdV2
- func GetAdvertisementTok(server server_structs.XRootDServer, directorUrl string) (tok string, err error)
- func GetDirectorAds() []server_structs.DirectorAd
- func GetServerMetadata(ctx context.Context, server server_structs.ServerType) (metadata server_structs.ServerRegistration, err error)
- func GetTopologyJSON(ctx context.Context) (*server_structs.TopologyNamespacesJSON, error)
- func HandleDirectorTestResponse(ctx *gin.Context, nChan chan bool)
- func InitSQLiteDB(dbPath string) (*gorm.DB, error)
- func IsDirectorAdFromSelf(ctx context.Context, ad server_structs.ServerBaseAdInterface) (bool, error)
- func IssuerUrlsHookFunc() mapstructure.DecodeHookFuncType
- func LaunchConcurrencyMonitoring(ctx context.Context, egrp *errgroup.Group, sType server_structs.ServerType)
- func LaunchPeriodicDirectorDiscovery(ctx context.Context, isDirector bool) error
- func LaunchPeriodicDirectorTimeout(ctx context.Context, egrp *errgroup.Group, nChan chan bool)
- func LaunchWatcherMaintenance(ctx context.Context, dirPaths []string, description string, ...)
- func MigrateDB(sqldb *sql.DB, migrationFS embed.FS) error
- func NewAutoCreateDirFs(fs afero.Fs) afero.Fs
- func OriginExportsDecoderHook() mapstructure.DecodeHookFunc
- func QueryMyPrometheus(ctx context.Context, query string) (promParsed promQLParsed, err error)
- func RegisterBrokerReset(fn func())
- func RegisterOIDCAPI(engine *gin.RouterGroup, isDirector bool)
- func RegisterPOSIXv2Reset(fn func())
- func RegisterPelicanUrlReset(fn func())
- func RegisterSSHBackendReset(fn func())
- func RegisterXrootdReset(fn func())
- func RemoveTrailingSlash(prefix string) string
- func ResetOriginExports()
- func ResetTestState()
- func SetBrokerURL(ad *server_structs.OriginAdvertiseV2, serverType server_structs.ServerType, ...) error
- func SetFedTok(ctx context.Context, server server_structs.XRootDServer, tok string, ...) error
- func SetupFedTokDirs(server server_structs.XRootDServer) error
- func ShutdownDB(db *gorm.DB) error
- func StashPelicanHeaders(r *http.Request) *http.Request
- func StringListToCapsHookFunc() mapstructure.DecodeHookFuncType
- func WaitUntilWorking(ctx context.Context, method, reqUrl, server string, expectedStatus int, ...) error
- func WithPelicanHeaders(ctx context.Context, h *PelicanHeaders) context.Context
- type AferoFile
- type AferoFileSystem
- func (afs *AferoFileSystem) FullPath(name string) string
- func (afs *AferoFileSystem) Mkdir(ctx context.Context, name string, perm os.FileMode) error
- func (afs *AferoFileSystem) OpenFile(ctx context.Context, name string, flag int, perm os.FileMode) (webdav.File, error)
- func (afs *AferoFileSystem) RemoveAll(ctx context.Context, name string) error
- func (afs *AferoFileSystem) Rename(ctx context.Context, oldName, newName string) error
- func (afs *AferoFileSystem) Stat(ctx context.Context, name string) (os.FileInfo, error)
- type AutoCreateDirFs
- type BaseOrigin
- type ContextKey
- type FedTokCopyToXrootdFunc
- type GlobusOrigin
- type HTTPSOrigin
- type HTTPStatusCoder
- type Origin
- type OriginBackend
- type OriginChecksummer
- type OriginExport
- type OsRootFile
- func (f *OsRootFile) Close() error
- func (f *OsRootFile) Name() string
- func (f *OsRootFile) Read(b []byte) (n int, err error)
- func (f *OsRootFile) ReadAt(b []byte, off int64) (n int, err error)
- func (f *OsRootFile) ReadFrom(r io.Reader) (n int64, err error)
- func (f *OsRootFile) Readdir(count int) ([]os.FileInfo, error)
- func (f *OsRootFile) Readdirnames(n int) ([]string, error)
- func (f *OsRootFile) Seek(offset int64, whence int) (int64, error)
- func (f *OsRootFile) Stat() (os.FileInfo, error)
- func (f *OsRootFile) Sync() error
- func (f *OsRootFile) Truncate(size int64) error
- func (f *OsRootFile) Write(b []byte) (n int, err error)
- func (f *OsRootFile) WriteAt(b []byte, off int64) (n int, err error)
- func (f *OsRootFile) WriteString(s string) (ret int, err error)
- func (f *OsRootFile) WriteTo(w io.Writer) (n int64, err error)
- type OsRootFs
- func (ofs *OsRootFs) Chmod(name string, mode os.FileMode) error
- func (ofs *OsRootFs) Chown(name string, uid, gid int) error
- func (ofs *OsRootFs) Chtimes(name string, atime time.Time, mtime time.Time) error
- func (ofs *OsRootFs) Create(name string) (afero.File, error)
- func (ofs *OsRootFs) Lstat(name string) (os.FileInfo, error)
- func (ofs *OsRootFs) LstatIfPossible(name string) (os.FileInfo, bool, error)
- func (ofs *OsRootFs) Mkdir(name string, perm os.FileMode) error
- func (ofs *OsRootFs) MkdirAll(path string, perm os.FileMode) error
- func (ofs *OsRootFs) Name() string
- func (ofs *OsRootFs) Open(name string) (afero.File, error)
- func (ofs *OsRootFs) OpenFile(name string, flag int, perm os.FileMode) (afero.File, error)
- func (ofs *OsRootFs) Readlink(name string) (string, error)
- func (ofs *OsRootFs) ReadlinkIfPossible(name string) (string, error)
- func (ofs *OsRootFs) Remove(name string) error
- func (ofs *OsRootFs) RemoveAll(path string) error
- func (ofs *OsRootFs) Rename(oldname, newname string) error
- func (ofs *OsRootFs) Stat(name string) (os.FileInfo, error)
- func (ofs *OsRootFs) Symlink(oldname, newname string) error
- func (ofs *OsRootFs) SymlinkIfPossible(oldname, newname string) error
- type PelicanHeaders
- type PosixOrigin
- type Posixv2Origin
- type S3Origin
- type SSHOrigin
- type TestFileTransfer
- type TestFileTransferImpl
- type TestType
- type XRootOrigin
Constants ¶
const ( SelfTestBody string = "This object was created by the Pelican self-test functionality" DirectorTestBody string = "This object was created by the Pelican director-test functionality" )
const MonitoringBaseNs string = "/pelican/monitoring" // The base namespace for monitoring objects
Variables ¶
var ( ErrInvalidOriginConfig = errors.New("invalid origin configuration") WarnExportVolumes string = "Using ExportVolumes from the command line (-v), from env vars or in your config causes Pelican to ignore exports " + "configured via 'Origin.Exports' configuration. " + "However, namespaces exported this way will inherit the Origin.Enable* settings from your configuration file. " + "For finer-grained control of each export, please configure them in your pelican.yaml file via 'Origin.Exports'" )
Functions ¶
func CheckOriginSentinelLocations ¶
func CheckOriginSentinelLocations(exports []OriginExport) (ok bool, err error)
Check the sentinel files from Origin.Exports
func CreateFedTok ¶
func CreateFedTok(ctx context.Context, server server_structs.XRootDServer) (tok string, err error)
GetFedTok retrieves a federation token from the Director, which can be passed to other federation services as proof of federation membership.
func FilterTopLevelPrefixes ¶
func FilterTopLevelPrefixes(nsAds []server_structs.NamespaceAdV2) []server_structs.NamespaceAdV2
Given a slice of NamespaceAdV2 objects, return a slice of unique top-level prefixes.
For example, given:
- /foo
- /foo/bar
- /foo/bar/baz
- /goo
- /some/path
the function should return /foo, /goo, and /some/path.
func GetAdvertisementTok ¶
func GetAdvertisementTok(server server_structs.XRootDServer, directorUrl string) (tok string, err error)
Get an advertisement token for the given server. Advertisement tokens are signed by the server and passed to the Director, which can then use them to check the server's identity. Tokens are valid when the Director can query the public key for the given server from the Registry.
func GetDirectorAds ¶
func GetDirectorAds() []server_structs.DirectorAd
Return a list of known director ads
func GetServerMetadata ¶
func GetServerMetadata(ctx context.Context, server server_structs.ServerType) (metadata server_structs.ServerRegistration, err error)
Centralized code for determining the metadata of the server.
This function is called by a server to look up its own metadata from the registry using local configuration parameters. It cannot query metadata for other servers.
The server's name should be unique and human-friendly: for example, "UW_OSDF_CACHE". It will be registered at the registry to ensure uniqueness within the federation.
There are improvements to do here: once registered, the server should serialize the name. It should also be for the service itself, not specific to the "origin" or "cache" component.
In the current implementation, if the origin component is enabled, we always look up the registered "server name" for the hostname in the registry under /origins; otherwise, we look it up under /caches.
func GetTopologyJSON ¶
func GetTopologyJSON(ctx context.Context) (*server_structs.TopologyNamespacesJSON, error)
GetTopologyJSON returns the namespaces and caches from OSDF topology
func HandleDirectorTestResponse ¶
The director periodically uploads/downloads files to/from all online origins for testing. It sends a request reporting the status of the test result to this endpoint, and we will update origin internal health status metric by what director returns.
func IsDirectorAdFromSelf ¶
func IsDirectorAdFromSelf(ctx context.Context, ad server_structs.ServerBaseAdInterface) (bool, error)
Returns `true` if the provided ad was generated by the current process.
We define "self" to be any ad with our name and instance ID.
func IssuerUrlsHookFunc ¶
func IssuerUrlsHookFunc() mapstructure.DecodeHookFuncType
Decode the issuerUrls field in the Origin.Exports block
func LaunchConcurrencyMonitoring ¶
func LaunchConcurrencyMonitoring(ctx context.Context, egrp *errgroup.Group, sType server_structs.ServerType)
Launch the origin/cache's concurrency monitoring routine
The routine periodically scrapes the servers own prometheus endpoint to gather information about the IO concurrency it's seen over the last period. This is used to set a health status that gets reported to the Director, which can help inform the Director whether it needs to cool down redirects to the server.
func LaunchPeriodicDirectorDiscovery ¶
Launch goroutine that periodically discovers all the known directors in a federation.
func LaunchPeriodicDirectorTimeout ¶
Launch a go routine in errorgroup to report timeout if director-based health test response was not sent within the defined time limit
func LaunchWatcherMaintenance ¶
func LaunchWatcherMaintenance(ctx context.Context, dirPaths []string, description string, sleepTime time.Duration, maintenanceFunc func(notifyEvent bool) error)
Launch a maintenance goroutine. The maintenance routine will watch the directory `dirPath`, invoking `maintenanceFunc` whenever an event occurs in the directory. Note the behavior of directory watching differs across platforms; for example, an atomic rename might be one or two events for the destination file depending on Mac OS X or Linux.
Even if the filesystem watcher fails, this will invoke `maintenanceFunc` every `sleepTime` duration. The maintenance function will be called with `true` if invoked due to a directory change, false otherwise When generating error messages, `description` will be used to describe the task.
func MigrateDB ¶
Update database schema with the embedded migration files
The embedded migration files need to be under "/migrations" folder
func NewAutoCreateDirFs ¶
NewAutoCreateDirFs creates a new filesystem that auto-creates parent directories
func OriginExportsDecoderHook ¶
func OriginExportsDecoderHook() mapstructure.DecodeHookFunc
A small convenience function for composing all the relevant decoder hooks needed to work with Origin.Exports config
func QueryMyPrometheus ¶
Query the Prometheus PromQL endpoint on the director server at /api/v1.0/prometheus/query?query=
where the only arg is the query to execute, without "?query="
Example: queryPromtheus("up") // Get metric of the running Prometheus instances
func RegisterBrokerReset ¶
func RegisterBrokerReset(fn func())
RegisterBrokerReset allows the broker package to provide a reset hook without introducing import cycles.
func RegisterOIDCAPI ¶
func RegisterOIDCAPI(engine *gin.RouterGroup, isDirector bool)
func RegisterPOSIXv2Reset ¶
func RegisterPOSIXv2Reset(fn func())
RegisterPOSIXv2Reset allows the origin_serve package to provide a reset hook without introducing import cycles.
func RegisterPelicanUrlReset ¶
func RegisterPelicanUrlReset(fn func())
RegisterPelicanUrlReset allows the pelican_url package to provide a reset hook without introducing import cycles.
func RegisterSSHBackendReset ¶
func RegisterSSHBackendReset(fn func())
RegisterSSHBackendReset allows the ssh_posixv2 package to provide a reset hook without introducing import cycles.
func RegisterXrootdReset ¶
func RegisterXrootdReset(fn func())
RegisterXrootdReset allows the xrootd package to provide a reset hook without introducing import cycles.
func RemoveTrailingSlash ¶
Remove the trailing '/' in the prefix, if it exists. If the prefix is '/', leave it alone.
func ResetOriginExports ¶
func ResetOriginExports()
func ResetTestState ¶
func ResetTestState()
Reset the testing state, including: 1. viper settings, 2. preferred prefix, 3. transport object, 4. Federation metadata, 5. origin exports
func SetBrokerURL ¶
func SetBrokerURL(ad *server_structs.OriginAdvertiseV2, serverType server_structs.ServerType, prefixes []string) error
SetBrokerURL sets the broker URL in the advertisement for servers that have broker support enabled. Returns the broker URL string if successful, or an empty string if not applicable.
func SetFedTok ¶
func SetFedTok(ctx context.Context, server server_structs.XRootDServer, tok string, copyToXrootdDir FedTokCopyToXrootdFunc) error
SetFedTok does an atomic write of a federation token to the server's token location.
func SetupFedTokDirs ¶
func SetupFedTokDirs(server server_structs.XRootDServer) error
SetupFedTokDirs creates the permanent and temporary directory for the federation token file and sets proper perms. It intends to be called once at server startup. The permanent directory is always owned by xrootd user. In normal mode, the temporary directory is owned by the root. While in drop privileges mode, it is owned by the pelican user.
func ShutdownDB ¶
func StashPelicanHeaders ¶
StashPelicanHeaders is a convenience that extracts X-Pelican-JobId and X-Pelican-Timeout from the incoming request and returns a new request whose context carries the values.
func StringListToCapsHookFunc ¶
func StringListToCapsHookFunc() mapstructure.DecodeHookFuncType
A decoder hook we can pass to viper.Unmarshal to convert a list of strings to a struct with boolean fields. In this case, we're converting a string slice (flow) from yaml:
Exports: Capabilities: ["PublicReads", "Writes"]
to a struct like:
ExportCapabilities{
PublicReads: true,
Writes: true,
Listings: false,
}
Here's a helpful tutorial on how to write these: https://sagikazarmark.hu/blog/decoding-custom-formats-with-viper/
func WaitUntilWorking ¶
func WaitUntilWorking(ctx context.Context, method, reqUrl, server string, expectedStatus int, statusMismatch bool) error
Wait until given `reqUrl` returns the expected status. Logging messages emitted will refer to `server` (e.g., origin, cache, director) The `statusMismatch` param tells the probe not to fail immediately when a bad code is returned, useful when the probed endpoint may be able to respond before it's fully initialized.
func WithPelicanHeaders ¶
func WithPelicanHeaders(ctx context.Context, h *PelicanHeaders) context.Context
WithPelicanHeaders stores the given headers in ctx.
Types ¶
type AferoFile ¶
type AferoFile struct {
afero.File
Fs afero.Fs
Name string
DirEntries []os.FileInfo // Cached directory entries for pagination
DirOffset int // Current offset in directory entries
DirMutex sync.Mutex // Mutex for concurrent access
Logger func(*http.Request, error) // WebDAV logger
}
AferoFile wraps an afero.File to implement webdav.File
type AferoFileSystem ¶
AferoFileSystem wraps an afero.Fs to implement webdav.FileSystem
func NewAferoFileSystem ¶
func NewAferoFileSystem(fs afero.Fs, prefix string, logger func(*http.Request, error)) *AferoFileSystem
NewAferoFileSystem creates a new AferoFileSystem
func (*AferoFileSystem) FullPath ¶
func (afs *AferoFileSystem) FullPath(name string) string
FullPath converts a webdav path to a full filesystem path
func (*AferoFileSystem) OpenFile ¶
func (afs *AferoFileSystem) OpenFile(ctx context.Context, name string, flag int, perm os.FileMode) (webdav.File, error)
OpenFile implements webdav.FileSystem
func (*AferoFileSystem) RemoveAll ¶
func (afs *AferoFileSystem) RemoveAll(ctx context.Context, name string) error
RemoveAll implements webdav.FileSystem
type AutoCreateDirFs ¶
AutoCreateDirFs wraps an afero.Fs to automatically create parent directories when opening a file for writing
type BaseOrigin ¶
type BaseOrigin struct {
Exports []OriginExport
// contains filtered or unexported fields
}
Base origin struct that all other origin types will inherit from
func (*BaseOrigin) Type ¶
func (b *BaseOrigin) Type(o Origin) server_structs.OriginStorageType
type ContextKey ¶
type ContextKey string
const ( // Context value key; used to store a second context that will // indicate the director discovery should stop. // // Meant mostly for unit tests; director discovery is essential // functionality. DirectorDiscoveryShutdownKey ContextKey = "discovery_shutdown" )
type FedTokCopyToXrootdFunc ¶
FedTokCopyToXrootdFunc is an optional callback used when Server.DropPrivileges is true. It is defined here so that server_utils does not import the xrootd package; the caller (e.g. launchers/cache_serve) wires in xrootd.FileCopyToXrootdDir to avoid import cycles.
type GlobusOrigin ¶
type GlobusOrigin struct {
BaseOrigin
}
Inherit from the base origin
func (*GlobusOrigin) Type ¶
func (o *GlobusOrigin) Type(_ Origin) server_structs.OriginStorageType
type HTTPSOrigin ¶
type HTTPSOrigin struct {
BaseOrigin
}
Inherit from the base origin
func (*HTTPSOrigin) Type ¶
func (o *HTTPSOrigin) Type(_ Origin) server_structs.OriginStorageType
type HTTPStatusCoder ¶
type HTTPStatusCoder interface {
HTTPStatusCode() int
}
HTTPStatusCoder is optionally implemented by errors returned from CheckAvailability to control the HTTP status code sent to clients.
type Origin ¶
type Origin interface {
Type(Origin) server_structs.OriginStorageType
// contains filtered or unexported methods
}
type OriginBackend ¶
type OriginBackend interface {
// CheckAvailability returns nil when the backend can serve requests.
// If the backend cannot serve, the returned error's message is sent
// to the client. If the error also implements HTTPStatusCoder the
// handler uses that status code; otherwise it defaults to 503.
CheckAvailability() error
// FileSystem returns the webdav.FileSystem that serves this export.
FileSystem() webdav.FileSystem
// Checksummer returns an OriginChecksummer for HEAD-request digest
// headers, or nil if the backend does not support checksums.
Checksummer() OriginChecksummer
}
OriginBackend abstracts a storage backend for the origin server. Every export is backed by exactly one OriginBackend, which supplies the WebDAV filesystem, availability status, and optional checksum support.
Backends are created during handler initialisation (one per export) and used by the generic request handler without knowledge of the underlying storage technology.
type OriginChecksummer ¶
type OriginChecksummer interface {
// GetDigests returns RFC 3230 formatted digest strings (e.g.
// "md5=...", "crc32c=...") for the given file. wantDigest is the
// raw Want-Digest header value from the client (comma-separated
// algorithm names).
GetDigests(relativePath string, wantDigest string) ([]string, error)
}
OriginChecksummer provides RFC 3230 Digest header values for files served by an origin backend.
type OriginExport ¶
type OriginExport struct {
StoragePrefix string `json:"storagePrefix"`
FederationPrefix string `json:"federationPrefix"`
IssuerUrls []string `json:"issuerUrls"`
// Export fields specific to S3 backend. Other things like
// S3ServiceUrl, S3Region, etc are kept top-level in the config
S3Bucket string `json:"s3Bucket,omitempty"`
S3AccessKeyfile string `json:"s3AccessKeyfile,omitempty"`
S3SecretKeyfile string `json:"s3SecretKeyfile,omitempty"`
// Export fields specific to Globus backend
GlobusCollectionID string `json:"globusCollectionID,omitempty"`
GlobusCollectionName string `json:"globusCollectionName,omitempty"`
// Capabilities for the export
Capabilities server_structs.Capabilities `json:"capabilities"`
SentinelLocation string `json:"sentinelLocation"`
// AuthorizationTemplates are per-export authorization rules.
// When set, these override the global Issuer.AuthorizationTemplates
// for this export's namespace.
AuthorizationTemplates []interface{} `json:"authorizationTemplates,omitempty" mapstructure:"authorizationtemplates" yaml:"AuthorizationTemplates"`
}
TODO: pull storage-specific fields into a separate struct and mixin
func GetOriginExports ¶
func GetOriginExports() ([]OriginExport, error)
GetOriginExports is the one-stop shop for parsing/configuring origin exports. It should only touch the yaml the first time it's called, and then return the in-memory value on subsequent calls.
type OsRootFile ¶
OsRootFile wraps os.File to implement afero.File interface
func (*OsRootFile) Read ¶
func (f *OsRootFile) Read(b []byte) (n int, err error)
Read reads from the file
func (*OsRootFile) ReadAt ¶
func (f *OsRootFile) ReadAt(b []byte, off int64) (n int, err error)
ReadAt reads from the file at offset
func (*OsRootFile) ReadFrom ¶
func (f *OsRootFile) ReadFrom(r io.Reader) (n int64, err error)
ReadFrom implements io.ReaderFrom
func (*OsRootFile) Readdir ¶
func (f *OsRootFile) Readdir(count int) ([]os.FileInfo, error)
Readdir reads directory entries
func (*OsRootFile) Readdirnames ¶
func (f *OsRootFile) Readdirnames(n int) ([]string, error)
Readdirnames reads directory entry names
func (*OsRootFile) Seek ¶
func (f *OsRootFile) Seek(offset int64, whence int) (int64, error)
Seek seeks to position in file
func (*OsRootFile) Truncate ¶
func (f *OsRootFile) Truncate(size int64) error
Truncate truncates the file
func (*OsRootFile) Write ¶
func (f *OsRootFile) Write(b []byte) (n int, err error)
Write writes to the file
func (*OsRootFile) WriteAt ¶
func (f *OsRootFile) WriteAt(b []byte, off int64) (n int, err error)
WriteAt writes to the file at offset
func (*OsRootFile) WriteString ¶
func (f *OsRootFile) WriteString(s string) (ret int, err error)
WriteString writes a string to the file
type OsRootFs ¶
type OsRootFs struct {
// contains filtered or unexported fields
}
OsRootFs is a filesystem implementation using os.Root (Go 1.25+) to prevent symlink traversal attacks. It wraps all filesystem operations to ensure they stay within a designated root directory.
func NewOsRootFs ¶
NewOsRootFs creates a new OsRootFs with the given root directory
func (*OsRootFs) Lstat ¶
Lstat returns file info without following symlinks Since os.Root prevents escaping via symlinks, this is safe
func (*OsRootFs) LstatIfPossible ¶
LstatIfPossible returns file info without following symlinks if possible
func (*OsRootFs) ReadlinkIfPossible ¶
ReadlinkIfPossible returns the target of a symlink if possible
func (*OsRootFs) SymlinkIfPossible ¶
SymlinkIfPossible creates a symlink if possible
type PelicanHeaders ¶
PelicanHeaders holds the subset of client HTTP headers that should be propagated through internal layers (e.g. WebDAV → backend) for tracing and timeout purposes.
func PelicanHeadersFromContext ¶
func PelicanHeadersFromContext(ctx context.Context) *PelicanHeaders
PelicanHeadersFromContext retrieves previously stashed PelicanHeaders (or nil if none were stored).
type PosixOrigin ¶
type PosixOrigin struct {
BaseOrigin
}
Inherit from the base origin
func (*PosixOrigin) Type ¶
func (o *PosixOrigin) Type(_ Origin) server_structs.OriginStorageType
type Posixv2Origin ¶
type Posixv2Origin struct {
BaseOrigin
}
Inherit from the base origin
func (*Posixv2Origin) Type ¶
func (o *Posixv2Origin) Type(_ Origin) server_structs.OriginStorageType
type S3Origin ¶
type S3Origin struct {
BaseOrigin
}
Inherit from the base origin
func (*S3Origin) Type ¶
func (o *S3Origin) Type(_ Origin) server_structs.OriginStorageType
type SSHOrigin ¶
type SSHOrigin struct {
BaseOrigin
}
SSHOrigin represents an origin that uses SSH to access remote storage
func (*SSHOrigin) Type ¶
func (o *SSHOrigin) Type(_ Origin) server_structs.OriginStorageType
type TestFileTransfer ¶
type TestFileTransferImpl ¶
type TestFileTransferImpl struct {
// contains filtered or unexported fields
}
func (TestFileTransferImpl) RunTests ¶
func (t TestFileTransferImpl) RunTests(ctx context.Context, baseUrl, audienceUrl, issuerUrl string, testType TestType) (bool, error)
Run a file transfer test suite with upload/download/delete a test file from the server and a xrootd service. It expects `baseUrl` to be the url to the xrootd endpoint, `issuerUrl` be the url to issue scitoken for file transfer, and the test file content/name be based on `testType`
Note that for this test to work, you need to have the `issuerUrl` registered in your xrootd as a list of trusted token issuers and the issuer is expected to follow WLCG rules for issuer metadata discovery and public key access
Read more: https://github.com/WLCG-AuthZ-WG/common-jwt-profile/blob/master/profile.md#token-verification
func (TestFileTransferImpl) TestCacheDownload ¶
func (t TestFileTransferImpl) TestCacheDownload(ctx context.Context, cacheUrl, issuerUrl string, filePath string, body string) (bool, error)
Run a file transfer test to download a test file from the server and a xrootd service. It expects `cacheUrl` to be the url to the xrootd cache, `issuerUrl` be the url to issue a scitoken for file transfer, `filePath“ to be the namespace and file name of the test file, and the test file to contain the string `body`
Note that for this test to work, you need to have the `issuerUrl` registered in your xrootd as a list of trusted token issuers and the issuer is expected to follow WLCG rules for issuer metadata discovery and public key access
Read more: https://github.com/WLCG-AuthZ-WG/common-jwt-profile/blob/master/profile.md#token-verification
type XRootOrigin ¶
type XRootOrigin struct {
BaseOrigin
}
Inherit from the base origin
func (*XRootOrigin) Type ¶
func (o *XRootOrigin) Type(_ Origin) server_structs.OriginStorageType