filesystem

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: MIT Imports: 20 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package filesystem implements the built-in bounded filesystem source adapter.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrLimit reports that a configured filesystem source exceeded a bound.
	ErrLimit = errors.New("filesystem source exceeds a limit")
	// ErrPathRejected reports an unsafe or unsupported filesystem path.
	ErrPathRejected = errors.New("filesystem source path rejected")
	// ErrPageToken reports an invalid or stale filesystem page token.
	ErrPageToken = errors.New("filesystem source page token invalid")
	// ErrDocumentNotFound reports that a listed document is no longer present.
	ErrDocumentNotFound = errors.New("filesystem source document not found")
	// ErrRevisionChanged reports that a document changed after it was listed.
	ErrRevisionChanged = errors.New("filesystem source document revision changed")
)

Functions

func DocumentMediaType

func DocumentMediaType(relative string) string

DocumentMediaType reports the deterministic media type of one descriptor.

func DocumentTitle

func DocumentTitle(relative string, content []byte) string

DocumentTitle derives the deterministic fallback title of one descriptor.

func DocumentURI

func DocumentURI(config knowl.FilesystemSourceConfig, relative string) string

DocumentURI reconstructs the canonical descriptor URI from configuration and the document's source-relative path without touching the source root.

Types

type Adapter

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

Adapter lists filesystem descriptors without retaining their content.

func New

func New(limits Limits) (*Adapter, error)

New constructs an Adapter with explicit bounded limits.

func NewDefault

func NewDefault() *Adapter

NewDefault constructs an Adapter with conservative local bounds.

func (*Adapter) Fetch

func (adapter *Adapter) Fetch(ctx context.Context, source knowl.Source, ref knowl.DocumentRef) (knowl.Document, error)

Fetch selectively returns one exact listed source revision.

func (*Adapter) List

func (adapter *Adapter) List(ctx context.Context, source knowl.Source, pageToken string) (knowl.DocumentPage, error)

List returns one deterministic page of content-free descriptors.

type Limits

type Limits struct {
	PageSize         int
	MaxVisited       int
	MaxDocuments     int
	MaxPathBytes     int
	MaxTokenBytes    int
	MaxFileBytes     int64
	MaxMetadataBytes int
}

Limits bounds one adapter invocation. Values are validated by New.

func DefaultLimits

func DefaultLimits() Limits

DefaultLimits returns conservative local filesystem adapter bounds.

Jump to

Keyboard shortcuts

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