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 ¶
- Variables
- type File
- type LocalStore
- func (s *LocalStore) List(_ context.Context, ident auth.Identity) ([]Project, error)
- func (s *LocalStore) ListFiles(_ context.Context, ident auth.Identity, project string) ([]File, error)
- func (s *LocalStore) ReadFile(_ context.Context, ident auth.Identity, project, path string) (io.ReadCloser, error)
- func (s *LocalStore) WriteFile(_ context.Context, ident auth.Identity, project, path string, body io.Reader) error
- type Project
- type Store
Constants ¶
This section is empty.
Variables ¶
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 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.
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.