vfsapi

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package vfsapi serves the VFS over HTTP: files, folders and the access list that decides who may read and write them.

Routes are registered without a prefix and the host mounts them where it wants them, which is what lets one surface serve an operator's admin API and a user-facing one without a second implementation:

sub := http.NewServeMux()
api.AddRoutes(sub)
mux.Handle("/v1/admin/vfs/", http.StripPrefix("/v1/admin/vfs", sub))

Every request is resolved to a vfs.Actor by the host, and that actor is stamped onto the request context so the access list's callbacks see it: the surface does not invent an identity, and it never consults the access list itself for file reads — the VFS does, per resource.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoActor = errors.New("vfsapi: request carries no actor")

ErrNoActor is what an Authenticator returns when a request carries no identity. It is the only error answered 401; anything else is the authenticator's own failure and is answered 500.

Functions

This section is empty.

Types

type Authenticator

type Authenticator interface {
	Actor(r *http.Request) (vfs.Actor, error)
}

Authenticator resolves a request to the identity it acts as. The host owns this: a relay answers with the signed-in user and their platform role, a local install with the machine's own identity.

type Config

type Config struct {
	// VFS is the store every route reads and writes. Required.
	VFS vfs.Service
	// ACL holds the grants and is what the access-control routes operate on.
	// Optional: without it, per-resource checks do not run and the
	// access-control routes are not mounted — a single-user install has no
	// grants to manage.
	ACL *vfs.ACL
	// Actor resolves the request's identity. Required.
	Actor Authenticator
	// Tracker instruments failures. Nil degrades to a no-op tracker.
	Tracker libtracker.ActivityTracker
}

Config is the surface's whole configuration.

type Service

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

Service is the HTTP surface over one VFS.

func New

func New(cfg Config) (*Service, error)

New builds the surface.

func (*Service) AddRoutes

func (s *Service) AddRoutes(mux *http.ServeMux)

AddRoutes mounts the surface on mux, without a prefix.

Jump to

Keyboard shortcuts

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