Storage
The storage module provides a way to store and retrieve data from the backend database. We have abstracted it to provide a common interface to interact with the database. This allows us to switch between different databases without changing the code that interacts with the database.
Abstract Storage
redbox.storage.storage_handler.BaseStorageHandler
BaseStorageHandler()
Bases: ABC
Abstract Class for Storage Handler which manages all file and object IO the Redbox backend.
Initialise the storage handler
Source code in redbox-core/redbox/storage/storage_handler.py
20 21 22 |
|
model_type_map class-attribute
instance-attribute
get_model_by_model_type
get_model_by_model_type(model_type)
PARAMETER | DESCRIPTION |
---|---|
model_type |
|
Source code in redbox-core/redbox/storage/storage_handler.py
17 18 |
|
write_item abstractmethod
write_item(item)
Write an object to a data store
PARAMETER | DESCRIPTION |
---|---|
item | TYPE: |
Source code in redbox-core/redbox/storage/storage_handler.py
24 25 26 |
|
write_items abstractmethod
write_items(items)
Write a list of objects to a data store
PARAMETER | DESCRIPTION |
---|---|
items | TYPE: |
Source code in redbox-core/redbox/storage/storage_handler.py
28 29 30 |
|
read_item abstractmethod
read_item(item_uuid, model_type)
Read an object from a data store
PARAMETER | DESCRIPTION |
---|---|
item_uuid | TYPE: |
model_type | TYPE: |
Source code in redbox-core/redbox/storage/storage_handler.py
32 33 34 |
|
read_items abstractmethod
read_items(item_uuids, model_type)
Read a list of objects from a data store
PARAMETER | DESCRIPTION |
---|---|
item_uuids | TYPE: |
model_type | TYPE: |
Source code in redbox-core/redbox/storage/storage_handler.py
36 37 38 |
|
update_item abstractmethod
update_item(item)
Update an object in a data store
PARAMETER | DESCRIPTION |
---|---|
item | TYPE: |
Source code in redbox-core/redbox/storage/storage_handler.py
40 41 42 |
|
update_items abstractmethod
update_items(items)
Update a list of objects in a data store
PARAMETER | DESCRIPTION |
---|---|
items | TYPE: |
Source code in redbox-core/redbox/storage/storage_handler.py
44 45 46 |
|
delete_item abstractmethod
delete_item(item)
Delete an object from a data store
PARAMETER | DESCRIPTION |
---|---|
item | TYPE: |
Source code in redbox-core/redbox/storage/storage_handler.py
48 49 50 |
|
delete_items abstractmethod
delete_items(items)
Delete a list of objects from a data store
PARAMETER | DESCRIPTION |
---|---|
items | TYPE: |
Source code in redbox-core/redbox/storage/storage_handler.py
52 53 54 |
|
list_all_items abstractmethod
list_all_items(model_type, user_uuid)
List all objects of a given type from a data store
PARAMETER | DESCRIPTION |
---|---|
model_type | TYPE: |
user_uuid | TYPE: |
Source code in redbox-core/redbox/storage/storage_handler.py
56 57 58 |
|
read_all_items abstractmethod
read_all_items(model_type, user_uuid)
Read all objects of a given type from a data store
PARAMETER | DESCRIPTION |
---|---|
model_type | TYPE: |
user_uuid | TYPE: |
Source code in redbox-core/redbox/storage/storage_handler.py
60 61 62 |
|
get_file_chunks abstractmethod
get_file_chunks(parent_file_uuid, user_uuid)
get chunks for a given file
PARAMETER | DESCRIPTION |
---|---|
parent_file_uuid | TYPE: |
user_uuid | TYPE: |
Source code in redbox-core/redbox/storage/storage_handler.py
64 65 66 |
|