glance_store.backend 模块

class glance_store.backend.Indexable(wrapped, size)

基类: object

用于类文件对象迭代器的 Indexable

包装器,允许将迭代器或类文件对象视为可索引的数据结构。当从 Store.get() 的返回值传递到 Store.add() 时,在将 Copy-From 镜像添加到依赖于 eventlet GreenSockets 的存储时,需要这样做,在这种情况下,要写入的数据会进行索引。

another()

由子类实现以返回下一个元素。

getvalue()

返回整个字符串值… 用于测试

glance_store.backend.add_to_backend(conf, image_id, data, size, scheme=None, context=None, verifier=None)
glance_store.backend.add_to_backend_with_multihash(conf, image_id, data, size, hashing_algo, scheme=None, context=None, verifier=None)
glance_store.backend.check_location_metadata(val, key='')
glance_store.backend.create_stores(conf=<oslo_config.cfg.ConfigOpts object>)

注册所有存储模块和来自给定配置的所有方案。不会重新注册重复项。

glance_store.backend.delete_from_backend(uri, context=None)

从由 uri 指定的后端删除数据块。

glance_store.backend.get_from_backend(uri, offset=0, chunk_size=None, context=None)

从由 uri 指定的后端生成数据块。

glance_store.backend.get_known_schemes()

返回已知方案的列表。

glance_store.backend.get_size_from_backend(uri, context=None)

检索由 uri 指定的后端中的镜像大小。

glance_store.backend.get_store_from_location(uri)

给定一个位置(假定为 URL),尝试从位置确定存储。我们在这里使用一个简单的猜测,即解析的 URL 的方案是存储…

参数:

uri – 检查存储的位置

glance_store.backend.get_store_from_scheme(scheme)

给定一个方案,返回适当的存储对象来处理该方案。

glance_store.backend.get_store_from_uri(uri)

给定一个 URI,返回将处理该 URI 上操作的存储对象。

参数:

uri – 要分析的 URI

glance_store.backend.register_opts(conf)
glance_store.backend.set_acls(location_uri, public=False, read_tenants=[], write_tenants=None, context=None)
glance_store.backend.store_add_to_backend(image_id, data, size, store, context=None, verifier=None)

对每个存储的 add() 方法的调用包装器。这为 glance 提供了一个通用的位置来检查输出

参数:
  • image_id – 要添加数据的镜像

  • data – 要存储的数据

  • size – 数据的大小(以字节为单位)

  • store – 要添加数据的存储

  • context – 请求上下文

  • verifier – 用于验证镜像签名的对象

返回值:

文件的 url 位置、数据量、数据的校验和、存储系统的元数据字典

glance_store.backend.store_add_to_backend_with_multihash(image_id, data, size, hashing_algo, store, context=None, verifier=None)

对每个存储的 add() 方法的调用包装器,该方法需要一个 hashing_algo 标识符,并返回一个 5 元组,包括使用指定的 hashing_algo 计算的“multihash”。(这是 store_add_to_backend() 的增强版本,为了向后兼容而保持不变。)

参数:
  • image_id – 要添加数据的镜像

  • data – 要存储的数据

  • size – 数据的大小(以字节为单位)

  • store – 要添加数据的存储

  • hashing_algo – hashlib 算法标识符(字符串)

  • context – 请求上下文

  • verifier – 用于验证镜像签名的对象

返回值:

文件的 url 位置、数据量、数据的校验和、数据的 multihash、存储系统的元数据字典

引发:

glance_store.exceptions.BackendException glance_store.exceptions.UnknownHashingAlgo

glance_store.backend.verify_default_store()