Elasticsearch meta
Elasticsearch based metadata plugin.
Classes¶
ElasticDidMeta ¶
ElasticDidMeta(
hosts=None,
user=None,
password=None,
index=None,
archive_index=None,
use_ssl=False,
verify_certs=True,
ca_certs=None,
client_cert=None,
client_key=None,
request_timeout=100,
max_retries=3,
retry_on_timeout=False,
)
Functions¶
get_metadata ¶
get_metadata(scope, name, *, session=None)
Get data identifier metadata.
PARAMETER | DESCRIPTION |
---|---|
scope
|
The scope name
TYPE:
|
name
|
The data identifier name
TYPE:
|
session
|
The database session in use
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
dict[str, Any]
|
The metadata for the did |
RAISES | DESCRIPTION |
---|---|
DataIdentifierNotFound
|
If the DID metadata is not found. |
RucioException
|
If another error occurs during the process. |
set_metadata ¶
set_metadata(
scope,
name,
key,
value,
recursive=False,
*,
session=None
)
Set single metadata key.
PARAMETER | DESCRIPTION |
---|---|
scope
|
the scope of did
TYPE:
|
name
|
the name of the did
TYPE:
|
key
|
the key to be added
TYPE:
|
value
|
the value of the key to be added
TYPE:
|
recursive
|
recurse into DIDs (not supported)
TYPE:
|
session
|
The database session in use
TYPE:
|
RAISES | DESCRIPTION |
---|---|
DataIdentifierNotFound
|
If the DID is not found. |
RucioException
|
If an error occurs while setting the metadata. |
set_metadata_bulk ¶
set_metadata_bulk(
scope, name, meta, recursive=False, *, session=None
)
Bulk set metadata keys.
PARAMETER | DESCRIPTION |
---|---|
scope
|
the scope of did
TYPE:
|
name
|
the name of the did
TYPE:
|
meta
|
dictionary of metadata keypairs to be added
TYPE:
|
recursive
|
recurse into DIDs (not supported)
TYPE:
|
session
|
The database session in use
TYPE:
|
RAISES | DESCRIPTION |
---|---|
DataIdentifierNotFound
|
If the DID is not found. |
UnsupportedOperation
|
If recursive inserts are requested (currently unsupported). |
RucioException
|
If an error occurs while setting the metadata. |
delete_metadata ¶
delete_metadata(scope, name, key, *, session=None)
Delete a key from metadata.
PARAMETER | DESCRIPTION |
---|---|
scope
|
the scope of did
TYPE:
|
name
|
the name of the did
TYPE:
|
key
|
the key to be deleted
TYPE:
|
RAISES | DESCRIPTION |
---|---|
DataIdentifierNotFound
|
If the DID is not found. |
RucioException
|
If an error occurs while setting the metadata. |
list_dids ¶
list_dids(
scope,
filters,
did_type="collection",
ignore_case=False,
limit=None,
offset=None,
long=False,
recursive=False,
ignore_dids=None,
*,
session=None
)
List DIDs (Data Identifier).
PARAMETER | DESCRIPTION |
---|---|
scope
|
The scope of the DIDs to search.
TYPE:
|
filters
|
The filters to apply to the DID search.
TYPE:
|
did_type
|
The type of DID (default is 'collection').
TYPE:
|
ignore_case
|
Whether to ignore case (default is False).
TYPE:
|
limit
|
The maximum number of DIDs to return.
TYPE:
|
offset
|
The starting point for the search (used for pagination).
TYPE:
|
long
|
Whether to return extended information (scope, name, did_type, bytes, length) (default is False).
TYPE:
|
recursive
|
Whether to search recursively (currently unsupported).
TYPE:
|
ignore_dids
|
A list of DIDs to ignore (default is an empty list).
TYPE:
|
session
|
The database session in use.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Iterator[dict[str, Any]]
|
A generator yielding DIDs as strings (when |
RAISES | DESCRIPTION |
---|---|
UnsupportedOperation
|
If recursive searches are requested (currently unsupported). |
RucioException
|
If an error occurs during the search. |
on_delete ¶
on_delete(scope, name, archive=False, session=None)
Delete a document and optionally archive it.
PARAMETER | DESCRIPTION |
---|---|
scope
|
The scope of the document
TYPE:
|
name
|
The name of the document
TYPE:
|
archive
|
Whether to archive the document before deletion
TYPE:
|
RAISES | DESCRIPTION |
---|---|
DataIdentifierNotFound
|
If the DID is not found. |
RucioException
|
If an error occurs while setting the metadata. |
get_metadata_archived ¶
get_metadata_archived(scope, name, session=None)
Retrieve archived metadata for a given scope and name.
PARAMETER | DESCRIPTION |
---|---|
scope
|
The scope of the document
TYPE:
|
name
|
The name of the document
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
None
|
The archived metadata or None if not found |
RAISES | DESCRIPTION |
---|---|
DataIdentifierNotFound
|
If the DID is not found. |
RucioException
|
If an error occurs while setting the metadata. |
get_plugin_name ¶
get_plugin_name()
Returns a unique identifier for this plugin. This can be later used for filtering down results to this plugin only.
RETURNS | DESCRIPTION |
---|---|
str
|
The name of the plugin |