Lean  $LEAN_TAG$
QuantConnect.Storage.ObjectStore Class Reference

Helper class for easier access to IObjectStore methods More...

Inheritance diagram for QuantConnect.Storage.ObjectStore:
[legend]

Public Member Functions

 ObjectStore (IObjectStore store)
 Initializes a new instance of the ObjectStore class More...
 
void Initialize (int userId, int projectId, string userToken, Controls controls)
 Initializes the object store More...
 
void Clear ()
 Will clear the object store state cache. This is useful when the object store is used concurrently by nodes which want to share information More...
 
bool ContainsKey (string path)
 Determines whether the store contains data for the specified path More...
 
byte[] ReadBytes (string path)
 Returns the object data for the specified path More...
 
bool SaveBytes (string path, byte[] contents)
 Saves the object data for the specified path More...
 
bool Delete (string path)
 Deletes the object data for the specified path More...
 
string GetFilePath (string path)
 Returns the file path for the specified path More...
 
string Read (string path, Encoding encoding=null)
 Returns the string object data for the specified path More...
 
string ReadString (string path, Encoding encoding=null)
 Returns the string object data for the specified path More...
 
ReadJson< T > (string path, Encoding encoding=null, JsonSerializerSettings settings=null)
 Returns the JSON deserialized object data for the specified path More...
 
ReadXml< T > (string path, Encoding encoding=null)
 Returns the XML deserialized object data for the specified path More...
 
bool Save (string path)
 Saves the data from a local file path associated with the specified path More...
 
bool Save (string path, string text, Encoding encoding=null)
 Saves the object data in text format for the specified path More...
 
bool SaveString (string path, string text, Encoding encoding=null)
 Saves the object data in text format for the specified path More...
 
bool SaveJson< T > (string path, T obj, Encoding encoding=null, JsonSerializerSettings settings=null)
 Saves the object data in JSON format for the specified path More...
 
bool SaveXml< T > (string path, T obj, Encoding encoding=null)
 Saves the object data in XML format for the specified path More...
 
IEnumerator< KeyValuePair< string, byte[]> > GetEnumerator ()
 Returns an enumerator that iterates through the collection. More...
 
void Dispose ()
 Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. More...
 

Public Attributes

ICollection< string > Keys => _store.Keys
 Returns the file paths present in the object store. This is specially useful not to load the object store into memory More...
 

Properties

EventHandler< ObjectStoreErrorRaisedEventArgsErrorRaised
 Event raised each time there's an error More...
 
- Properties inherited from QuantConnect.Interfaces.IObjectStore
ICollection< string > Keys [get]
 Returns the file paths present in the object store. This is specially useful not to load the object store into memory More...
 

Additional Inherited Members

- Events inherited from QuantConnect.Interfaces.IObjectStore
EventHandler< ObjectStoreErrorRaisedEventArgsErrorRaised
 Event raised each time there's an error More...
 

Detailed Description

Helper class for easier access to IObjectStore methods

Definition at line 31 of file ObjectStore.cs.

Constructor & Destructor Documentation

◆ ObjectStore()

QuantConnect.Storage.ObjectStore.ObjectStore ( IObjectStore  store)

Initializes a new instance of the ObjectStore class

Parameters
storeThe IObjectStore instance to wrap

Definition at line 48 of file ObjectStore.cs.

Member Function Documentation

◆ Initialize()

void QuantConnect.Storage.ObjectStore.Initialize ( int  userId,
int  projectId,
string  userToken,
Controls  controls 
)

Initializes the object store

Parameters
userIdThe user id
projectIdThe project id
userTokenThe user token
controlsThe job controls instance

Implements QuantConnect.Interfaces.IObjectStore.

Definition at line 60 of file ObjectStore.cs.

◆ Clear()

void QuantConnect.Storage.ObjectStore.Clear ( )

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

Implements QuantConnect.Interfaces.IObjectStore.

◆ ContainsKey()

bool QuantConnect.Storage.ObjectStore.ContainsKey ( string  path)

Determines whether the store contains data for the specified path

Parameters
pathThe object path
Returns
True if the key was found

Implements QuantConnect.Interfaces.IObjectStore.

Definition at line 80 of file ObjectStore.cs.

◆ ReadBytes()

byte [] QuantConnect.Storage.ObjectStore.ReadBytes ( string  path)

Returns the object data for the specified path

Parameters
pathThe object path
Returns
A byte array containing the data

Implements QuantConnect.Interfaces.IObjectStore.

Definition at line 90 of file ObjectStore.cs.

◆ SaveBytes()

bool QuantConnect.Storage.ObjectStore.SaveBytes ( string  path,
byte[]  contents 
)

Saves the object data for the specified path

Parameters
pathThe object path
contentsThe object data
Returns
True if the save operation was successful

Implements QuantConnect.Interfaces.IObjectStore.

Definition at line 101 of file ObjectStore.cs.

◆ Delete()

bool QuantConnect.Storage.ObjectStore.Delete ( string  path)

Deletes the object data for the specified path

Parameters
pathThe object path
Returns
True if the delete operation was successful

