GetWithCV fetches the Current Version for the given docID and CV immediately from the bucket.
(ctx context.Context, docID string, cv *Version, collectionID uint32, includeDelta bool, loadBackup bool)
| 59 | |
| 60 | // GetWithCV fetches the Current Version for the given docID and CV immediately from the bucket. |
| 61 | func (rc *BypassRevisionCache) GetWithCV(ctx context.Context, docID string, cv *Version, collectionID uint32, includeDelta bool, loadBackup bool) (docRev DocumentRevision, err error) { |
| 62 | |
| 63 | docRev = DocumentRevision{ |
| 64 | CV: cv, |
| 65 | RevCacheValueDeltaLock: &sync.Mutex{}, // initialize the mutex for delta updates |
| 66 | } |
| 67 | |
| 68 | doc, err := rc.backingStores[collectionID].GetDocument(ctx, docID, DocUnmarshalSync) |
| 69 | if err != nil { |
| 70 | return DocumentRevision{}, err |
| 71 | } |
| 72 | |
| 73 | var hlv *HybridLogicalVector |
| 74 | docRev.BodyBytes, docRev.History, docRev.Channels, docRev.Removed, docRev.Attachments, docRev.Deleted, docRev.Expiry, docRev.RevID, hlv, err = revCacheLoaderForDocumentCV(ctx, rc.backingStores[collectionID], doc, *cv, loadBackup) |
| 75 | if err != nil { |
| 76 | return DocumentRevision{}, err |
| 77 | } |
| 78 | if hlv != nil { |
| 79 | docRev.HlvHistory = hlv.ToHistoryForHLV() |
| 80 | } |
| 81 | |
| 82 | rc.bypassStat.Add(1) |
| 83 | |
| 84 | return docRev, nil |
| 85 | } |
| 86 | |
| 87 | // GetActive fetches the active revision for the given docID immediately from the bucket. |
| 88 | func (rc *BypassRevisionCache) GetActive(ctx context.Context, docID string, collectionID uint32) (docRev DocumentRevision, err error) { |
nothing calls this directly
no test coverage detected