filesystem

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package filesystem provides a Connector implementation for local filesystem directories. It watches for file changes and syncs document content.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResolveWebURL

func ResolveWebURL(uri string, _ map[string]any) string

ResolveWebURL converts a filesystem URI to a local path for opening. Handles file:// URIs and bare paths.

Types

type Connector

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

Connector reads documents from the local filesystem.

func New

func New(sourceID, rootPath string) *Connector

New creates a new filesystem connector.

func (*Connector) Capabilities

func (c *Connector) Capabilities() driven.ConnectorCapabilities

Capabilities returns the connector's capabilities.

func (*Connector) Close

func (c *Connector) Close() error

Close releases resources.

func (*Connector) FullSync

func (c *Connector) FullSync(ctx context.Context) (docs <-chan domain.RawDocument, errs <-chan error)

FullSync performs a full synchronisation of all documents. It walks the entire directory tree and emits RawDocuments for each file.

func (*Connector) GetAccountIdentifier

func (c *Connector) GetAccountIdentifier(_ context.Context, _ string) (string, error)

GetAccountIdentifier returns an empty string for filesystem connector. Filesystem is a local, no-auth connector so there is no account to identify.

func (*Connector) IncrementalSync

func (c *Connector) IncrementalSync(
	ctx context.Context, state domain.SyncState,
) (changes <-chan domain.RawDocumentChange, errs <-chan error)

IncrementalSync syncs changes since the last sync state. The cursor is a Unix timestamp in nanoseconds representing the last sync time. Only files modified after this time are included.

func (*Connector) SourceID

func (c *Connector) SourceID() string

SourceID returns the source identifier.

func (*Connector) Type

func (c *Connector) Type() string

Type returns the connector type identifier.

func (*Connector) Validate

func (c *Connector) Validate(ctx context.Context) error

Validate checks if the filesystem connector is properly configured. For filesystem, this verifies the root path exists and is readable.

func (*Connector) Watch

func (c *Connector) Watch(ctx context.Context) (<-chan domain.RawDocumentChange, error)

Watch monitors for real-time document changes using fsnotify. Returns a channel that receives changes as they occur.

Jump to

Keyboard shortcuts

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