core

package
v0.2.13 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: Apache-2.0 Imports: 32 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

Retained copy and move behavior derives from harbor-file-service 727ce0a and the reviewed Sailry file service (Apache-2.0).

Directory paging follows harbor-file-service 727ce0a (Apache-2.0).

Trash relocation behavior is adapted from harbor-file-service 727ce0a (Apache-2.0).

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrStopped         = errors.New("Node service is stopping or stopped")
	ErrBusy            = errors.New("Node task capacity is exhausted")
	ErrShutdownTimeout = errors.New("Node shutdown deadline elapsed; remaining tasks were cancelled")
)
View Source
var (
	ErrBinaryText      = errors.New("binary content cannot be decoded as text")
	ErrUnsupportedText = errors.New("text is neither valid UTF-8 nor GB18030")
)

Default is set to the release profile by packaging through -ldflags -X.

Functions

func AssistantWorkspace

func AssistantWorkspace(profile string, binding protocol.PluginConversationBinding) (string, error)

func CheckFilePath

func CheckFilePath(value string) error

CheckFilePath reports whether value is a normalized worktree-relative path that restricted file access may name.

func ConnectionWorkspace

func ConnectionWorkspace(profile string, resource protocol.ConnectionResource) (string, error)

func DatabaseFiles

func DatabaseFiles(path string) []string

func DecodeText

func DecodeText(data []byte) (string, error)

DecodeText preserves UTF-8 and strictly decodes the supported GB18030 fallback.

func DefaultDataDir

func DefaultDataDir() (string, error)

DefaultDataDir resolves the profile location without creating or opening it.

func DeliverableFile added in v0.2.5

func DeliverableFile(name string) bool

DeliverableFile reports whether a file name is a produced deliverable that a reply shows as a file card when it links it alone in a paragraph.

func ManagedWorkspace

func ManagedWorkspace(root, profile string) bool

ManagedWorkspace accepts an exact registered root, never one of its descendants.

func PrivateDirectory

func PrivateDirectory(path string) error

func Release

func Release() bool

Release reports a build whose profile default packaging replaced. Release builds load native code only from their package.

func SessionWorkspace

func SessionWorkspace(profile string, id protocol.SessionID) string

func Temporary

func Temporary(profile string) (string, error)

func Worktrees

func Worktrees(root string) string

Types

type FileAccess

type FileAccess uint8
const (
	RestrictedFiles FileAccess = iota
	ManualFiles
)

func FileAccessForRequest

func FileAccessForRequest(request protocol.Request, internal bool) FileAccess

FileAccessForRequest derives controller access from the admitted caller.

type FileGlobs

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

func CompileFileGlobs

func CompileFileGlobs(patterns []string) (*FileGlobs, error)

func (*FileGlobs) Match

func (globs *FileGlobs) Match(relative, scope string) bool

type FileListing

type FileListing struct {
	Entries []FoundFile
	Report  FileWalkReport
}

type FileStamp added in v0.2.3

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

FileStamp identifies a particular regular file and version of its data. A zero stamp is never evidence that two reads have the same contents.

type FileTarget

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

FileTarget retains a publication directory through revision-checked writes.

func (*FileTarget) Close

func (target *FileTarget) Close() error

func (*FileTarget) Write

func (target *FileTarget) Write(source io.Reader, size uint64, revision string) (protocol.FileWritten, error)

type FileWalkReport

type FileWalkReport struct {
	Visited     uint64
	Skipped     uint64
	Truncated   bool
	Partial     bool
	Diagnostics []protocol.SearchDiagnostic
}

type Files

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

Files keeps the registered directory open for every confined operation.

func OpenFiles

func OpenFiles(directory string, access FileAccess) (*Files, error)

func (*Files) BoundedText

func (files *Files) BoundedText(ctx context.Context, relative string, limit int) (*string, error)

BoundedText returns nil when the complete file exceeds the requested limit.

func (*Files) CaptureText

func (files *Files) CaptureText(ctx context.Context, relative, expected string) (string, error)

func (*Files) Close

func (files *Files) Close() error

func (*Files) CollectFiles

func (files *Files) CollectFiles(ctx context.Context, scope string, limit uint64, globs *FileGlobs) (FileListing, error)

func (*Files) CompleteText

func (files *Files) CompleteText(ctx context.Context, relative string) (string, error)

func (*Files) CopyEntry

func (files *Files) CopyEntry(ctx context.Context, from, to string) error

func (*Files) CopyEntryTo

func (files *Files) CopyEntryTo(ctx context.Context, target *Files, from, to string, moving bool) error

func (*Files) CreateDirectory

func (files *Files) CreateDirectory(relative string) error

