FileMetadata

DIRAC FileCatalog plugin class to manage file metadata

class DIRAC.DataManagementSystem.DB.FileCatalogComponents.FileMetadata.FileMetadata.FileMetadata(database=None)

Bases: object

__init__(database=None)
addMetadataField(pName, pType, credDict)

Add a new metadata parameter to the Metadata Database.

Parameters:
  • pName (str) – parameter name

  • pType (str) – parameter type in the MySQL notation

Returns:

S_OK/S_ERROR, Value - comment on a positive result

deleteMetadataField(pName, credDict)

Remove metadata field

Parameters:
  • pName (str) – meta parameter name

  • credDict (dict) – client credential dictionary

Returns:

S_OK/S_ERROR

findFilesByMetadata(**kwargs)
getFileMetaParameters(path, credDict)

Get meta parameters for the given file

Parameters:
  • path (str) – file name

  • credDict (dict) – client credential dictionary

Returns:

S_OK/S_ERROR, Value - dict of meta parameters

getFileMetadataFields(credDict)

Get all the defined metadata fields

Parameters:

credDict (dict) – client credential dictionary

Returns:

S_OK/S_ERROR, Value is the metadata:metadata type dictionary

getFileUserMetadata(path, credDict)

Get metadata for the given file

Parameters:
  • path (str) – file name

  • credDict (dict) – client credential dictionary

Returns:

S_OK/S_ERROR, Value - dict of metadata

removeMetadata(path, metadata, credDict)

Remove the specified metadata for the given file

Parameters:
  • path (str) – file path

  • metadata (list) – list of meta parameter names

  • credDict (dict) – client credential dictionary

Returns:

S_OK/S_ERROR

setDatabase(database)
setFileMetaParameter(path, metaName, metaValue, credDict)

Set an meta parameter - metadata which is not used in the the data search operations

Parameters:
  • path (str) – file name

  • metaName (str) – meta parameter name

  • metaValue (str) – meta parameter value

  • credDict (dict) – client credential dictionary

Returns:

S_OK/S_ERROR

setMetadata(path, metaDict, credDict)

Set the value of a given metadata field for the the given directory path

Parameters:
  • path (str) – file path

  • metaDict (dict) – dictionary with metadata

  • credDict (dict) – client credential dictionary

Returns:

S_OK/S_ERROR