Skip to content

factory

Top-level functions for custom list store creation.

create_custom_list_store(uri)

Create a MLTE custom list store instance.

Parameters:

Name Type Description Default
uri str

The URI for the store instance

required

Returns:

Type Description
CustomListStore

The store instance

Source code in mlte/store/custom_list/factory.py
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
def create_custom_list_store(uri: str) -> CustomListStore:
    """
    Create a MLTE custom list store instance.
    :param uri: The URI for the store instance
    :return: The store instance
    """
    parsed_uri = StoreURI.from_string(uri)

    if parsed_uri.type == StoreType.LOCAL_MEMORY:
        return InMemoryCustomListStore(parsed_uri)
    #   elif parsed_uri.type == StoreType.RELATIONAL_DB:
    # return RelationalDBCustomListStore(parsed_uri)
    elif parsed_uri.type == StoreType.LOCAL_FILESYSTEM:
        return FileSystemCustomListStore(parsed_uri)
    #   elif parsed_uri.type == StoreType.REMOTE_HTTP:
    # return HttpCustomListStore(uri=parsed_uri)
    else:
        raise Exception(
            f"Store can't be created, unknown or unsupported URI prefix received for uri {parsed_uri}"
        )