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 ¶
- Variables
- func AssistantWorkspace(profile string, binding protocol.PluginConversationBinding) (string, error)
- func CheckFilePath(value string) error
- func ConnectionWorkspace(profile string, resource protocol.ConnectionResource) (string, error)
- func DatabaseFiles(path string) []string
- func DecodeText(data []byte) (string, error)
- func DefaultDataDir() (string, error)
- func ManagedWorkspace(root, profile string) bool
- func PrivateDirectory(path string) error
- func Release() bool
- func SessionWorkspace(profile string, id protocol.SessionID) string
- func Temporary(profile string) (string, error)
- func Worktrees(root string) string
- type FileAccess
- type FileGlobs
- type FileListing
- type FileTarget
- type FileWalkReport
- type Files
- func (files *Files) BoundedText(ctx context.Context, relative string, limit int) (*string, error)
- func (files *Files) CaptureText(ctx context.Context, relative, expected string) (string, error)
- func (files *Files) Close() error
- func (files *Files) CollectFiles(ctx context.Context, scope string, limit uint64, globs *FileGlobs) (FileListing, error)
- func (files *Files) CompleteText(ctx context.Context, relative string) (string, error)
- func (files *Files) CopyEntry(ctx context.Context, from, to string) error
- func (files *Files) CopyEntryTo(ctx context.Context, target *Files, from, to string, moving bool) error
- func (files *Files) CreateDirectory(relative string) error
- func (files *Files) CreatePrivateDirectories(relative string) error
- func (files *Files) DeleteFile(ctx context.Context, relative, revision string) error
- func (files *Files) FindFiles(ctx context.Context, patterns []string, scope string, limit, offset uint64) (protocol.FileNames, error)
- func (files *Files) ListDirectory(ctx context.Context, relative string, after *protocol.DirectoryCursor) (protocol.Directory, error)
- func (files *Files) MoveEntryTo(ctx context.Context, target *Files, from, to string) error
- func (files *Files) MoveFile(ctx context.Context, from, to, revision string) error
- func (files *Files) Open(relative string) (*os.File, error)
- func (files *Files) PrepareFileTarget(ctx context.Context, relative string, expected *string, limit uint64) (*FileTarget, error)
- func (files *Files) PrepareUploadTarget(ctx context.Context, path string, expected *string, limit uint64) (*FileTarget, error)
- func (files *Files) ReadContent(ctx context.Context, relative string) (protocol.FileContent, error)
- func (files *Files) ReadLines(ctx context.Context, relative string, offset, limit uint64, expected *string) (protocol.FileLines, error)
- func (files *Files) RemoveStoredFile(ctx context.Context, relative string) error
- func (files *Files) RemoveVerified(ctx context.Context, relative, revision, stamp string) error
- func (files *Files) Rename(from, to string) error
- func (files *Files) RestoreText(ctx context.Context, relative, text, expected string) (protocol.FileWritten, error)
- func (files *Files) Save(ctx context.Context, relative, text string, expected *string) (protocol.FileWritten, error)
- func (files *Files) SourceRevision(relative string) (string, error)
- func (files *Files) Trash(relative string) error
- func (files *Files) ValidatePath(relative string, mutation bool) error
- func (files *Files) VerifySource(ctx context.Context, relative, revision, stamp string) error
- func (files *Files) VisitFiles(ctx context.Context, scope string, globs *FileGlobs, ...) (FileWalkReport, error)
- type FoundFile
- type InvalidProfileError
- type Profile
- type ProfileInUseError
- type WorkerError
Constants ¶
This section is empty.
Variables ¶
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") )
var ( ErrBinaryText = errors.New("binary content cannot be decoded as text") ErrUnsupportedText = errors.New("text is neither valid UTF-8 nor GB18030") )
var Default = sourceDefault
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 ¶
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 DecodeText ¶
DecodeText preserves UTF-8 and strictly decodes the supported GB18030 fallback.
func DefaultDataDir ¶
DefaultDataDir resolves the profile location without creating or opening it.
func ManagedWorkspace ¶
ManagedWorkspace accepts an exact registered root, never one of its descendants.
func PrivateDirectory ¶
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 ¶
type FileListing ¶
type FileListing struct {
Entries []FoundFile
Report FileWalkReport
}
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 Files ¶
type Files struct {
// contains filtered or unexported fields
}
Files keeps the registered directory open for every confined operation.
func (*Files) BoundedText ¶
BoundedText returns nil when the complete file exceeds the requested limit.
func (*Files) CaptureText ¶
func (*Files) CollectFiles ¶
func (*Files) CompleteText ¶
func (*Files) CopyEntryTo ¶
func (*Files) CreateDirectory ¶
func (*Files) CreatePrivateDirectories ¶
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) ListDirectory ¶
func (*Files) MoveEntryTo ¶
MoveEntryTo prefers the confined native rename so same-filesystem moves keep identity, timestamps and links; cross-filesystem moves use copy-before-Trash.
func (*Files) PrepareFileTarget ¶
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) RemoveStoredFile ¶
RemoveStoredFile collects an unreferenced ordinary profile file. User entry commands continue to use native Trash and revision-bound removal.
func (*Files) RemoveVerified ¶
func (*Files) RestoreText ¶
func (*Files) Trash ¶
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) VerifySource ¶
type InvalidProfileError ¶
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 ¶
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
Source Files
¶
- error.go
- files.go
- files_collection.go
- files_copy.go
- files_directory.go
- files_ignores.go
- files_inspection.go
- files_lines.go
- files_linux.go
- files_move_entry.go
- files_move_unix.go
- files_private_directories.go
- files_save.go
- files_text.go
- files_unix.go
- files_upload.go
- files_version.go
- files_walk.go
- profile.go
- profile_unix.go
- trash.go
- trash_linux.go
- workspaces.go