viat.providers.storage
¶
A convenience module that lists all ViatAttributeStorage providers.
JsonAttributeReader
¶
Bases: ViatAttributeReader, Mapping[str, JsonT]
A storage reader for JSON objects.
Parameters:
-
path(Path) –The path to which the table corresponds.
-
json_object(JsonObjectT) –The object to proxy.
Source code in src/viat/providers/storage/_json/reader.py
JsonAttributeStorage
¶
Bases: JsonAttributeStorageMixin, ViatAttributeStorage
The JSON file storage class.
Parameters:
-
config(JsonAttributeStorageConfig) –All configuration required for the storage.
-
resolver(ViatPathResolver | None, default:None) –A path resolver used by connections.
Source code in src/viat/providers/storage/_json/storage.py
JsonAttributeStorageConfig
dataclass
¶
Configuration for the JSON file storage.
Source code in src/viat/providers/storage/_json/config.py
indent = None
class-attribute
instance-attribute
¶
An indent parameter for Python's JSON writer.
json_schema_path = None
class-attribute
instance-attribute
¶
Path to a JSON schema file.
If empty, we assume no schema.
The configuration loader (but not the storage itself) uses the default value schema.json if it exists.
storage_path
instance-attribute
¶
The path to a file for storing attributes.
The configuration loader sets this to the default value storage.json.
JsonAttributeStorageConnection
dataclass
¶
Bases: ViatAttributeStorageConnection
A connection class for the JSON and TOML storages.
Parameters:
-
payload(MutableMapping[str, JsonT]) –The initial state of the storage.
-
resolver(ViatPathResolver | None, default:None) –A path resolver used when creating readers and mutators.
-
validator(Callable[[JsonT], None] | None, default:None) –A validator to be used on the contents of the storage.
Source code in src/viat/providers/storage/_json/connection.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | |
has_mutations = False
instance-attribute
¶
An indicator whether the connection payload has been mutated.
payload = payload
instance-attribute
¶
The payload used to initialize the connection.
resolver = resolver
instance-attribute
¶
The resolver used to initialize the connection.
validator = validator
instance-attribute
¶
The validator used to initialize the connection.
TomlAttributeStorage
¶
Bases: JsonAttributeStorageMixin, ViatAttributeStorage
The TOML file storage class.
Parameters:
-
config(TomlAttributeStorageConfig) –All configuration required for the storage.
-
resolver(ViatPathResolver | None, default:None) –A path resolver used by connections.
Source code in src/viat/providers/storage/_toml/storage.py
TomlAttributeStorageConfig
dataclass
¶
Configuration for the TOML file storage.
Source code in src/viat/providers/storage/_toml/config.py
json_schema_path = None
class-attribute
instance-attribute
¶
Path to a JSON schema file.
We utilize the fact that TOML maps to JSON to enable validation via JSON schemas.
If empty, we assume no schema.
The configuration loader (but not the storage itself) uses the default value schema.json if it exists.
storage_path
instance-attribute
¶
The path to a file for storing attributes.
The configuration loader sets this to the default value storage.toml.