summaryrefslogtreecommitdiff
path: root/internal/datafs/context.go
diff options
context:
space:
mode:
authorDave Henderson <dhenderson@gmail.com>2024-05-29 20:36:24 -0400
committerGitHub <noreply@github.com>2024-05-29 20:36:24 -0400
commit95a06b9fc94c44af51588379c4e443e986b7e4d5 (patch)
treec17f08a12c020ef45302800d778d02ee18bfcc24 /internal/datafs/context.go
parent362f058f0c93900c7bd7462aac200597e70ebfb7 (diff)
chore!: Replacing the data.Data type with a datasource registry (#2083)
* chore!: Replacing the data.Data type with a datasource registry Signed-off-by: Dave Henderson <dhenderson@gmail.com> * chore(lint): fix lint warning Signed-off-by: Dave Henderson <dhenderson@gmail.com> --------- Signed-off-by: Dave Henderson <dhenderson@gmail.com>
Diffstat (limited to 'internal/datafs/context.go')
-rw-r--r--internal/datafs/context.go16
1 files changed, 7 insertions, 9 deletions
diff --git a/internal/datafs/context.go b/internal/datafs/context.go
index 7f1235bf..30722f2b 100644
--- a/internal/datafs/context.go
+++ b/internal/datafs/context.go
@@ -5,8 +5,6 @@ import (
"io"
"io/fs"
"os"
-
- "github.com/hairyhenderson/gomplate/v4/internal/config"
)
// withContexter is an fs.FS that can be configured with a custom context
@@ -15,16 +13,16 @@ type withContexter interface {
WithContext(ctx context.Context) fs.FS
}
-type withDataSourceser interface {
- WithDataSources(sources map[string]config.DataSource) fs.FS
+type withDataSourceRegistryer interface {
+ WithDataSourceRegistry(registry Registry) fs.FS
}
-// WithDataSourcesFS injects a datasource map into the filesystem fs, if the
-// filesystem supports it (i.e. has a WithDataSources method). This is used for
+// WithDataSourceRegistryFS injects a datasource registry into the filesystem fs, if the
+// filesystem supports it (i.e. has a WithDataSourceRegistry method). This is used for
// the mergefs filesystem.
-func WithDataSourcesFS(sources map[string]config.DataSource, fsys fs.FS) fs.FS {
- if fsys, ok := fsys.(withDataSourceser); ok {
- return fsys.WithDataSources(sources)
+func WithDataSourceRegistryFS(registry Registry, fsys fs.FS) fs.FS {
+ if fsys, ok := fsys.(withDataSourceRegistryer); ok {
+ return fsys.WithDataSourceRegistry(registry)
}
return fsys