project

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2026 License: BSD-3-Clause Imports: 11 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

Package project owns project-file storage. V0.1 ships one backend (local filesystem rooted at a configured path) ; V0.2 adds a weft-block backend so per-project volumes mount into compile microVMs without round-tripping through the host filesystem.

The Store interface centralises authorization : every method takes the caller's Identity, and the implementation enforces "can this user see/edit this project". V0.1 policy : project owner subject == identity.Subject OR identity.Groups contains "loom-admin". V0.2 migrates to openweft project ACL via dex groups.

Index

Constants

This section is empty.

Variables

View Source
var ErrAccessDenied = errors.New("project: access denied")

ErrAccessDenied is returned by Store impls when the caller lacks permission. Handlers translate to 403.

Functions

This section is empty.

Types

type File

type File struct {
	Path string `json:"path"`
	Size int64  `json:"size"`
	Dir  bool   `json:"dir"`
}

File is one entry in ListFiles.

type LocalStore

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

LocalStore is the V0.1 backend : projects live under <root>/<owner>/<name>. Owner is identity.Subject ; the subject is sanitised to a safe filesystem name (alphanumeric + dash + underscore) so dex's "subject can be a URL" doesn't escape the root.

func NewLocalStore

func NewLocalStore(root string) *LocalStore

NewLocalStore returns a store rooted at the given absolute path. The directory is created on first write.

func (*LocalStore) List

func (s *LocalStore) List(_ context.Context, ident auth.Identity) ([]Project, error)

func (*LocalStore) ListFiles

func (s *LocalStore) ListFiles(_ context.Context, ident auth.Identity, project string) ([]File, error)

func (*LocalStore) ReadFile

func (s *LocalStore) ReadFile(_ context.Context, ident auth.Identity, project, path string) (io.ReadCloser, error)

func (*LocalStore) WriteFile

func (s *LocalStore) WriteFile(_ context.Context, ident auth.Identity, project, path string, body io.Reader) error

type Project

type Project struct {
	Name      string    `json:"name"`
	Language  string    `json:"language"`
	CreatedAt time.Time `json:"created_at"`
}

Project is the summary returned by List.

type Store

type Store interface {
	List(ctx context.Context, ident auth.Identity) ([]Project, error)
	ListFiles(ctx context.Context, ident auth.Identity, project string) ([]File, error)
	ReadFile(ctx context.Context, ident auth.Identity, project, path string) (io.ReadCloser, error)
	WriteFile(ctx context.Context, ident auth.Identity, project, path string, body io.Reader) error
}

Store is the storage abstraction.

Jump to

Keyboard shortcuts

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