LCOV - code coverage report
Current view: top level - pebble/objstorage/remote - factory.go (source / functions) Hit Total Coverage
Test: 2024-03-27 08:24Z 5babbee7 - meta test only.lcov Lines: 7 8 87.5 %
Date: 2024-03-27 08:25:14 Functions: 0 0 -

          Line data    Source code
       1             : // Copyright 2023 The LevelDB-Go and Pebble Authors. All rights reserved. Use
       2             : // of this source code is governed by a BSD-style license that can be found in
       3             : // the LICENSE file.
       4             : 
       5             : package remote
       6             : 
       7             : import "github.com/pkg/errors"
       8             : 
       9             : // MakeSimpleFactory returns a StorageFactory implementation that produces the given
      10             : // Storage objects.
      11           1 : func MakeSimpleFactory(m map[Locator]Storage) StorageFactory {
      12           1 :         return simpleFactory(m)
      13           1 : }
      14             : 
      15             : type simpleFactory map[Locator]Storage
      16             : 
      17             : var _ StorageFactory = simpleFactory{}
      18             : 
      19             : // CreateStorage is part of the StorageFactory interface.
      20           1 : func (sf simpleFactory) CreateStorage(locator Locator) (Storage, error) {
      21           1 :         if s, ok := sf[locator]; ok {
      22           1 :                 return s, nil
      23           1 :         }
      24           0 :         return nil, errors.Errorf("unknown locator '%s'", locator)
      25             : }

Generated by: LCOV version 1.14