func (*Files) CreatePrivateDirectories

func (files *Files) CreatePrivateDirectories(relative string) error

CreatePrivateDirectories prepares Node-owned resource storage. It is not an entry action and never runs against a controller-selected destination.

func (*Files) DeleteFile

func (files *Files) DeleteFile(ctx context.Context, relative, revision string) error

func (*Files) FindFiles

func (files *Files) FindFiles(ctx context.Context, patterns []string, scope string, limit, offset uint64) (protocol.FileNames, error)

func (*Files) InspectText added in v0.2.3

func (files *Files) InspectText(ctx context.Context, relative string, limit int, previous FileStamp, inspect func(*string) error) (FileStamp, error)

InspectText skips inspect only if previous proves the contents unchanged. Otherwise inspect receives the bounded text (nil for an oversized file). Its result is usable only after the named file has been checked again.

func (*Files) ListDirectory

func (files *Files) ListDirectory(ctx context.Context, relative string, after *protocol.DirectoryCursor) (protocol.Directory, error)

func (*Files) MoveEntryTo

func (files *Files) MoveEntryTo(ctx context.Context, target *Files, from, to string) error

MoveEntryTo prefers the confined native rename so same-filesystem moves keep identity, timestamps and links; cross-filesystem moves use copy-before-Trash.

func (*Files) MoveFile

func (files *Files) MoveFile(ctx context.Context, from, to, revision string) error

func (*Files) Open

func (files *Files) Open(relative string) (*os.File, error)

func (*Files) PrepareFileTarget

func (files *Files) PrepareFileTarget(ctx context.Context, relative string, expected *string, limit uint64) (*FileTarget, error)

func (*Files) PrepareUploadTarget

func (files *Files) PrepareUploadTarget(ctx context.Context, path string, expected *string, limit uint64) (*FileTarget, error)

PrepareUploadTarget applies the preparation deadline while capturing the destination, then transfers lifetime ownership to the durable publication.

func (*Files) ReadContent

func (files *Files) ReadContent(ctx context.Context, relative string) (protocol.FileContent, error)

func (*Files) ReadLines

func (files *Files) ReadLines(ctx context.Context, relative string, offset, limit uint64, expected *string) (protocol.FileLines, error)

func (*Files) RemoveStoredFile

func (files *Files) RemoveStoredFile(ctx context.Context, relative string) error

RemoveStoredFile collects an unreferenced ordinary profile file. User entry commands continue to use native Trash and revision-bound removal.

func (*Files) RemoveVerified

func (files *Files) RemoveVerified(ctx context.Context, relative, revision, stamp string) error

func (*Files) Rename

func (files *Files) Rename(from, to string) error

Rename moves an entry after the caller has admitted its mutation.

func (*Files) RestoreText

func (files *Files) RestoreText(ctx context.Context, relative, text, expected string) (protocol.FileWritten, error)

func (*Files) Save

func (files *Files) Save(ctx context.Context, relative, text string, expected *string) (protocol.FileWritten, error)

func (*Files) SourceRevision

func (files *Files) SourceRevision(relative string) (string, error)

func (*Files) Trash

func (files *Files) Trash(relative string) error

Trash rechecks the retained scope around a native move to the recovery bin. Native APIs accept paths, so concurrent external writers are not isolated.

func (*Files) ValidatePath

func (files *Files) ValidatePath(relative string, mutation bool) error

func (*Files) VerifySource

func (files *Files) VerifySource(ctx context.Context, relative, revision, stamp string) error

func (*Files) VisitFiles

func (files *Files) VisitFiles(ctx context.Context, scope string, globs *FileGlobs, visitor func(*os.Root, string, string, fs.FileInfo) (bool, error)) (FileWalkReport, error)

type FoundFile

type FoundFile struct {
	Path     string
	Modified time.Time
}

type InvalidProfileError

type InvalidProfileError struct {
	Path   string
	Reason string
}

func (*InvalidProfileError) Error

func (err *InvalidProfileError) Error() string

type Profile

type Profile struct {
	Path string
	// contains filtered or unexported fields
}

Profile holds exclusive Node ownership until Close. Its lock file stays linked.

func AcquireProfile

func AcquireProfile(path string) (*Profile, error)

func (*Profile) Close

func (profile *Profile) Close() error

type ProfileInUseError

type ProfileInUseError struct {
	Path string
}

func (*ProfileInUseError) Error

func (err *ProfileInUseError) Error() string

type WorkerError

type WorkerError struct {
	Err error
}

func (*WorkerError) Error

func (err *WorkerError) Error() string

func (*WorkerError) Unwrap

func (err *WorkerError) Unwrap() error

Jump to

Keyboard shortcuts

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