filesystem

package
v0.5.12 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrReadOnlyMount = fmt.Errorf("read-only mount point")
)

Functions

This section is empty.

Types

type CFeature

type CFeature[MakeTypedFeature interface{}] struct {
	feature.CFeature
	CGormDBPathSupport[MakeTypedFeature]

	Localized   bool
	MountPoints feature.MountedPoints
	// contains filtered or unexported fields
}

func (*CFeature[MakeTypedFeature]) BeginTransactions added in v0.2.5

func (f *CFeature[MakeTypedFeature]) BeginTransactions()

func (*CFeature[MakeTypedFeature]) CloneFileSystemFeature added in v0.2.5

func (f *CFeature[MakeTypedFeature]) CloneFileSystemFeature() (cloned CFeature[MakeTypedFeature])

func (*CFeature[MakeTypedFeature]) CommitTransactions added in v0.2.5

func (f *CFeature[MakeTypedFeature]) CommitTransactions()

func (*CFeature[MakeTypedFeature]) EndTransactions added in v0.2.5

func (f *CFeature[MakeTypedFeature]) EndTransactions()

func (*CFeature[MakeTypedFeature]) Exists

func (f *CFeature[MakeTypedFeature]) Exists(path string) (present bool)

func (*CFeature[MakeTypedFeature]) FindPageMatterPath

func (f *CFeature[MakeTypedFeature]) FindPageMatterPath(path string) (realpath string, err error)

func (*CFeature[MakeTypedFeature]) FindPathMountPoint

func (f *CFeature[MakeTypedFeature]) FindPathMountPoint(path string) (mps feature.MountPoints)

func (*CFeature[MakeTypedFeature]) FindPathsWhereContext added in v0.2.2

func (f *CFeature[MakeTypedFeature]) FindPathsWhereContext(path string, orJsonConditions ...map[string]interface{}) (found []string, err error)

func (*CFeature[MakeTypedFeature]) FindPathsWhereContextEquals added in v0.2.2

func (f *CFeature[MakeTypedFeature]) FindPathsWhereContextEquals(path string, conditions map[string]interface{}) (found []string, err error)

func (*CFeature[MakeTypedFeature]) FindPathsWhereContextKeyEquals added in v0.2.2

func (f *CFeature[MakeTypedFeature]) FindPathsWhereContextKeyEquals(path, key string, value interface{}) (found []string, err error)

func (*CFeature[MakeTypedFeature]) FindPathsWithContextKey added in v0.2.2

func (f *CFeature[MakeTypedFeature]) FindPathsWithContextKey(path, key string) (found []string, err error)

func (*CFeature[MakeTypedFeature]) FindReadPageMatter

func (f *CFeature[MakeTypedFeature]) FindReadPageMatter(path string) (pm *matter.PageMatter, err error)

func (*CFeature[MakeTypedFeature]) GetMountedPoints added in v0.5.0

func (f *CFeature[MakeTypedFeature]) GetMountedPoints() (mountPoints feature.MountedPoints)

func (*CFeature[MakeTypedFeature]) Init

func (f *CFeature[MakeTypedFeature]) Init(this interface{})

func (*CFeature[MakeTypedFeature]) IsLocalized added in v0.5.0

func (f *CFeature[MakeTypedFeature]) IsLocalized() (supported bool)

func (*CFeature[MakeTypedFeature]) MountFS added in v0.5.0

func (f *CFeature[MakeTypedFeature]) MountFS(mount, path string, ifs fs.FileSystem) MakeTypedFeature

func (*CFeature[MakeTypedFeature]) MountPathROFS

func (f *CFeature[MakeTypedFeature]) MountPathROFS(path, point string, rofs fs.FileSystem)

func (*CFeature[MakeTypedFeature]) MountPathRWFS

func (f *CFeature[MakeTypedFeature]) MountPathRWFS(path, point string, rwfs fs.RWFileSystem)

func (*CFeature[MakeTypedFeature]) ReadMountPageMatter added in v0.2.11

func (f *CFeature[MakeTypedFeature]) ReadMountPageMatter(mp *feature.CMountPoint, path string) (pm *matter.PageMatter, err error)

func (*CFeature[MakeTypedFeature]) ReadPageMatter

func (f *CFeature[MakeTypedFeature]) ReadPageMatter(path string) (pm *matter.PageMatter, err error)

func (*CFeature[MakeTypedFeature]) RemoveMountPageMatter added in v0.2.11

func (f *CFeature[MakeTypedFeature]) RemoveMountPageMatter(mp *feature.CMountPoint, path string) (err error)

func (*CFeature[MakeTypedFeature]) RemovePageMatter

func (f *CFeature[MakeTypedFeature]) RemovePageMatter(path string) (err error)

func (*CFeature[MakeTypedFeature]) RollbackTransactions added in v0.2.5

