singleopen

package module
v0.0.0-...-be7ff8b Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2021 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package singleopen provides functionality for reusing file handles when possible.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FS

type FS struct {
	// FS is the underlying file system used to open files.
	// The underlying file system should return files that
	// implement io.ReaderAt. If the file is just a fs.File
	// calls to Read will be synchronised.
	FS fs.FS
	// contains filtered or unexported fields
}

FS is a file system that reuses file handles.

func (*FS) KeepLast

func (fsys *FS) KeepLast(n int)

KeepLast enables a cache that keeps the last n recently closed files open. If n <= 0, the cache is disabled.

func (*FS) Open

func (fsys *FS) Open(name string) (fs.File, error)

Open opens a file or returns the already open file. Only regular files are being reused. Before opening Stat is being called to determine the kind of file.

Directories

Path Synopsis
internal
lru
Package lru implements an LRU cache.
Package lru implements an LRU cache.

Jump to

Keyboard shortcuts

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