StorageElementHandler

mod:

StorageElementHandler

The handler implements also the DISET data transfer calls toClient(), fromClient(), bulkToClient(), bulkFromClient which support single file, directory and file list upload and download

The class can be used as the basis for more advanced StorageElement implementations

StorageElementHandler options
StorageElement
{
  # Local path where the data is stored
  BasePath = storageElement
  # Port exposed
  Port = 9148
  # Maximum size in MB you allow to store (0 meaning no limits)
  MaxStorageSize = 0

  Authorization
  {
    Default = authenticated
    FileTransfer
    {
      Default = authenticated
    }
  }
}
class DIRAC.DataManagementSystem.Service.StorageElementHandler.StorageElementHandler(handlerInitDict, trid)

Bases: RequestHandler

class StorageElementHandler
__init__(handlerInitDict, trid)

Constructor

Parameters:
  • handlerInitDict (dictionary) – Information vars for the service

  • trid (object) – Transport to use

auth_ping = ['all']
auth_refreshConfiguration = ['CSAdministrator']
auth_whoami = ['all']
export_createDirectory(dir_path)

Creates the directory on the storage

static export_echo(data)

This method is used for testing performance of the service

Parameters:

data (str) – data to be sent back to the caller

Returns:

S_OK, Value is the input data

export_exists(fileID)

Check existence of the fileID

static export_getAdminInfo()

Send the storage element administration information

export_getDirectorySize(fileID)

Get the size occupied by the given directory

static export_getFreeDiskSpace()

Get the free disk space of the storage element

Returns:

S_OK/S_ERROR, Value is the free space on the SE storage in B

export_getMetadata(fileID)

Get metadata for the file or directory specified by fileID

static export_getTotalDiskSpace()

Get the total disk space of the storage element

Returns:

S_OK/S_ERROR, Value is the max total volume of the SE storage in B

export_listDirectory(dir_path, mode)

Return the dir_path directory listing

export_ping()
static export_refreshConfiguration(fromMaster)

Force refreshing the configuration data

Parameters:

fromMaster (bool) – flag to refresh from the master configuration service

export_remove(fileID, token)

Remove fileID from the storage. token is used for access rights confirmation.

export_removeDirectory(fileID, token)

Remove the given directory from the storage

export_removeFileList(fileList, token)

Remove files in the given list

export_whoami()

A simple whoami, returns all credential dictionary, except certificate chain object.

classmethod getCSOption(optionName, defaultValue=False)

Get an option from the CS section of the services

Returns:

Value for serviceSection/optionName in the CS being defaultValue the default

getRemoteAddress()

Get the address of the remote peer.

Returns:

Address of remote peer.

getRemoteCredentials()

Get the credentials of the remote peer.

Returns:

Credentials dictionary of remote peer.

initialize()

Initialize this instance of the handler (to be overwritten)

srv_disconnect(trid=None)
classmethod srv_disconnectClient(trid)
srv_getActionTuple()
classmethod srv_getCSOption(optionName, defaultValue=False)

Get an option from the CS section of the services

Returns:

Value for serviceSection/optionName in the CS being defaultValue the default

srv_getClientSetup()
srv_getClientVO()
srv_getClientVersion()
srv_getFormattedRemoteCredentials()
classmethod srv_getMonitor()
srv_getRemoteAddress()

Get the address of the remote peer.

Returns:

Address of remote peer.

srv_getRemoteCredentials()

Get the credentials of the remote peer.

Returns:

Credentials dictionary of remote peer.

classmethod srv_getServiceName()
srv_getTransportID()
classmethod srv_getURL()
classmethod srv_msgCreate(msgName)
srv_msgReply(msgObj)
classmethod srv_msgSend(trid, msgObj)
transfer_bulkFromClient(fileID, token, _ignoredSize, fileHelper)

Receive files packed into a tar archive by the fileHelper logic. token is used for access rights confirmation.

transfer_bulkToClient(fileId, token, fileHelper)

Send directories and files specified in the fileID. The fileID string can be a single directory name or a list of colon (:) separated file/directory names. token is used for access rights confirmation.

transfer_fromClient(fileID, token, fileSize, fileHelper)

Method to receive file from clients. fileID is the local file name in the SE. fileSize can be Xbytes or -1 if unknown. token is used for access rights confirmation.

transfer_listBulk(bulkId, token, fileHelper)
transfer_toClient(fileID, token, fileHelper)

Method to send files to clients. fileID is the local file name in the SE. token is used for access rights confirmation.

types_createDirectory = [<class 'str'>]
types_echo = [<class 'str'>]
types_exists = [<class 'str'>]
types_getAdminInfo = []
types_getDirectorySize = [<class 'str'>]
types_getFreeDiskSpace = []
types_getMetadata = [<class 'str'>]
types_getTotalDiskSpace = []
types_listDirectory = [<class 'str'>, <class 'str'>]
types_ping = []
types_refreshConfiguration = [<class 'bool'>]
types_remove = [<class 'str'>, <class 'str'>]
types_removeDirectory = [<class 'str'>, <class 'str'>]
types_removeFileList = [<class 'list'>, <class 'str'>]
types_whoami = []
DIRAC.DataManagementSystem.Service.StorageElementHandler.getDiskSpace(path, total=False)

Returns disk usage of the given path, in Bytes. If total is set to true, the total disk space will be returned instead.

DIRAC.DataManagementSystem.Service.StorageElementHandler.getFreeDiskSpace()

Returns the free disk space still available for writing taking into account the total available disk space and the MAX_STORAGE_SIZE limitation

Returns:

S_OK/S_ERROR, Value is the free space of the SE storage in B

DIRAC.DataManagementSystem.Service.StorageElementHandler.getTotalDiskSpace()

Returns the total maximum volume of the SE storage in B. The total volume can be limited either by the amount of the available disk space or by the MAX_STORAGE_SIZE value.

Returns:

S_OK/S_ERROR, Value is the max total volume of the SE storage in B

DIRAC.DataManagementSystem.Service.StorageElementHandler.initializeStorageElementHandler(serviceInfo)

Initialize Storage Element global settings