File indexing completed on 2026-04-09 07:58:19
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 """
0013 operations related to Requests.
0014 """
0015
0016 from idds.core import contents
0017
0018
0019 def add_content(coll_id, scope, name, min_id, max_id, content_type=None, status=None,
0020 bytes=0, md5=None, adler32=None, processing_id=None, storage_id=None, retries=0,
0021 path=None, expired_at=None, collcontent_metadata=None):
0022 """
0023 Add a content.
0024
0025 :param coll_id: collection id.
0026 :param scope: The scope of the request data.
0027 :param name: The name of the request data.
0028 :param min_id: The minimal id of the content.
0029 :param max_id: The maximal id of the content.
0030 :param content_type: The type of the content.
0031 :param status: content status.
0032 :param bytes: The size of the content.
0033 :param md5: md5 checksum.
0034 :param alder32: adler32 checksum.
0035 :param processing_id: The processing id.
0036 :param storage_id: The storage id.
0037 :param retries: The number of retries.
0038 :param path: The content path.
0039 :param expired_at: The datetime when it expires.
0040 :param content_metadata: The metadata as json.
0041
0042 :returns: content id.
0043 """
0044 kwargs = {'coll_id': coll_id, 'scope': scope, 'name': name, 'min_id': min_id, 'max_id': max_id,
0045 'content_type': content_type, 'status': status, 'bytes': bytes,
0046 'md5': md5, 'adler32': adler32, 'processing_id': processing_id, 'storage_id': storage_id,
0047 'retries': retries, 'path': path, 'expired_at': expired_at,
0048 'collcontent_metadata': collcontent_metadata}
0049 return contents.add_content(kwargs)
0050
0051
0052 def get_content(content_id=None, coll_id=None, scope=None, name=None, content_type=None, min_id=None, max_id=None):
0053 """
0054 Get content or raise a NoObject exception.
0055
0056 :param content_id: Content id.
0057 :param coll_id: Collection id.
0058 :param scope: The scope of the request data.
0059 :param name: The name of the request data.
0060 :param min_id: The minimal id of the content.
0061 :param max_id: The maximal id of the content.
0062 :param content_type: The type of the content.
0063
0064 :returns: Content.
0065 """
0066 return contents.get_content(content_id=content_id, coll_id=coll_id, scope=scope, name=name,
0067 content_type=content_type, min_id=min_id, max_id=max_id)
0068
0069
0070 def update_content(content_id, parameters):
0071 """
0072 update a content.
0073
0074 :param content_id: the content id.
0075 :param parameters: A dictionary of parameters.
0076
0077 """
0078 return contents.update_content(content_id, parameters)
0079
0080
0081 def delete_content(content_id=None):
0082 """
0083 delete a content.
0084
0085 :param content_id: The id of the content.
0086
0087 """
0088 return contents.delete_content(content_id)