func (f *CFeature[MakeTypedFeature]) RollbackTransactions()

func (*CFeature[MakeTypedFeature]) Setup

func (f *CFeature[MakeTypedFeature]) Setup(enjin feature.Internals)

func (*CFeature[MakeTypedFeature]) Startup

func (f *CFeature[MakeTypedFeature]) Startup(ctx *cli.Context) (err error)

func (*CFeature[MakeTypedFeature]) WriteMountPageMatter added in v0.2.11

func (f *CFeature[MakeTypedFeature]) WriteMountPageMatter(mp *feature.CMountPoint, pm *matter.PageMatter) (err error)

func (*CFeature[MakeTypedFeature]) WritePageMatter

func (f *CFeature[MakeTypedFeature]) WritePageMatter(pm *matter.PageMatter) (err error)

type CGormDBPathSupport

type CGormDBPathSupport[MakeTypedFeature interface{}] struct {
}

type EmbedPathSupport

type EmbedPathSupport[MakeTypedFeature interface{}] interface {
}

type Feature

type Feature[MakeTypedFeature interface{}] interface {
	feature.Feature

	// IsLocalized returns true if the top-level directories are expected to be valid language.Tag codes
	IsLocalized() (supported bool)

	// MountPathROFS mounts the given fs.FileSystem path to the virtual URI point
	MountPathROFS(path, point string, rofs fs.FileSystem)

	// MountPathRWFS mounts the given fs.RWFileSystem path to the virtual URI point
	MountPathRWFS(path, point string, rwfs fs.RWFileSystem)

	// FindPathMountPoint returns the available mounts matching the given path.
	// For example if there are mounted points of "/stuff" and "/", calling:
	//
	//   f.FindPathMountPoint("/thing")
	//
	// would return the "/" mounts and calling:
	//
	//   f.FindPathMountPoint("/stuff/thing")
	//
	// would return the "/stuff" mounts
	FindPathMountPoint(path string) (mps feature.MountPoints)

	// Exists returns true if the given URI path is present on any of this
	// feature instance's mounted filesystems (can be a file or directory)
	Exists(path string) (present bool)

	// FindPageMatterPath looks for the actual path by checking for the prefix
	// with each of the enjin provided page format extensions, this allows for
	// finding PageMatter without knowing the page's actual format or language
	// first. Uses FindPathMountPoint on the prefix to find the correct
	// filesystem
	FindPageMatterPath(prefix string) (path string, err error)

	// FindReadPageMatter parses the given path file data into a matter.PageMatter
	// structure, suitable for further processing as page.Page or any other
	// type. The first fs.FileSystem which has the given path is used. The order
	// checked is the order features are added during the main enjin build
	// phase. ReadPageMatter uses FindPageMatterPath to find the matter for
	// reading
	FindReadPageMatter(path string) (pm *matter.PageMatter, err error)

	// ReadPageMatter is like FindReadPageMatter except that it uses the path
	// without using FindPageMatterPath
	ReadPageMatter(path string) (pm *matter.PageMatter, err error)

	// WritePageMatter constructs new file data from the existing pm.Body with
	// pm.Matter (using pm.FrontMatterType) and writes it to the first
	// fs.RWFileSystem that matches the PageMatter's path
	WritePageMatter(pm *matter.PageMatter) (err error)

	// GetMountedPoints returns the map of all points currently mounted
	GetMountedPoints() (mountPoints feature.MountedPoints)
}

type GormDBPathSupport

type GormDBPathSupport[MakeTypedFeature interface{}] interface {
}

type LocalPathSupport

type LocalPathSupport[MakeTypedFeature interface{}] interface {
}

type MakeFeature

type MakeFeature[MakeTypedFeature interface{}] interface {
	Support[MakeTypedFeature]
	LocalPathSupport[MakeTypedFeature]
	EmbedPathSupport[MakeTypedFeature]
	ZipPathSupport[MakeTypedFeature]
	GormDBPathSupport[MakeTypedFeature]
}

type Support added in v0.5.0

type Support[MakeTypedFeature interface{}] interface {
	// MountFS maps the local filesystem `path` to the enjin URL `point`
	//
	// The `point` is pruned from the URL during an HTTP request and the `path`
	// prefixes the file's real path. For example, it's common for the following
	// pattern:
	//
	//   f.MountLocalPath("/", "public")
	//
	// This configuration means to provide everything within the local path of
	// `./public/*` (recursively) at the root point of the URL, so for example
	// the URL `/favicon.ico` would translate to the local filesystem path of
	// `./public/favicon.ico`
	MountFS(point, path string, ifs fs.FileSystem) MakeTypedFeature
}

type ZipPathSupport

type ZipPathSupport[MakeTypedFeature interface{}] interface {
}

Jump to

Keyboard shortcuts

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