Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache persists the files for template versions, and is used by dynamic parameters to deduplicate the files in memory. When any number of users opens the workspace creation form for a given template version, it's files are loaded into memory exactly once. We hold those files until there are no longer any open connections, and then we remove the value from the map.
func New ¶ added in v2.24.0
func New(registerer prometheus.Registerer, authz rbac.Authorizer) *Cache
New returns a file cache that will fetch files from a database
func (*Cache) Acquire ¶
Acquire will load the fs.FS for the given file. It guarantees that parallel calls for the same fileID will only result in one fetch, and that parallel calls for distinct fileIDs will fetch in parallel.
Safety: Every call to Acquire that does not return an error must have a matching call to Release.
type CacheCloser ¶ added in v2.24.0
type CacheCloser struct {
// contains filtered or unexported fields
}
CacheCloser is a cache wrapper used to close all acquired files. This is a more simple interface to use if opening multiple files at once.
func NewCacheCloser ¶ added in v2.24.0
func NewCacheCloser(cache FileAcquirer) *CacheCloser
func (*CacheCloser) Close ¶ added in v2.24.0
func (c *CacheCloser) Close()
type CacheEntryValue ¶ added in v2.24.0
type CloseFS ¶ added in v2.24.0
CloseFS is a wrapper around fs.FS that implements io.Closer. The Close() method tells the cache to release the fileID. Once all open references are closed, the file is removed from the cache.