// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once #include "storeonlyfeedview.h" #include #include namespace proton { /** * The feed view used by the fast-access sub database. * * Handles inserting/updating/removing of documents to the underlying * fast-access attributes and document store. */ class FastAccessFeedView : public StoreOnlyFeedView { public: using SP = std::shared_ptr; using UP = std::unique_ptr; struct Context { const IAttributeWriter::SP _attrWriter; DocIdLimit &_docIdLimit; Context(IAttributeWriter::SP attrWriter, DocIdLimit &docIdLimit) : _attrWriter(std::move(attrWriter)), _docIdLimit(docIdLimit) { } }; private: using Parent = StoreOnlyFeedView; const IAttributeWriter::SP _attributeWriter; DocIdLimit &_docIdLimit; void putAttributes(SerialNum serialNum, search::DocumentIdT lid, const Document &doc, OnPutDoneType onWriteDone) override; void updateAttributes(SerialNum serialNum, search::DocumentIdT lid, const document::DocumentUpdate &upd, OnOperationDoneType onWriteDone, IFieldUpdateCallback & onUpdate) override; void updateAttributes(SerialNum serialNum, Lid lid, FutureDoc doc, OnOperationDoneType onWriteDone) override; void removeAttributes(SerialNum serialNum, search::DocumentIdT lid, OnRemoveDoneType onWriteDone) override; void removeAttributes(SerialNum serialNum, const LidVector &lidsToRemove, OnWriteDoneType onWriteDone) override; void heartBeatAttributes(SerialNum serialNum, DoneCallback onDone) override; protected: void internalForceCommit(const CommitParam & param, OnForceCommitDoneType onCommitDone) override; public: FastAccessFeedView(StoreOnlyFeedView::Context storeOnlyCtx, const PersistentParams ¶ms, const Context &ctx); ~FastAccessFeedView() override; virtual const IAttributeWriter::SP &getAttributeWriter() const { return _attributeWriter; } virtual DocIdLimit &getDocIdLimit() const { return _docIdLimit; } void handleCompactLidSpace(const CompactLidSpaceOperation &op, DoneCallback onDone) override; }; } // namespace proton