/*
* QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
* Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using QuantConnect.Packets;
using System.Collections.Generic;
using System.ComponentModel.Composition;
namespace QuantConnect.Interfaces
{
///
/// Provides object storage for data persistence.
///
[InheritedExport(typeof(IObjectStore))]
public interface IObjectStore : IDisposable, IEnumerable>
{
///
/// Event raised each time there's an error
///
event EventHandler ErrorRaised;
///
/// Initializes the object store
///
/// The user id
/// The project id
/// The user token
/// The job controls instance
void Initialize(int userId, int projectId, string userToken, Controls controls);
///
/// Determines whether the store contains data for the specified path
///
/// The object path
/// True if the key was found
bool ContainsKey(string path);
///
/// Returns the object data for the specified key
///
/// The object key
/// A byte array containing the data
byte[] ReadBytes(string path);
///
/// Saves the object data for the specified path
///
/// The object path
/// The object data
/// True if the save operation was successful
bool SaveBytes(string path, byte[] contents);
///
/// Deletes the object data for the specified path
///
/// The object path
/// True if the delete operation was successful
bool Delete(string path);
///
/// Returns the file path for the specified path
///
/// The object path
/// The path for the file
string GetFilePath(string path);
///
/// Returns the file paths present in the object store. This is specially useful not to load the object store into memory
///
ICollection Keys { get; }
///
/// Will clear the object store state cache. This is useful when the object store is used concurrently by nodes which want to share information
///
void Clear();
}
}