satellite/metainfo: add TestingAll{Segments,Objects}
Change-Id: Ia758c119d5ebd7bbb21216a463c99c2e9afcdeb0
This commit is contained in:
parent
9db28b92e7
commit
4706f01876
@ -208,6 +208,11 @@ type MetabaseDB interface {
|
||||
// TestingAllObjectSegments gets all segments for given object. Use only for testing purposes.
|
||||
TestingAllObjectSegments(ctx context.Context, objectLocation metabase.ObjectLocation) (segments []metabase.Segment, err error)
|
||||
|
||||
// TestingAllObjects gets all objects. Use only for testing purposes.
|
||||
TestingAllObjects(ctx context.Context) (segments []metabase.Object, err error)
|
||||
// TestingAllSegments gets all segments. Use only for testing purposes.
|
||||
TestingAllSegments(ctx context.Context) (segments []metabase.Segment, err error)
|
||||
|
||||
// InternalImplementation returns *metabase.DB.
|
||||
// TODO: remove.
|
||||
InternalImplementation() interface{}
|
||||
|
@ -413,3 +413,37 @@ func (db *DB) TestingAllObjectSegments(ctx context.Context, objectLocation Objec
|
||||
|
||||
return response.Segments, nil
|
||||
}
|
||||
|
||||
// TestingAllObjects gets all objects.
|
||||
// Use only for testing purposes.
|
||||
func (db *DB) TestingAllObjects(ctx context.Context) (objects []Object, err error) {
|
||||
defer mon.Task()(&ctx)(&err)
|
||||
|
||||
rawObjects, err := db.testingGetAllObjects(ctx)
|
||||
if err != nil {
|
||||
return nil, Error.Wrap(err)
|
||||
}
|
||||
|
||||
for _, o := range rawObjects {
|
||||
objects = append(objects, Object(o))
|
||||
}
|
||||
|
||||
return objects, nil
|
||||
}
|
||||
|
||||
// TestingAllSegments gets all segments.
|
||||
// Use only for testing purposes.
|
||||
func (db *DB) TestingAllSegments(ctx context.Context) (segments []Segment, err error) {
|
||||
defer mon.Task()(&ctx)(&err)
|
||||
|
||||
rawSegments, err := db.testingGetAllSegments(ctx)
|
||||
if err != nil {
|
||||
return nil, Error.Wrap(err)
|
||||
}
|
||||
|
||||
for _, s := range rawSegments {
|
||||
segments = append(segments, Segment(s))
|
||||
}
|
||||
|
||||
return segments, nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user