GetWithRev fetches the revision for the given docID and revID immediately from the bucket.
(ctx context.Context, docID, revID string, collectionID uint32, includeDelta bool)
| 33 | |
| 34 | // GetWithRev fetches the revision for the given docID and revID immediately from the bucket. |
| 35 | func (rc *BypassRevisionCache) GetWithRev(ctx context.Context, docID, revID string, collectionID uint32, includeDelta bool) (docRev DocumentRevision, err error) { |
| 36 | doc, err := rc.backingStores[collectionID].GetDocument(ctx, docID, DocUnmarshalSync) |
| 37 | if err != nil { |
| 38 | return DocumentRevision{}, err |
| 39 | } |
| 40 | |
| 41 | docRev = DocumentRevision{ |
| 42 | RevID: revID, |
| 43 | RevCacheValueDeltaLock: &sync.Mutex{}, // initialize the mutex for delta updates |
| 44 | } |
| 45 | var hlv *HybridLogicalVector |
| 46 | docRev.BodyBytes, docRev.History, docRev.Channels, docRev.Removed, docRev.Attachments, docRev.Deleted, docRev.Expiry, hlv, err = revCacheLoaderForDocument(ctx, rc.backingStores[collectionID], doc, revID) |
| 47 | if err != nil { |
| 48 | return DocumentRevision{}, err |
| 49 | } |
| 50 | if hlv != nil { |
| 51 | docRev.CV = hlv.ExtractCurrentVersionFromHLV() |
| 52 | docRev.HlvHistory = hlv.ToHistoryForHLV() |
| 53 | } |
| 54 | |
| 55 | rc.bypassStat.Add(1) |
| 56 | |
| 57 | return docRev, nil |
| 58 | } |
| 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) { |