package filesystem

import "github.com/influxdata/flux/dependencies/filesystem"

Index

Functions

func Inject

func Inject(ctx context.Context, fs Service) context.Context

Inject will inject this filesystem Service into the context.

func ReadFile

func ReadFile(ctx context.Context, filename string) ([]byte, error)

ReadFile will open the file from the service and read the entire contents.

func Stat

func Stat(ctx context.Context, filename string) (os.FileInfo, error)

Stat will retrieve the os.FileInfo for a file.

Types

type Dependency

type Dependency struct {
	FS Service
}

Dependency will inject the filesystem Service into the dependency chain.

func (Dependency) Inject

func (d Dependency) Inject(ctx context.Context) context.Context

Inject will inject the filesystem Service into the dependency chain.

type File

type File interface {
	io.ReadCloser
	Stat() (os.FileInfo, error)
}

File is an interface for interacting with a file.

func OpenFile

func OpenFile(ctx context.Context, filename string) (File, error)

OpenFile will open the file from the service.

type Service

type Service interface {
	Open(fpath string) (File, error)
}

Service is the service for accessing the filesystem.

var SystemFS Service = systemFS{}

SystemFS implements the filesystem.Service by proxying all requests to the filesystem.

func Get

func Get(ctx context.Context) (Service, error)

Get will retrieve a filesystem Service from the context.Context.

Source Files

ioutil.go service.go systemfs.go

Version
v0.196.1 (latest)
Published
Feb 19, 2025
Platform
linux/amd64
Imports
5 packages
Last checked
1 day ago

Tools for package owners.