workspace

package
v0.8.3 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrWorkspaceLocked = errors.New("workspace locked by another process")
)
View Source
var (
	PathSep = string(filepath.Separator)
)

Functions

func CleanPath added in v0.7.0

func CleanPath(path string) string

CleanPath returns a path with leading and trailing slashes removed

func IsOwner added in v0.7.0

func IsOwner(path string, user string) bool

IsOwner checks if the user is the owner of the path The underlying assumption here is that owner is the prefix of the path

func IsValidPath added in v0.7.0

func IsValidPath(path string) bool

IsValidPath checks if the path is a valid datasite path i.e. must start with a datasite email followed by a slash

func NormPath

func NormPath(path string) string

NormPath normalizes a path by cleaning it, replacing backslashes with slashes, and trimming leading slashes

Types

type Workspace

type Workspace struct {
	Owner         string
	Root          string
	AppsDir       string
	DatasitesDir  string
	MetadataDir   string
	LogsDir       string
	UserDir       string
	UserPublicDir string
	// contains filtered or unexported fields
}

func NewWorkspace

func NewWorkspace(rootDir string, user string) (*Workspace, error)

func (*Workspace) DatasiteAbsPath

func (w *Workspace) DatasiteAbsPath(relPath string) string

DatasiteAbsPath returns the absolute path to the datasite directory

func (*Workspace) DatasiteRelPath

func (w *Workspace) DatasiteRelPath(absPath string) (string, error)

DatasiteRelPath returns the relative path of a datasite from the workspace's datasites directory

func (*Workspace) IsValidPath added in v0.7.0

func (w *Workspace) IsValidPath(path string) bool

func (*Workspace) Lock

func (w *Workspace) Lock() error

func (*Workspace) PathOwner

func (w *Workspace) PathOwner(path string) string

PathOwner returns the owner of the path

func (*Workspace) Setup

func (w *Workspace) Setup() error

func (*Workspace) Unlock

func (w *Workspace) Unlock() error

Jump to

Keyboard shortcuts

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