LCOV - code coverage report
Current view: top level - pebble/objstorage/remote - factory.go (source / functions) Hit Total Coverage
Test: 2023-12-31 08:15Z 1cce3d01 - tests + meta.lcov Lines: 8 8 100.0 %
Date: 2023-12-31 08:16:47 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           2 : func MakeSimpleFactory(m map[Locator]Storage) StorageFactory {
      12           2 :         return simpleFactory(m)
      13           2 : }
      14             : 
      15             : type simpleFactory map[Locator]Storage
      16             : 
      17             : var _ StorageFactory = simpleFactory{}
      18             : 
      19             : // CreateStorage is part of the StorageFactory interface.
      20           2 : func (sf simpleFactory) CreateStorage(locator Locator) (Storage, error) {
      21           2 :         if s, ok := sf[locator]; ok {
      22           2 :                 return s, nil
      23           2 :         }
      24           1 :         return nil, errors.Errorf("unknown locator '%s'", locator)
      25             : }

Generated by: LCOV version 1.14