Implements QuantConnect.Interfaces.IObjectStore.

Definition at line 111 of file ObjectStore.cs.

◆ GetFilePath()

string QuantConnect.Storage.ObjectStore.GetFilePath ( string  path)

Returns the file path for the specified path

Parameters
pathThe object path
Returns
The path for the file

Implements QuantConnect.Interfaces.IObjectStore.

Definition at line 121 of file ObjectStore.cs.

Here is the caller graph for this function:

◆ Read()

string QuantConnect.Storage.ObjectStore.Read ( string  path,
Encoding  encoding = null 
)

Returns the string object data for the specified path

Parameters
pathThe object path
encodingThe string encoding used
Returns
A string containing the data

Definition at line 132 of file ObjectStore.cs.

Here is the caller graph for this function:

◆ ReadString()

string QuantConnect.Storage.ObjectStore.ReadString ( string  path,
Encoding  encoding = null 
)

Returns the string object data for the specified path

Parameters
pathThe object path
encodingThe string encoding used
Returns
A string containing the data

Definition at line 146 of file ObjectStore.cs.

Here is the call graph for this function:

◆ ReadJson< T >()

T QuantConnect.Storage.ObjectStore.ReadJson< T > ( string  path,
Encoding  encoding = null,
JsonSerializerSettings  settings = null 
)

Returns the JSON deserialized object data for the specified path

Parameters
pathThe object path
encodingThe string encoding used
settingsThe settings used by the JSON deserializer
Returns
An object containing the data

Definition at line 158 of file ObjectStore.cs.

Here is the call graph for this function:

◆ ReadXml< T >()

T QuantConnect.Storage.ObjectStore.ReadXml< T > ( string  path,
Encoding  encoding = null 
)

Returns the XML deserialized object data for the specified path

Parameters
pathThe object path
encodingThe string encoding used
Returns
An object containing the data

Definition at line 172 of file ObjectStore.cs.

Here is the call graph for this function:

◆ Save() [1/2]

bool QuantConnect.Storage.ObjectStore.Save ( string  path)

Saves the data from a local file path associated with the specified path

If the file does not exist it will throw an exception

Parameters
pathThe object path
Returns
True if the object was saved successfully

Definition at line 191 of file ObjectStore.cs.

Here is the call graph for this function:

◆ Save() [2/2]

bool QuantConnect.Storage.ObjectStore.Save ( string  path,
string  text,
Encoding  encoding = null 
)

Saves the object data in text format for the specified path

Parameters
pathThe object path
textThe string object to be saved
encodingThe string encoding used, Encoding.UTF8 by default
Returns
True if the object was saved successfully

Definition at line 211 of file ObjectStore.cs.

◆ SaveString()

bool QuantConnect.Storage.ObjectStore.SaveString ( string  path,
string  text,
Encoding  encoding = null 
)

Saves the object data in text format for the specified path

Parameters
pathThe object path
textThe string object to be saved
encodingThe string encoding used
Returns
True if the object was saved successfully

Definition at line 224 of file ObjectStore.cs.

Here is the caller graph for this function:

◆ SaveJson< T >()

bool QuantConnect.Storage.ObjectStore.SaveJson< T > ( string  path,
obj,
Encoding  encoding = null,
JsonSerializerSettings  settings = null 
)

Saves the object data in JSON format for the specified path

Parameters
pathThe object path
objThe object to be saved
encodingThe string encoding used
settingsThe settings used by the JSON serializer
Returns
True if the object was saved successfully

Definition at line 239 of file ObjectStore.cs.

Here is the call graph for this function:

◆ SaveXml< T >()

bool QuantConnect.Storage.ObjectStore.SaveXml< T > ( string  path,
obj,
Encoding  encoding = null 
)

Saves the object data in XML format for the specified path

Parameters
pathThe object path
objThe object to be saved
encodingThe string encoding used
Returns
True if the object was saved successfully

Definition at line 254 of file ObjectStore.cs.

Here is the call graph for this function:

◆ GetEnumerator()

IEnumerator<KeyValuePair<string, byte[]> > QuantConnect.Storage.ObjectStore.GetEnumerator ( )

Returns an enumerator that iterates through the collection.

Returns
A T:System.Collections.Generic.IEnumerator`1 that can be used to iterate through the collection.

<filterpriority>1</filterpriority>

Definition at line 271 of file ObjectStore.cs.

◆ Dispose()

void QuantConnect.Storage.ObjectStore.Dispose ( )

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

<filterpriority>2</filterpriority>

Definition at line 286 of file ObjectStore.cs.

Member Data Documentation

◆ Keys

ICollection<string> QuantConnect.Storage.ObjectStore.Keys => _store.Keys

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

Definition at line 68 of file ObjectStore.cs.

Property Documentation

◆ ErrorRaised

EventHandler<ObjectStoreErrorRaisedEventArgs> QuantConnect.Storage.ObjectStore.ErrorRaised
addremove

Event raised each time there's an error

Definition at line 37 of file ObjectStore.cs.


The documentation for this class was generated from the following file: