Oren,
After playing with the BDB port of the storage engine for a while now, I've begun to thing that some of the things that the storage engine is responsible for is duplicated in all storage engines. For example: EnsureDocumentEtagMatchInTransaction or EnsureNotLockedByTransaction. If the logic of these ever changes then changes to all storage engines have to be made. It seems like this logic should be pulled out of the storage engine and the storage engine should simply be responsible for getting the data. I was thinking something along the lines of:
interface IDocumentReader {
Document FindDocument(string key);
void AddDocument(Document a);
void DeleteDocument(string key);
}
class Document {
public int MetadataSize { get }
public int DocumentSize { get }
public Guid Etag { get }
public Guid LockedByTransaction { get }
public string Key { get }
public DateTime LastModifiedTime { get }
public RavenJObject Metadata { get }
public Stream DocumentStream { get }
}
Again this is just an example and we would have to look a little closer at the operations. Even a simple IDocumentStorageActions.AddDocument has tons of logic associated with verifying etags, checking for active transactions, this is complicated stuff and seems like it should be outside the storage engine.
mike