Documentation

Overview

    Package xrdfs contains structures representing the XRootD-based filesystem.

    Index

    Constants

    This section is empty.

    Variables

    This section is empty.

    Functions

    This section is empty.

    Types

    type EntryStat

    type EntryStat struct {
    	EntryName   string    // EntryName is the name of entry.
    	HasStatInfo bool      // HasStatInfo indicates if the following stat information is valid.
    	ID          int64     // ID is the OS-dependent identifier assigned to this entry.
    	EntrySize   int64     // EntrySize is the decimal size of the entry.
    	Flags       StatFlags // Flags identifies the entry's attributes.
    	Mtime       int64     // Mtime is the last modification time in Unix time units.
    }

      EntryStat holds the entry name and the entry stat information.

      func EntryStatFrom

      func EntryStatFrom(info os.FileInfo) EntryStat

        EntryStatFrom creates an EntryStat that represents same information as the provided info.

        func (EntryStat) IsDir

        func (es EntryStat) IsDir() bool

          IsDir indicates whether this entry is a directory.

          func (EntryStat) IsExecutable

          func (es EntryStat) IsExecutable() bool

            IsExecutable indicates whether this entry is either an executable file or a searchable directory.

            func (EntryStat) IsOffline

            func (es EntryStat) IsOffline() bool

              IsOffline indicates whether this the file is not online (i. e., on disk).

              func (EntryStat) IsOther

              func (es EntryStat) IsOther() bool

                IsOther indicates whether this entry is neither a file nor a directory.

                func (EntryStat) IsPOSCPending

                func (es EntryStat) IsPOSCPending() bool

                  IsPOSCPending indicates whether this the file was created with kXR_posc and has not yet been successfully closed. kXR_posc is an option of open request indicating that the "Persist On Successful Close" processing is enabled and the file will be persisted only when it has been explicitly closed.

                  func (EntryStat) IsReadable

                  func (es EntryStat) IsReadable() bool

                    IsReadable indicates whether this read access to that entry is allowed.

                    func (EntryStat) IsWritable

                    func (es EntryStat) IsWritable() bool

                      IsWritable indicates whether this write access to that entry is allowed.

                      func (EntryStat) MarshalXrd

                      func (o EntryStat) MarshalXrd(wBuffer *xrdenc.WBuffer) error

                        MarshalXrd implements xrdproto.Marshaler.

                        func (EntryStat) ModTime

                        func (es EntryStat) ModTime() time.Time

                          ModTime implements os.FileInfo.

                          func (EntryStat) Mode

                          func (es EntryStat) Mode() os.FileMode

                            Mode implements os.FileInfo.

                            func (EntryStat) Name

                            func (es EntryStat) Name() string

                              Name implements os.FileInfo.

                              func (EntryStat) Size

                              func (es EntryStat) Size() int64

                                Size implements os.FileInfo.

                                func (EntryStat) Sys

                                func (es EntryStat) Sys() interface{}

                                  Sys implements os.FileInfo.

                                  func (*EntryStat) UnmarshalXrd

                                  func (o *EntryStat) UnmarshalXrd(rBuffer *xrdenc.RBuffer) error

                                    UnmarshalXrd implements xrdproto.Unmarshaler.

                                    type File

                                    type File interface {
                                    	io.ReaderAt
                                    	io.WriterAt
                                    
                                    	// Compression returns the compression info.
                                    	Compression() *FileCompression
                                    
                                    	// Info returns the cached stat info.
                                    	// Note that it may return nil if info was not yet fetched and info may be not up-to-date.
                                    	Info() *EntryStat
                                    
                                    	// Handle returns the file handle.
                                    	Handle() FileHandle
                                    
                                    	// Close closes the file.
                                    	Close(ctx context.Context) error
                                    
                                    	// CloseVerify closes the file and checks whether the file has the provided size.
                                    	// A zero size suppresses the verification.
                                    	CloseVerify(ctx context.Context, size int64) error
                                    
                                    	// Sync commits all pending writes to an open file.
                                    	Sync(ctx context.Context) error
                                    
                                    	// ReadAtContext reads len(p) bytes into p starting at offset off.
                                    	ReadAtContext(ctx context.Context, p []byte, off int64) (n int, err error)
                                    
                                    	// WriteAtContext writes len(p) bytes from p to the file at offset off.
                                    	WriteAtContext(ctx context.Context, p []byte, off int64) error
                                    
                                    	// Truncate changes the size of the file.
                                    	Truncate(ctx context.Context, size int64) error
                                    
                                    	// Stat fetches the stat info of this file from the XRootD server.
                                    	// Note that Stat re-fetches value returned by the Info, so after the call to Stat
                                    	// calls to Info may return different value than before.
                                    	Stat(ctx context.Context) (EntryStat, error)
                                    
                                    	// StatVirtualFS fetches the virtual stat info of this file from the XRootD server.
                                    	StatVirtualFS(ctx context.Context) (VirtualFSStat, error)
                                    
                                    	// VerifyWriteAt writes len(p) bytes from p to the file at offset off using crc32 verification.
                                    	//
                                    	// TODO: note that verifyw is not supported by the XRootD server.
                                    	// See https://github.com/xrootd/xrootd/issues/738 for the details.
                                    	VerifyWriteAt(ctx context.Context, p []byte, off int64) error
                                    }

                                      File implements access to a content and meta information of file over XRootD.

                                      type FileCompression

                                      type FileCompression struct {
                                      	PageSize int32
                                      	Type     [4]byte
                                      }

                                        FileCompression holds the compression parameters such as the page size and the type of compression.

                                        func (FileCompression) MarshalXrd

                                        func (o FileCompression) MarshalXrd(wBuffer *xrdenc.WBuffer) error

                                          MarshalXrd implements xrdproto.Marshaler

                                          func (*FileCompression) UnmarshalXrd

                                          func (o *FileCompression) UnmarshalXrd(rBuffer *xrdenc.RBuffer) error

                                            UnmarshalXrd implements xrdproto.Unmarshaler

                                            type FileHandle

                                            type FileHandle [4]byte

                                              FileHandle is the file handle, which should be treated as opaque data.

                                              type FileSystem

                                              type FileSystem interface {
                                              	// Dirlist returns the contents of a directory together with the stat information.
                                              	Dirlist(ctx context.Context, path string) ([]EntryStat, error)
                                              
                                              	// Open returns the file handle for a file together with the compression and the stat info.
                                              	Open(ctx context.Context, path string, mode OpenMode, options OpenOptions) (File, error)
                                              
                                              	// RemoveFile removes the file at path.
                                              	RemoveFile(ctx context.Context, path string) error
                                              
                                              	// Truncate changes the size of the named file.
                                              	Truncate(ctx context.Context, path string, size int64) error
                                              
                                              	// Stat returns the entry stat info for the given path.
                                              	Stat(ctx context.Context, path string) (EntryStat, error)
                                              
                                              	// VirtualStat returns the virtual filesystem stat info for the given path.
                                              	// Note that path needs not to be an existing filesystem object, it is used as a path prefix in order to
                                              	// filter out servers and partitions that could not be used to hold objects whose path starts
                                              	// with the specified path prefix.
                                              	VirtualStat(ctx context.Context, path string) (VirtualFSStat, error)
                                              
                                              	// Mkdir creates a new directory with the specified name and permission bits.
                                              	Mkdir(ctx context.Context, path string, perm OpenMode) error
                                              
                                              	// MkdirAll creates a directory named path, along with any necessary parents,
                                              	// and returns nil, or else returns an error.
                                              	// The permission bits perm are used for all directories that MkdirAll creates.
                                              	MkdirAll(ctx context.Context, path string, perm OpenMode) error
                                              
                                              	// RemoveDir removes a directory.
                                              	// The directory to be removed must be empty.
                                              	RemoveDir(ctx context.Context, path string) error
                                              
                                              	// RemoveAll removes path and any children it contains.
                                              	// It removes everything it can but returns the first error it encounters.
                                              	// If the path does not exist, RemoveAll returns nil (no error.)
                                              	RemoveAll(ctx context.Context, path string) error
                                              
                                              	// Rename renames (moves) oldpath to newpath.
                                              	Rename(ctx context.Context, oldpath, newpath string) error
                                              
                                              	// Chmod changes the permissions of the named file to perm.
                                              	Chmod(ctx context.Context, path string, mode OpenMode) error
                                              
                                              	// Statx obtains type information for one or more paths.
                                              	// Only a limited number of flags is meaningful such as StatIsExecutable, StatIsDir, StatIsOther, StatIsOffline.
                                              	Statx(ctx context.Context, paths []string) ([]StatFlags, error)
                                              }

                                                FileSystem implements access to a collection of named files over XRootD.

                                                type OpenMode

                                                type OpenMode uint16

                                                  OpenMode is the mode in which path is to be opened. The mode is an "or`d" combination of ModeXyz flags.

                                                  const (
                                                  	OpenModeOwnerRead    OpenMode = 0x100 // OpenModeOwnerRead indicates that owner has read access.
                                                  	OpenModeOwnerWrite   OpenMode = 0x080 // OpenModeOwnerWrite indicates that owner has write access.
                                                  	OpenModeOwnerExecute OpenMode = 0x040 // OpenModeOwnerExecute indicates that owner has execute access.
                                                  
                                                  	OpenModeGroupRead    OpenMode = 0x020 // OpenModeGroupRead indicates that group has read access.
                                                  	OpenModeGroupWrite   OpenMode = 0x010 // OpenModeGroupWrite indicates that group has write access.
                                                  	OpenModeGroupExecute OpenMode = 0x008 // OpenModeGroupExecute indicates that group has execute access.
                                                  
                                                  	OpenModeOtherRead    OpenMode = 0x004 // OpenModeOtherRead indicates that owner has read access.
                                                  	OpenModeOtherWrite   OpenMode = 0x002 // OpenModeOtherWrite indicates that owner has write access.
                                                  	OpenModeOtherExecute OpenMode = 0x001 // OpenModeOtherExecute indicates that owner has execute access.
                                                  )

                                                  type OpenOptions

                                                  type OpenOptions uint16

                                                    OpenOptions are the options to apply when path is opened.

                                                    const (
                                                    	// OpenOptionsCompress specifies that file is opened even when compressed.
                                                    	OpenOptionsCompress OpenOptions = 1 << iota
                                                    	// OpenOptionsDelete specifies that file is opened deleting any existing file.
                                                    	OpenOptionsDelete
                                                    	// OpenOptionsForce specifies that file is opened ignoring  file usage rules.
                                                    	OpenOptionsForce
                                                    	// OpenOptionsNew specifies that file is opened only if it does not already exist.
                                                    	OpenOptionsNew
                                                    	// OpenOptionsOpenRead specifies that file is opened only for reading.
                                                    	OpenOptionsOpenRead
                                                    	// OpenOptionsOpenUpdate specifies that file is opened only for reading and writing.
                                                    	OpenOptionsOpenUpdate
                                                    	// OpenOptionsAsync specifies that file is opened for asynchronous i/o.
                                                    	OpenOptionsAsync
                                                    	// OpenOptionsRefresh specifies that cached information on the file's location need to be updated.
                                                    	OpenOptionsRefresh
                                                    	// OpenOptionsMkPath specifies that directory path is created if it does not already exist.
                                                    	OpenOptionsMkPath
                                                    	// OpenOptionsOpenAppend specifies that file is opened only for appending.
                                                    	OpenOptionsOpenAppend
                                                    	// OpenOptionsReturnStatus specifies that file status information should be returned in the response.
                                                    	OpenOptionsReturnStatus
                                                    	// OpenOptionsReplica specifies that file is opened for replica creation.
                                                    	OpenOptionsReplica
                                                    	// OpenOptionsPOSC specifies that Persist On Successful Close (POSC) processing should be enabled.
                                                    	OpenOptionsPOSC
                                                    	// OpenOptionsNoWait specifies that file is opened only if it does not cause a wait.
                                                    	OpenOptionsNoWait
                                                    	// OpenOptionsSequentiallyIO specifies that file will be read or written sequentially.
                                                    	OpenOptionsSequentiallyIO
                                                    	// OpenOptionsNone specifies that file is opened without specific options.
                                                    	OpenOptionsNone OpenOptions = 0
                                                    )

                                                    type StatFlags

                                                    type StatFlags int32

                                                      StatFlags identifies the entry's attributes.

                                                      const (
                                                      	// StatIsFile indicates that entry is a regular file if no other flag is specified.
                                                      	StatIsFile StatFlags = 0
                                                      	// StatIsExecutable indicates that entry is either an executable file or a searchable directory.
                                                      	StatIsExecutable StatFlags = 1
                                                      	// StatIsDir indicates that entry is a directory.
                                                      	StatIsDir StatFlags = 2
                                                      	// StatIsOther indicates that entry is neither a file nor a directory.
                                                      	StatIsOther StatFlags = 4
                                                      	// StatIsOffline indicates that the file is not online (i. e., on disk).
                                                      	StatIsOffline StatFlags = 8
                                                      	// StatIsReadable indicates that read access to that entry is allowed.
                                                      	StatIsReadable StatFlags = 16
                                                      	// StatIsWritable indicates that write access to that entry is allowed.
                                                      	StatIsWritable StatFlags = 32
                                                      	// StatIsPOSCPending indicates that the file was created with kXR_posc and has not yet been successfully closed.
                                                      	// kXR_posc is an option of open request indicating that the "Persist On Successful Close" processing is enabled and
                                                      	// the file will be persisted only when it has been explicitly closed.
                                                      	StatIsPOSCPending StatFlags = 64
                                                      )

                                                      type VirtualFSStat

                                                      type VirtualFSStat struct {
                                                      	NumberRW           int // NumberRW is the number of nodes that can provide read/write space.
                                                      	FreeRW             int // FreeRW is the size, in megabytes, of the largest contiguous area of read/write free space.
                                                      	UtilizationRW      int // UtilizationRW is the percent utilization of the partition represented by FreeRW.
                                                      	NumberStaging      int // NumberStaging is the number of nodes that can provide staging space.
                                                      	FreeStaging        int // FreeStaging is the size, in megabytes, of the largest contiguous area of staging free space.
                                                      	UtilizationStaging int // UtilizationStaging is the percent utilization of the partition represented by FreeStaging.
                                                      }

                                                        VirtualFSStat holds the virtual file system information.

                                                        func (VirtualFSStat) MarshalXrd

                                                        func (o VirtualFSStat) MarshalXrd(wBuffer *xrdenc.WBuffer) error

                                                          MarshalXrd implements xrdproto.Marshaler

                                                          func (*VirtualFSStat) UnmarshalXrd

                                                          func (o *VirtualFSStat) UnmarshalXrd(rBuffer *xrdenc.RBuffer) error

                                                            UnmarshalXrd implements xrdproto.Unmarshaler

                                                            Source Files