entity

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseFileDecoratorFs

type BaseFileDecoratorFs struct {
	afero.Fs
	Decorate func(fi os.FileInfo, filename string) (os.FileInfo, error)
}

func (*BaseFileDecoratorFs) LstatIfPossible

func (fs *BaseFileDecoratorFs) LstatIfPossible(name string) (os.FileInfo, bool, error)

func (*BaseFileDecoratorFs) Open

func (fs *BaseFileDecoratorFs) Open(name string) (afero.File, error)

func (*BaseFileDecoratorFs) Stat

func (fs *BaseFileDecoratorFs) Stat(name string) (os.FileInfo, error)

func (*BaseFileDecoratorFs) UnwrapFilesystem

func (fs *BaseFileDecoratorFs) UnwrapFilesystem() afero.Fs

type BaseFs

type BaseFs struct {

	// SourceFilesystems contains the different source file systems.
	*SourceFilesystems

	// The project source.
	SourceFs afero.Fs

	// The filesystem used to publish the rendered site.
	// This usually maps to /my-project/public.
	PublishFs afero.Fs

	// A read-only filesystem starting from the project workDir.
	WorkDir afero.Fs

	TheBigFs *FilesystemsCollector
}

BaseFs contains the core base filesystems used by Hugo. The name "base" is used to underline that even if they can be composites, they all have a base path set to a specific resource folder, e.g "/my-project/content". So, no absolute filenames needed.

type FilesystemsCollector

type FilesystemsCollector struct {
	SourceProject afero.Fs // Source for project folders

	OverlayMounts        *overlayfs.OverlayFs
	OverlayMountsContent *overlayfs.OverlayFs

	// Maps component type (layouts, static, content etc.) an ordered list of
	// directories representing the overlay filesystems above.
	OverlayDirs map[string][]valueobject.FileMetaInfo
}

func (*FilesystemsCollector) AddDirs

func (c *FilesystemsCollector) AddDirs(rfs *RootMappingFs)

type Fs

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

func NewFs

func NewFs(workingDir, publishDir string) *Fs

NewFs creates a new Fs.

func (*Fs) PublishDir

func (f *Fs) PublishDir() afero.Fs

func (*Fs) Source

func (f *Fs) Source() afero.Fs

func (*Fs) WorkingDirReadOnly

func (f *Fs) WorkingDirReadOnly() afero.Fs

type RootMappingFs

type RootMappingFs struct {
	afero.Fs
	RootMapToReal *radixtree.Tree
}

A RootMappingFs maps several roots into one. Note that the root of this filesystem is directories only, and they will be returned in Readdir and Readdirnames in the order given.

func (*RootMappingFs) Dirs

func (m *RootMappingFs) Dirs(base string) ([]valueobject.FileMetaInfo, error)

func (*RootMappingFs) LstatIfPossible

func (m *RootMappingFs) LstatIfPossible(name string) (os.FileInfo, bool, error)

LstatIfPossible returns the os.FileInfo structure describing a given file.

func (*RootMappingFs) Open

func (m *RootMappingFs) Open(name string) (afero.File, error)

Open opens the named file for reading.

func (*RootMappingFs) Stat

func (m *RootMappingFs) Stat(name string) (os.FileInfo, error)

Stat returns the os.FileInfo structure describing a given file. If there is an error, it will be of type *os.PathError.

type SourceFilesystem

type SourceFilesystem struct {
	// Name matches one in files.ComponentFolders
	Name string

	// This is a virtual composite filesystem. It expects path relative to a context.
	Fs afero.Fs

	// This filesystem as separate root directories, starting from project and down
	// to the themes/modules.
	Dirs []valueobject.FileMetaInfo

	// When syncing a source folder to the target (e.g. /public), this may
	// be set to publish into a subfolder. This is used for static syncing
	// in multihost mode.
	PublishFolder string
}

A SourceFilesystem holds the filesystem for a given source type in Hugo (data, i18n, layouts, static) and additional metadata to be able to use that filesystem in server mode.

type SourceFilesystems

type SourceFilesystems struct {
	Content    *SourceFilesystem // set
	Data       *SourceFilesystem
	I18n       *SourceFilesystem
	Layouts    *SourceFilesystem // set
	Archetypes *SourceFilesystem
	Assets     *SourceFilesystem

	// Writable filesystem on top the project's resources directory,
	// with any sub module's resource fs layered below.
	ResourcesCache afero.Fs

	// The work folder (may be a composite of project and theme components).
	Work afero.Fs

	// When in multihost we have one static filesystem per language. The sync
	// static files is currently done outside of the Hugo build (where there is
	// a concept of a site per language).
	// When in non-multihost mode there will be one entry in this map with a blank key.
	Static map[string]*SourceFilesystem

	// All the /static dirs (including themes/modules).
	StaticDirs []valueobject.FileMetaInfo
}

SourceFilesystems contains the different source file systems. These can be composite file systems (theme and project etc.), and they have all root set to the source type the provides: data, i18n, static, layouts.

Jump to

Keyboard shortcuts

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