Skip to content

Commit b750f99

Browse files
committed
rebased SourceAndVersion -> Version rename
1 parent 418bdd4 commit b750f99

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

db/crud.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ func (db *DatabaseCollectionWithUser) getRev(ctx context.Context, docid, revid s
373373
return revision, nil
374374
}
375375

376-
func (db *DatabaseCollectionWithUser) GetCV(ctx context.Context, docid string, cv *SourceAndVersion, includeBody bool) (revision DocumentRevision, err error) {
376+
func (db *DatabaseCollectionWithUser) GetCV(ctx context.Context, docid string, cv *Version, includeBody bool) (revision DocumentRevision, err error) {
377377
if cv != nil {
378378
revision, err = db.revisionCache.GetWithCV(ctx, docid, cv, includeBody, RevCacheOmitDelta)
379379
} else {
@@ -386,7 +386,7 @@ func (db *DatabaseCollectionWithUser) GetCV(ctx context.Context, docid string, c
386386

387387
if revision.BodyBytes == nil {
388388
if db.ForceAPIForbiddenErrors() {
389-
base.InfofCtx(ctx, base.KeyCRUD, "Doc: %s %s:%s is missing", base.UD(docid), base.MD(cv.SourceID), base.MD(cv.Version))
389+
base.InfofCtx(ctx, base.KeyCRUD, "Doc: %s %s:%s is missing", base.UD(docid), base.MD(cv.SourceID), base.MD(cv.Value))
390390
return DocumentRevision{}, ErrForbidden
391391
}
392392
return DocumentRevision{}, ErrMissing
@@ -401,7 +401,7 @@ func (db *DatabaseCollectionWithUser) GetCV(ctx context.Context, docid string, c
401401
return DocumentRevision{}, ErrForbidden
402402
}
403403
if db.ForceAPIForbiddenErrors() {
404-
base.InfofCtx(ctx, base.KeyCRUD, "Not authorized to view doc: %s %s:%s", base.UD(docid), base.MD(cv.SourceID), base.MD(cv.Version))
404+
base.InfofCtx(ctx, base.KeyCRUD, "Not authorized to view doc: %s %s:%s", base.UD(docid), base.MD(cv.SourceID), base.MD(cv.Value))
405405
return DocumentRevision{}, ErrForbidden
406406
}
407407
return redactedRevision, nil
@@ -533,7 +533,7 @@ func (db *DatabaseCollectionWithUser) GetDelta(ctx context.Context, docID, fromR
533533
return nil, nil, nil
534534
}
535535

536-
func (col *DatabaseCollectionWithUser) authorizeUserForChannels(docID, revID string, cv *SourceAndVersion, channels base.Set, isDeleted bool, history Revisions) (isAuthorized bool, redactedRev DocumentRevision) {
536+
func (col *DatabaseCollectionWithUser) authorizeUserForChannels(docID, revID string, cv *Version, channels base.Set, isDeleted bool, history Revisions) (isAuthorized bool, redactedRev DocumentRevision) {
537537

538538
if col.user != nil {
539539
if err := col.user.AuthorizeAnyCollectionChannel(col.ScopeName, col.Name, channels); err != nil {

db/crud_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -1915,7 +1915,7 @@ func TestGetCVWithDocResidentInCache(t *testing.T) {
19151915

19161916
vrs := doc.HLV.Version
19171917
src := doc.HLV.SourceID
1918-
sv := &SourceAndVersion{Version: vrs, SourceID: src}
1918+
sv := &Version{Value: vrs, SourceID: src}
19191919
revision, err := collection.GetCV(ctx, docID, sv, true)
19201920
require.NoError(t, err)
19211921
if testCase.access {
@@ -1972,7 +1972,7 @@ func TestGetByCVForDocNotResidentInCache(t *testing.T) {
19721972
// get by CV should force a load from bucket and have a cache miss
19731973
vrs := doc.HLV.Version
19741974
src := doc.HLV.SourceID
1975-
sv := &SourceAndVersion{Version: vrs, SourceID: src}
1975+
sv := &Version{Value: vrs, SourceID: src}
19761976
revision, err := collection.GetCV(ctx, doc1ID, sv, true)
19771977
require.NoError(t, err)
19781978

@@ -2033,7 +2033,7 @@ func TestGetCVActivePathway(t *testing.T) {
20332033
require.NoError(t, err)
20342034
vrs := doc.HLV.Version
20352035
src := doc.HLV.SourceID
2036-
sv := &SourceAndVersion{Version: vrs, SourceID: src}
2036+
sv := &Version{Value: vrs, SourceID: src}
20372037
assert.Equal(t, rev, revision.RevID)
20382038
assert.Equal(t, sv, revision.CV)
20392039
assert.Equal(t, docID, revision.DocID)

0 commit comments

Comments
 (0)