Documentation
¶
Overview ¶
Package storagetiles implements §2.7 storage tiles: server-scoped shares (nfs/smb) and local pools, consumed through declared sub-paths, each backed by a docker local-driver volume. stackr never mounts anything on the host, docker performs the mount at container start, so shares survive reboots with no fstab and no privileged helper.
Index ¶
- Variables
- func EnsureVolume(ctx context.Context, c *cluster.Cluster, node string, s *repo.Storage, ...) (string, error)
- func Probe(ctx context.Context, c *cluster.Cluster, node string, s *repo.Storage, ...) error
- func Recreate(ctx context.Context, c *cluster.Cluster, node string, s *repo.Storage, ...) error
- func Resolve(ctx context.Context, c *cluster.Cluster, store repo.Store, consumer *repo.Tile, ...) (string, error)
- func ValidBackend(b string) bool
- func ValidateAttach(s *repo.Storage, consumer *repo.Tile) error
- func VolumeOpts(s *repo.Storage, p *repo.StoragePath) (map[string]string, error)
Constants ¶
This section is empty.
Variables ¶
var Backends = []string{"nfs", "smb", "local"}
Backends is the closed set.
var ParseAttachment = placement.ParseAttachment
ParseAttachment decodes one tiles.storage line. It lives in placement so that package can tell which pools a tile attaches without importing this one, which would close a cycle through cluster.
Functions ¶
func EnsureVolume ¶
func EnsureVolume(ctx context.Context, c *cluster.Cluster, node string, s *repo.Storage, p *repo.StoragePath) (string, error)
EnsureVolume creates the sub-path's docker volume with the right driver opts if it doesn't exist yet. A volume that already exists is left alone, docker ignores differing opts on re-create, so edits are Recreate's job. The node comes from the storage's server, not from whoever is calling: a volume is a directory on one host, and creating an nfs mount on the manager when the operator picked a worker leaves the worker without the share it is about to mount, with swarm reporting the task healthy.
func Probe ¶
func Probe(ctx context.Context, c *cluster.Cluster, node string, s *repo.Storage, p *repo.StoragePath) error
Probe mounts the sub-path volume in a throwaway container and lists its root, surfacing bad creds / dead exports / missing local paths at create/edit time instead of at first deploy. Returns nil on success.
func Recreate ¶
func Recreate(ctx context.Context, c *cluster.Cluster, node string, s *repo.Storage, p *repo.StoragePath) error
Recreate drops and recreates the sub-path volume, the §2.7 edit dance (opts are immutable on a docker volume). Fails while consumers hold it.
func Resolve ¶
func Resolve(ctx context.Context, c *cluster.Cluster, store repo.Store, consumer *repo.Tile, line string) (string, error)
Resolve turns one attachment line into a ready bind string, ensuring the backing volume exists and applying forced-ro.
func ValidBackend ¶
func ValidateAttach ¶
ValidateAttach enforces §2.7's state-placement rule: databases live on local-backed storage only, sqlite/postgres over NFS/SMB is a corruption class, so a network share on a managed instance is refused, not warned.
func VolumeOpts ¶
VolumeOpts builds the docker local-driver options for one sub-path.
Types ¶
This section is empty.