@@ -642,17 +642,20 @@ class SeqnoAcknowledgement : public DcpResponse {
642642};
643643
644644/* *
645- * Represents the Commit of a prepared SyncWrite, consumer side. Cannot call
646- * getMessageSize
645+ * Represents the Commit of a prepared SyncWrite, producer side. Producer side
646+ * requires the collection mode of the producer to determine how keys are
647+ * encoded.
647648 */
648- class CommitSyncWriteConsumer : public DcpResponse {
649+ class CommitSyncWrite : public DcpResponse {
649650public:
650- CommitSyncWriteConsumer (uint32_t opaque,
651- Vbid vbucket,
652- uint64_t preparedSeqno,
653- uint64_t commitSeqno,
654- const DocKey& key);
651+ CommitSyncWrite (uint32_t opaque,
652+ Vbid vbucket,
653+ uint64_t preparedSeqno,
654+ uint64_t commitSeqno,
655+ const DocKey& key,
656+ DocKeyEncodesCollectionId includeCollectionID);
655657
658+ public:
656659 OptionalSeqno getBySeqno () const override {
657660 return OptionalSeqno{payload.getCommitSeqno ()};
658661 }
@@ -672,48 +675,44 @@ class CommitSyncWriteConsumer : public DcpResponse {
672675 uint64_t getCommitSeqno () const {
673676 return payload.getCommitSeqno ();
674677 }
678+
679+ static constexpr uint32_t commitBaseMsgBytes =
680+ sizeof (protocol_binary_request_header) +
681+ sizeof (cb::mcbp::request::DcpCommitPayload);
675682 uint32_t getMessageSize () const override ;
676683
677- protected :
684+ private :
678685 Vbid vbucket;
679686 StoredDocKey key;
680687 cb::mcbp::request::DcpCommitPayload payload;
688+ DocKeyEncodesCollectionId includeCollectionID;
681689};
682690
683691/* *
684- * Represents the Commit of a prepared SyncWrite, producer side. Provides
685- * getMessageSize
692+ * Represents the Commit of a prepared SyncWrite, consumer side. The key will
693+ * define how getMessageSize calculates the 'ack' size
686694 */
687- class CommitSyncWrite : public CommitSyncWriteConsumer {
688- public:
689- CommitSyncWrite (uint32_t opaque,
690- Vbid vbucket,
691- uint64_t preparedSeqno,
692- uint64_t commitSeqno,
693- const DocKey& key,
694- DocKeyEncodesCollectionId includeCollectionID);
695-
695+ class CommitSyncWriteConsumer : public CommitSyncWrite {
696696public:
697- static constexpr uint32_t commitBaseMsgBytes =
698- sizeof (protocol_binary_request_header) +
699- sizeof (cb::mcbp::request::DcpCommitPayload);
700- uint32_t getMessageSize () const override ;
701-
702- private:
703- DocKeyEncodesCollectionId includeCollectionID;
697+ CommitSyncWriteConsumer (uint32_t opaque,
698+ Vbid vbucket,
699+ uint64_t preparedSeqno,
700+ uint64_t commitSeqno,
701+ const DocKey& key);
704702};
705703
706704/* *
707- * Represents the Abort of a prepared SyncWrite. Consumer side, cannot call
708- * getMessageSize
705+ * Represents the Abort of a prepared SyncWrite. Producer side requires
706+ * the collection mode of the producer to determine how keys are encoded.
709707 */
710- class AbortSyncWriteConsumer : public DcpResponse {
708+ class AbortSyncWrite : public DcpResponse {
711709public:
712- AbortSyncWriteConsumer (uint32_t opaque,
713- Vbid vbucket,
714- const DocKey& key,
715- uint64_t preparedSeqno,
716- uint64_t abortSeqno);
710+ AbortSyncWrite (uint32_t opaque,
711+ Vbid vbucket,
712+ const DocKey& key,
713+ uint64_t preparedSeqno,
714+ uint64_t abortSeqno,
715+ DocKeyEncodesCollectionId includeCollectionID);
717716
718717 Vbid getVbucket () const {
719718 return vbucket;
@@ -741,33 +740,27 @@ class AbortSyncWriteConsumer : public DcpResponse {
741740
742741 uint32_t getMessageSize () const override ;
743742
744- protected :
743+ private :
745744 Vbid vbucket;
746745 StoredDocKey key;
747746 cb::mcbp::request::DcpAbortPayload payload;
747+ DocKeyEncodesCollectionId includeCollectionID;
748748};
749749
750750/* *
751- * Represents the Abort of a prepared SyncWrite. Producer side, can call
752- * getMessageSize
751+ * Represents the Abort of a prepared SyncWrite.
753752 */
754- class AbortSyncWrite : public AbortSyncWriteConsumer {
753+ class AbortSyncWriteConsumer : public AbortSyncWrite {
755754public:
756- AbortSyncWrite (uint32_t opaque,
757- Vbid vbucket,
758- const DocKey& key,
759- uint64_t preparedSeqno,
760- uint64_t abortSeqno,
761- DocKeyEncodesCollectionId includeCollectionID);
755+ AbortSyncWriteConsumer (uint32_t opaque,
756+ Vbid vbucket,
757+ const DocKey& key,
758+ uint64_t preparedSeqno,
759+ uint64_t abortSeqno);
762760
763761 static constexpr uint32_t abortBaseMsgBytes =
764762 sizeof (protocol_binary_request_header) +
765763 sizeof (cb::mcbp::request::DcpAbortPayload);
766-
767- uint32_t getMessageSize () const override ;
768-
769- private:
770- DocKeyEncodesCollectionId includeCollectionID;
771764};
772765
773766/* *
0 commit comments