github.com/voedger/voedger@v0.0.0-20240520144910-273e84102129/pkg/istorage/provider/provide.go (about) 1 /* 2 * Copyright (c) 2020-present unTill Pro, Ltd. 3 */ 4 5 package provider 6 7 import ( 8 "github.com/google/uuid" 9 10 "github.com/voedger/voedger/pkg/istorage" 11 "github.com/voedger/voedger/pkg/istructs" 12 ) 13 14 // keyspaceNameSuffix is used in tests only 15 // see https://dev.untill.com/projects/#!638565 16 func Provide(asf istorage.IAppStorageFactory, keyspaceNameSuffix ...string) istorage.IAppStorageProvider { 17 res := &implIAppStorageProvider{ 18 asf: asf, 19 cache: map[istructs.AppQName]istorage.IAppStorage{}, 20 } 21 if len(keyspaceNameSuffix) > 0 { 22 res.suffix = keyspaceNameSuffix[0] 23 } else { 24 res.suffix = uuid.NewString() 25 } 26 return res 27 }