feat(bsr/fstest): Implement Open method

This commit is contained in:
Timothy Messier committed 2023-05-31 12:18:20 +00:00
1 parent 82989fd123
commit e9c7e373e9
1 file changed
+13
+13
View File
@@ -56,6 +56,19 @@ func (m *MemFS) New(ctx context.Context, n string) (storage.Container, error) {
return c, nil
}
// Open opens an existing a storage.Container from the MemFS.
func (m *MemFS) Open(_ context.Context, n string) (storage.Container, error) {
if m.Containers == nil {
return nil, fmt.Errorf("container %s not found", n)
}
c, ok := m.Containers[n]
if !ok {
return nil, fmt.Errorf("container %s not found", n)
}
return c, nil
}
// MemContainer is a storage.Container that resides in memory.
type MemContainer struct {
Name string