Movatterモバイル変換


[0]ホーム

URL:


files

package
v2.24.2Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 15, 2025 License:AGPL-3.0Imports:16Imported by:0

Details

Repository

github.com/coder/coder

Links

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

funcNewOverlayFSadded inv2.23.0

func NewOverlayFS(baseFSfs.FS, overlays []Overlay)fs.FS

Types

typeCache

type Cache struct {// contains filtered or unexported fields}

Cache persists the files for template versions, and is used by dynamicparameters to deduplicate the files in memory. When any number of users opensthe workspace creation form for a given template version, it's files areloaded into memory exactly once. We hold those files until there are nolonger any open connections, and then we remove the value from the map.

funcNewadded inv2.24.0

func New(registererprometheus.Registerer, authzrbac.Authorizer) *Cache

New returns a file cache that will fetch files from a database

func (*Cache)Acquire

func (c *Cache) Acquire(ctxcontext.Context, dbdatabase.Store, fileIDuuid.UUID) (*CloseFS,error)

Acquire will load the fs.FS for the given file. It guarantees that parallelcalls for the same fileID will only result in one fetch, and that parallelcalls for distinct fileIDs will fetch in parallel.

Safety: Every call to Acquire that does not return an error must have amatching call to Release.

func (*Cache)Countadded inv2.23.0

func (c *Cache) Count()int

Count returns the number of files currently in the cache.Mainly used for unit testing assertions.

typeCacheCloseradded inv2.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.

funcNewCacheCloseradded inv2.24.0

func NewCacheCloser(cacheFileAcquirer) *CacheCloser

func (*CacheCloser)Acquireadded inv2.24.0

func (c *CacheCloser) Acquire(ctxcontext.Context, dbdatabase.Store, fileIDuuid.UUID) (*CloseFS,error)

func (*CacheCloser)Closeadded inv2.24.0

func (c *CacheCloser) Close()

typeCacheEntryValueadded inv2.24.0

type CacheEntryValue struct {fs.FSObjectrbac.ObjectSizeint64}

typeCloseFSadded inv2.24.0

type CloseFS struct {fs.FS// contains filtered or unexported fields}

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 areclosed, the file is removed from the cache.

func (*CloseFS)Closeadded inv2.24.0

func (f *CloseFS) Close()

typeFileAcquireradded inv2.24.0

type FileAcquirer interface {Acquire(ctxcontext.Context, dbdatabase.Store, fileIDuuid.UUID) (*CloseFS,error)}

typeOverlayadded inv2.23.0

type Overlay struct {Pathstringfs.FS}

Source Files

View all Source files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp