vfsutil

package
v0.0.0-...-75b7e41 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2024 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ArchiveCacheDir = "/tmp/go-langserver-archive-cache"

ArchiveCacheDir is the location on disk that archives are cached. It is configurable so that in production we can point it into CACHE_DIR.

View Source
var MaxCacheSizeBytes = int64(50 * 1024 * 1024 * 1024)

MaxCacheSizeBytes is the maximum size of the cache directory after evicting entries. Defaults to 50 GB.

Functions

This section is empty.

Types

type ArchiveFS

type ArchiveFS struct {

	// EvictOnClose when true will evict the underlying archive from the
	// archive cache when closed.
	EvictOnClose bool
	// contains filtered or unexported fields
}

ArchiveFS is a ctxvfs.FileSystem backed by an Archiver.

func NewGitHubRepoVFS

func NewGitHubRepoVFS(ctx context.Context, repo, rev string) (*ArchiveFS, error)

NewGitHubRepoVFS creates a new VFS backed by a GitHub downloadable repository archive.

func NewZipVFS

func NewZipVFS(ctx context.Context, url string, onFetchStart, onFetchFailed func(), evictOnClose bool) (*ArchiveFS, error)

NewZipVFS downloads a zip archive from a URL (or fetches from the local cache on disk) and returns a new VFS backed by that zip archive.

func (*ArchiveFS) Close

func (fs *ArchiveFS) Close() error

func (*ArchiveFS) ListAllFiles

func (fs *ArchiveFS) ListAllFiles(ctx context.Context) ([]string, error)

func (*ArchiveFS) Lstat

func (fs *ArchiveFS) Lstat(ctx context.Context, path string) (os.FileInfo, error)

func (*ArchiveFS) Open

func (fs *ArchiveFS) Open(ctx context.Context, name string) (ctxvfs.ReadSeekCloser, error)

func (*ArchiveFS) ReadDir

func (fs *ArchiveFS) ReadDir(ctx context.Context, path string) ([]os.FileInfo, error)

func (*ArchiveFS) Stat

func (fs *ArchiveFS) Stat(ctx context.Context, path string) (os.FileInfo, error)

func (*ArchiveFS) String

func (fs *ArchiveFS) String() string

type Evicter

type Evicter interface {
	// Evict evicts an item from a cache.
	Evict()
}

Evicter implements Evict

type GitRepoVFS

type GitRepoVFS struct {
	CloneURL string // Git clone URL (e.g., "https://github.com/foo/bar")
	Rev      string // Git revision (should be absolute, 40-char for consistency, unless nondeterminism is OK)
	Subtree  string // only include this subtree
	// contains filtered or unexported fields
}

func (*GitRepoVFS) Lstat

func (fs *GitRepoVFS) Lstat(ctx context.Context, path string) (os.FileInfo, error)

func (*GitRepoVFS) Open

func (fs *GitRepoVFS) Open(ctx context.Context, path string) (ctxvfs.ReadSeekCloser, error)

func (*GitRepoVFS) ReadDir

func (fs *GitRepoVFS) ReadDir(ctx context.Context, path string) ([]os.FileInfo, error)

func (*GitRepoVFS) Stat

func (fs *GitRepoVFS) Stat(ctx context.Context, path string) (os.FileInfo, error)

func (*GitRepoVFS) String

func (fs *GitRepoVFS) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL