cache

package
v0.8.17 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2024 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package cache provides parsed FSE DSLs on Open and Stat from a filesystem

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

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

Cache stores file based DSLs cached by Stat information and indexed on filename

func New

func New() *Cache

New creates a new Cache with os.Open and os.Stat

func NewWith

func NewWith(open OpenFunc, stat StatFunc) *Cache

NewWith creates a new Cache with custom Open and Stat functions

func (*Cache) Workflow

func (c *Cache) Workflow(fn string) (*syntax.Workflow, []listener.Diagnostic, error)

Workflow returns a parsed Workflow which is the same until the unterlying file has a different ModTime

func (*Cache) Workflows

func (c *Cache) Workflows() []*syntax.Workflow

Workflows makes a snapshot of all cached workflow definitions sorted by filename

type ModTimer

type ModTimer interface {
	ModTime() time.Time // modification time
}

ModTimer has a ModTime function like the result of os.Stat

type OpenFunc

type OpenFunc func(fn string) (io.ReadCloser, error)

OpenFunc is a simpler os.Open

type StatFunc

type StatFunc func(fn string) (ModTimer, error)

StatFunc is a simpler os.Stat where only ModTime() is required

Jump to

Keyboard shortcuts

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