satellite/metainfo: use Object.Status from ObjectListRequest

Change-Id: Ie2e48d2eedf69bd0f04b7c9d6e7e217fec6b0267
This commit is contained in:
Kaloyan Raev 2020-11-18 13:16:00 +02:00
parent 9bdc8ebf75
commit a30f5d7ec0

View File

@ -961,6 +961,12 @@ func (endpoint *Endpoint) ListObjects(ctx context.Context, req *pb.ObjectListReq
}
}
// Default to Commmitted status for backward-compatibility with older uplinks.
status := metabase.Committed
if req.Status != pb.Object_INVALID {
status = metabase.ObjectStatus(req.Status)
}
resp = &pb.ObjectListResponse{}
// TODO: Replace with IterateObjectsLatestVersion when ready
err = endpoint.metainfo.metabaseDB.IterateObjectsAllVersions(ctx,
@ -971,7 +977,7 @@ func (endpoint *Endpoint) ListObjects(ctx context.Context, req *pb.ObjectListReq
Cursor: metabase.IterateCursor{Key: metabase.ObjectKey(req.EncryptedCursor)},
Recursive: req.Recursive,
BatchSize: limit + 1,
Status: metabase.Committed,
Status: status,
}, func(ctx context.Context, it metabase.ObjectsIterator) error {
entry := metabase.ObjectEntry{}
for len(resp.Items) < limit && it.Next(ctx, &entry) {