Context framework¶
Configuration options for TensorStore drivers are specified using a context framework, which allows resources such as cache pools, concurrent execution pools, and authentication credentials to be specified using JSON in a way that allows sharing of resources by multiple TensorStore drivers.
- json Context : object¶
A context JSON object is a mapping of resource identifiers to
ContextResource
specifications.- Optional members:¶
- <resource-type> : ContextResource¶
Overrides the default resource for the given
<resource-type>
, which must be a supported resource type.
- <resource-type>#<id> : ContextResource¶
Defines a resource with identifier
<id>
of the given<resource-type>
. The resource specification must be compatible with<resource-type>
.
Example
{ "cache_pool": {"total_bytes_limit": 10000000}, "cache_pool#remote": {"total_bytes_limit": 100000000}, "data_copy_concurrency": {"limit": 8} }
-
json ContextResource : object | boolean | number | string |
null
¶ Specifies a context resource of a particular
<resource-type>
.- One of:¶
- object | boolean | number
Specifies the resource directly. Any constraints on the value are determined by the particular
<resource-type>
.
- string
References another resource of the same type in the current or parent context using the syntax
"<resource-type>"
or"<resource-type>#<id>"
, where<resource-type>
matches the type of this resource.
-
null
Specifies a new instance of the default resource of the given
<resource-type>
. Only valid within aContext
specification.
- json Context.cache_pool : object¶
Specifies the size of an in-memory Least Recently Used (LRU) cache. Each
cache_pool
resource specifies a separate memory pool.
- json Context.data_copy_concurrency : object¶
Specifies a limit on the number of CPU cores used concurrently for data copying/encoding/decoding.