filesystem

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2026 License: MIT Imports: 20 Imported by: 0

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