system: unexport Op implementations
All checks were successful
Test / Create distribution (push) Successful in 52s
Test / Sandbox (push) Successful in 3m30s
Test / Hakurei (push) Successful in 5m40s
Test / Sandbox (race detector) (push) Successful in 6m30s
Test / Hpkg (push) Successful in 7m21s
Test / Hakurei (race detector) (push) Successful in 3m22s
Test / Flake checks (push) Successful in 2m2s

None of these are valid with their zero value, and the implementations assume they are created by the builder methods. They are by all means an implementation detail and exporting them makes no sense.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2025-09-06 16:16:03 +09:00
parent ac81cfbedc
commit e68db7fbfc
12 changed files with 157 additions and 157 deletions

View File

@@ -9,16 +9,16 @@ import (
"hakurei.app/system/wayland"
)
// Wayland appends [WaylandOp] to [I].
// Wayland maintains a wayland socket with security-context-v1 attached via [wayland].
// The socket stops accepting connections once the pipe referred to by sync is closed.
// The socket is pathname only and is destroyed on revert.
func (sys *I) Wayland(syncFd **os.File, dst, src, appID, instanceID string) *I {
sys.ops = append(sys.ops, &WaylandOp{syncFd, dst, src, appID, instanceID, wayland.Conn{}})
sys.ops = append(sys.ops, &waylandOp{syncFd, dst, src, appID, instanceID, wayland.Conn{}})
return sys
}
// WaylandOp maintains a wayland socket with security-context-v1 attached via [wayland].
// The socket stops accepting connections once the pipe referred to by sync is closed.
// The socket is pathname only and is destroyed on revert.
type WaylandOp struct {
// waylandOp implements [I.Wayland].
type waylandOp struct {
sync **os.File
dst, src string
appID, instanceID string
@@ -26,9 +26,9 @@ type WaylandOp struct {
conn wayland.Conn
}
func (w *WaylandOp) Type() Enablement { return Process }
func (w *waylandOp) Type() Enablement { return Process }
func (w *WaylandOp) apply(sys *I) error {
func (w *waylandOp) apply(sys *I) error {
if w.sync == nil {
// this is a misuse of the API; do not return a wrapped error
return errors.New("invalid sync")
@@ -58,7 +58,7 @@ func (w *WaylandOp) apply(sys *I) error {
}
}
func (w *WaylandOp) revert(_ *I, ec *Criteria) error {
func (w *waylandOp) revert(_ *I, ec *Criteria) error {
if ec.hasType(w.Type()) {
msg.Verbosef("removing wayland socket on %q", w.dst)
if err := os.Remove(w.dst); err != nil && !errors.Is(err, os.ErrNotExist) {
@@ -73,12 +73,12 @@ func (w *WaylandOp) revert(_ *I, ec *Criteria) error {
}
}
func (w *WaylandOp) Is(o Op) bool {
target, ok := o.(*WaylandOp)
func (w *waylandOp) Is(o Op) bool {
target, ok := o.(*waylandOp)
return ok && w != nil && target != nil &&
w.dst == target.dst && w.src == target.src &&
w.appID == target.appID && w.instanceID == target.instanceID
}
func (w *WaylandOp) Path() string { return w.dst }
func (w *WaylandOp) String() string { return fmt.Sprintf("wayland socket at %q", w.dst) }
func (w *waylandOp) Path() string { return w.dst }
func (w *waylandOp) String() string { return fmt.Sprintf("wayland socket at %q", w.dst) }