using System; using System.Collections.Generic; using ln.objects.catalog; namespace ln.types.odb.ng.storage { public interface IStorage : IDisposable { bool Open(); void Close(); bool IsOpen { get; } /// /// Load the specified documentID. /// /// The loaded Document. /// Document identifier. /// /// Non caching storage will return the latest version of the document with each call. /// Caching storage will return the same Document instance with each call, as long as the document stayed in the cache. /// No refreshing is done if a cached instance is returned! /// Document Load(Guid documentID); /// /// Refresh the specified document. /// /// if the document was refreshed successfully /// Document to be refreshed. Must have been loaded by a call to Load(..) of the same IStorage instance /// will reload the document from storage and apply the loaded state to this instance. /// If references an instance that has not been returned by a call to Load(..) (e.g. by using Clone()), internal caches may not be affected by the refresh. /// bool Refresh(Document document); /// /// Save the specified document. /// /// Document to store /// Non caching storage will store the Document with its full state. /// Caching storage, e.g. SessionStorage, may only store changes to storage. Please refer to class specific documentation. /// void Save(Document document); /// /// Delete the specified documentID from storage. /// /// Document identifier /// Will remove the Document identified by documentID from storage. /// void Delete(Guid documentID); IDisposable Lock(); bool Contains(Guid documentID); IEnumerable GetDocumentIDs(); IEnumerable GetDocumentIDs(string path,Predicate predicate); DateTime GetStorageTimestamp(Guid documentID); void EnsureIndex(params string[] path); bool IsCaching { get; } } }