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 DropOrgShareVolumes(ctx context.Context, c *cluster.Cluster, s *repo.Storage) error
- func EnsureVolume(ctx context.Context, c *cluster.Cluster, node, name string, s *repo.Storage, ...) (string, error)
- func Probe(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, subpath string) (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 DropOrgShareVolumes ¶ added in v0.2.0
DropOrgShareVolumes removes every sub-path volume of an org share on every ready node, the org share's edit dance: opts are immutable on a docker volume, and the next deploy of each consumer recreates its volume with the new ones. Docker refuses to remove a volume a container still mounts, so this fails while consumers run, and the caller must not save the edit.
func EnsureVolume ¶
func EnsureVolume(ctx context.Context, c *cluster.Cluster, node, name string, s *repo.Storage, subpath string) (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.
name is repo.StorageVolume for a declared path, repo.OrgShareVolume for an org share's sub-path.
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 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.
Types ¶
This section is empty.