Skip to content

Commit

Permalink
server: return concrete MemFS from StickyVFSRegistry
Browse files Browse the repository at this point in the history
The StickyVFSRegistry is only used with in-memory vfs.MemFS for now.
Return the concrete type from the Get method directly, to avoid
unnecessary casts on the caller site.

Epic: none
Release note: none
  • Loading branch information
pav-kv committed Dec 5, 2023
1 parent 78a6074 commit 9d844ce
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/server/sticky_vfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ var UseStrictMemFS = StickyVFSOption(func(cfg *stickyConfig) {
type StickyVFSRegistry interface {
// Get returns the named in-memory FS, constructing a new one if this is the
// first time a FS with the provided ID has been requested.
Get(stickyVFSID string) vfs.FS
Get(stickyVFSID string) *vfs.MemFS
}

// stickyVFSRegistryImpl is the bookkeeper for all active sticky filesystems,
Expand All @@ -62,7 +62,7 @@ func NewStickyVFSRegistry(opts ...StickyVFSOption) StickyVFSRegistry {
}

// Get implements the StickyVFSRegistry interface.
func (registry *stickyVFSRegistryImpl) Get(stickyVFSID string) vfs.FS {
func (registry *stickyVFSRegistryImpl) Get(stickyVFSID string) *vfs.MemFS {
registry.mu.Lock()
defer registry.mu.Unlock()

Expand Down

0 comments on commit 9d844ce

Please sign in to comment.