http
Implementation of HTTP catalog store group.
NOTE: indicating the remote catalog that an entry should be sent to/read from is not properly supported through the store's interface, as it only applies to HTTP catalogs and not to local ones. To add a kinda hacky way to support this, the following assumptions are made of the values received by the CRUD methods:
- Read/Delete: since we only receive an Entry id when indicating what to read/delete, the remote catalog id this should be read from will come bundled with the entry id, with a prefix, like this "remote_catalog_id--entry_id". The "remote_catalog.py" module is used to extract this, and could be used to bundle it as well.
- Create/Edit: besides the same bundling as above, in the entry_id field of the new entry's header, the catalog_id in the new entry's header will have the actual remote catalog id, and this is the value used.
HTTPCatalogGroupEntryMapper
Bases: CatalogEntryMapper
HTTP mapper for the catalog group entry resource.
Source code in mlte/store/catalog/underlying/http.py
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 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 | |
storage = storage
instance-attribute
The HTTP storage access.
create(new_entry, context=None)
This method assumes that the caller put in catalog_id the id of the remote catalog it would be stored into.
Source code in mlte/store/catalog/underlying/http.py
106 107 108 109 110 111 112 113 114 115 | |
delete(catalog_and_entry_id, context=None)
This method assumes that the caller prefixed the entry_id with the local catalog id.
Source code in mlte/store/catalog/underlying/http.py
142 143 144 145 146 147 148 149 150 151 152 | |
edit(edited_entry, context=None)
This method assumes that the caller put in catalog_id the id of the remote catalog it would be stored into.
Source code in mlte/store/catalog/underlying/http.py
117 118 119 120 121 122 123 124 125 126 | |
read(catalog_and_entry_id, context=None)
This method assumes that the caller prefixed the entry_id with the local catalog id.
Source code in mlte/store/catalog/underlying/http.py
128 129 130 131 132 133 134 135 136 | |
HttpCatalogGroupStore
Bases: CatalogStore
A HTTP implementation of the MLTE catalog store group. Note that it is slightly different than the other implementations, in mapping to a store group through a backend, instead of a simple catalog store.
Source code in mlte/store/catalog/underlying/http.py
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 | |
storage = HttpResourceStorage(uri=uri, resource_type=(ResourceType.CATALOG), client=client)
instance-attribute
HTTP storage.
session()
Return a session handle for the store instance.
Returns:
| Type | Description |
|---|---|
CatalogStoreSession
|
The session handle |
Source code in mlte/store/catalog/underlying/http.py
57 58 59 60 61 62 63 64 | |
HttpCatalogGroupStoreSession
Bases: CatalogStoreSession
An HTTP implementation of the MLTE catalog store session.
Source code in mlte/store/catalog/underlying/http.py
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | |
entry_mapper = HTTPCatalogGroupEntryMapper(storage=(self.storage))
instance-attribute
The mapper to entries CRUD.
read_only = read_only
instance-attribute
Whether this is read only or not.
storage = storage
instance-attribute
HTTP storage