Skip to content

IObjectStore

QuantConnect.Interfaces.IObjectStore

Bases: IDisposable, Iterable[KeyValuePair[str, List[int]]]

Provides object storage for data persistence.

max_size

max_size: int

Gets the maximum storage limit in bytes

max_files

max_files: int

Gets the maximum number of files allowed

error_raised

error_raised: _EventContainer[
    Callable[
        [Object, ObjectStoreErrorRaisedEventArgs], Any
    ],
    Any,
]

Event raised each time there's an error

keys

keys: ICollection[str]

Returns the file paths present in the object store. This is specially useful not to load the object store into memory

clear

clear() -> None

Will clear the object store state cache. This is useful when the object store is used concurrently by nodes which want to share information

contains_key

contains_key(path: str) -> bool

Determines whether the store contains data for the specified path

Parameters:

Name Type Description Default
path str

The object path

required

Returns:

Type Description
bool

True if the key was found.

delete

delete(path: str) -> bool

Deletes the object data for the specified path

Parameters:

Name Type Description Default
path str

The object path

required

Returns:

Type Description
bool

True if the delete operation was successful.

get_file_path

get_file_path(path: str) -> str

Returns the file path for the specified path

Parameters:

Name Type Description Default
path str

The object path

required

Returns:

Type Description
str

The path for the file.

initialize

initialize(
    user_id: int,
    project_id: int,
    user_token: str,
    controls: Controls,
    algorithm_mode: AlgorithmMode,
) -> None

Initializes the object store

Parameters:

Name Type Description Default
user_id int

The user id

required
project_id int

The project id

required
user_token str

The user token

required
controls Controls

The job controls instance

required
algorithm_mode AlgorithmMode

The algorithm mode

required

read_bytes

read_bytes(path: str) -> List[int]

Returns the object data for the specified key

Parameters:

Name Type Description Default
path str

The object key

required

Returns:

Type Description
List[int]

A byte array containing the data.

save_bytes

save_bytes(path: str, contents: List[int]) -> bool

Saves the object data for the specified path

Parameters:

Name Type Description Default
path str

The object path

required
contents List[int]

The object data

required

Returns:

Type Description
bool

True if the save operation was successful.