[#165] Fix v1 listing bookmark
Signed-off-by: Denis Kirillov <d.kirillov@yadro.com>
This commit is contained in:
parent
0ae49eaab0
commit
6d52f46012
1 changed files with 33 additions and 25 deletions
|
@ -80,6 +80,7 @@ type (
|
||||||
MaxKeys int
|
MaxKeys int
|
||||||
Marker string
|
Marker string
|
||||||
Bookmark string
|
Bookmark string
|
||||||
|
VersionAPi string
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -94,6 +95,7 @@ func (n *layer) ListObjectsV1(ctx context.Context, p *ListObjectsParamsV1) (*Lis
|
||||||
MaxKeys: p.MaxKeys,
|
MaxKeys: p.MaxKeys,
|
||||||
Marker: p.Marker,
|
Marker: p.Marker,
|
||||||
Bookmark: p.Marker,
|
Bookmark: p.Marker,
|
||||||
|
VersionAPi: "v1",
|
||||||
}
|
}
|
||||||
|
|
||||||
objects, next, err := n.getLatestObjectsVersions(ctx, prm)
|
objects, next, err := n.getLatestObjectsVersions(ctx, prm)
|
||||||
|
@ -122,6 +124,7 @@ func (n *layer) ListObjectsV2(ctx context.Context, p *ListObjectsParamsV2) (*Lis
|
||||||
MaxKeys: p.MaxKeys,
|
MaxKeys: p.MaxKeys,
|
||||||
Marker: p.StartAfter,
|
Marker: p.StartAfter,
|
||||||
Bookmark: p.ContinuationToken,
|
Bookmark: p.ContinuationToken,
|
||||||
|
VersionAPi: "v2",
|
||||||
}
|
}
|
||||||
|
|
||||||
objects, next, err := n.getLatestObjectsVersions(ctx, prm)
|
objects, next, err := n.getLatestObjectsVersions(ctx, prm)
|
||||||
|
@ -147,6 +150,7 @@ func (n *layer) ListObjectVersions(ctx context.Context, p *ListObjectVersionsPar
|
||||||
MaxKeys: p.MaxKeys,
|
MaxKeys: p.MaxKeys,
|
||||||
Marker: p.KeyMarker,
|
Marker: p.KeyMarker,
|
||||||
Bookmark: p.VersionIDMarker,
|
Bookmark: p.VersionIDMarker,
|
||||||
|
VersionAPi: "vs",
|
||||||
}
|
}
|
||||||
|
|
||||||
objects, isTruncated, err := n.getAllObjectsVersions(ctx, prm)
|
objects, isTruncated, err := n.getAllObjectsVersions(ctx, prm)
|
||||||
|
@ -223,8 +227,12 @@ func (n *layer) getLatestObjectsVersions(ctx context.Context, p allObjectListing
|
||||||
|
|
||||||
if next != nil {
|
if next != nil {
|
||||||
session.Next = []*data.NodeVersion{next}
|
session.Next = []*data.NodeVersion{next}
|
||||||
|
if p.VersionAPi == "v1" {
|
||||||
|
n.cache.PutListSession(owner, cache.CreateListSessionCacheKey(p.BktInfo.CID, p.Prefix, objects[len(objects)-1].FilePath), session)
|
||||||
|
} else {
|
||||||
n.cache.PutListSession(owner, cache.CreateListSessionCacheKey(p.BktInfo.CID, p.Prefix, next.OID.EncodeToString()), session)
|
n.cache.PutListSession(owner, cache.CreateListSessionCacheKey(p.BktInfo.CID, p.Prefix, next.OID.EncodeToString()), session)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue