, 'hits': INTEGER,
'last_modified': ISO_TIMESTAMP,
'last_accessed': ISO_TIMESTAMP,
'size': INTEGER
}, ...
]
"""
return NotImplementedError
**** CubicPower OpenStack Study ****
def is_cached(self, image_id):
"""
Returns True if the image with the supplied ID has its image
file cached.
:param image_id: Image ID
"""
raise NotImplementedError
**** CubicPower OpenStack Study ****
def is_cacheable(self, image_id):
"""
Returns True if the image with the supplied ID can have its
image file cached, False otherwise.
:param image_id: Image ID
"""
raise NotImplementedError
**** CubicPower OpenStack Study ****
def is_queued(self, image_id):
"""
Returns True if the image identifier is in our cache queue.
:param image_id: Image ID
"""
raise NotImplementedError
**** CubicPower OpenStack Study ****
def delete_all_cached_images(self):
"""
Removes all cached image files and any attributes about the images
and returns the number of cached image files that were deleted.
"""
raise NotImplementedError
**** CubicPower OpenStack Study ****
def delete_cached_image(self, image_id):
"""
Removes a specific cached image file and any attributes about the image
:param image_id: Image ID
"""
raise NotImplementedError
**** CubicPower OpenStack Study ****
def delete_all_queued_images(self):
"""
Removes all queued image files and any attributes about the images
and returns the number of queued image files that were deleted.
"""
raise NotImplementedError
**** CubicPower OpenStack Study ****
def delete_queued_image(self, image_id):
"""
Removes a specific queued image file and any attributes about the image
:param image_id: Image ID
"""
raise NotImplementedError
**** CubicPower OpenStack Study ****
def queue_image(self, image_id):
"""
Puts an image identifier in a queue for caching. Return True
on successful add to the queue, False otherwise...
:param image_id: Image ID
"""
**** CubicPower OpenStack Study ****
def clean(self, stall_time=None):
"""
Dependent on the driver, clean up and destroy any invalid or incomplete
cached images
"""
raise NotImplementedError
**** CubicPower OpenStack Study ****
def get_least_recently_accessed(self):
"""
Return a tuple containing the image_id and size of the least recently
accessed cached file, or None if no cached files.
"""
raise NotImplementedError
**** CubicPower OpenStack Study ****
def open_for_write(self, image_id):
"""
Open a file for writing the image file for an image
with supplied identifier.
:param image_id: Image ID
"""
raise NotImplementedError
**** CubicPower OpenStack Study ****
def open_for_read(self, image_id):
"""
Open and yield file for reading the image file for an image
with supplied identifier.
:param image_id: Image ID
"""
raise NotImplementedError
**** CubicPower OpenStack Study ****
def get_image_filepath(self, image_id, cache_status='active'):
"""
This crafts an absolute path to a specific entry
:param image_id: Image ID
:param cache_status: Status of the image in the cache
"""
if cache_status == 'active':
return os.path.join(self.base_dir, str(image_id))
return os.path.join(self.base_dir, cache_status, str(image_id))
**** CubicPower OpenStack Study ****
def get_image_size(self, image_id):
"""
Return the size of the image file for an image with supplied
identifier.
:param image_id: Image ID
"""
path = self.get_image_filepath(image_id)
return os.path.getsize(path)
**** CubicPower OpenStack Study ****
def get_queued_images(self):
"""
Returns a list of image IDs that are in the queue. The
list should be sorted by the time the image ID was inserted
into the queue.
"""
raise NotImplementedError