aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/app/state/multi.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-09-24 13:26:30 +0900
committerOphestra <cat@gensokyo.uk>2025-09-24 13:37:38 +0900
commitb99c63337df4068b36d7d8de2ae79fd274172977 (patch)
tree81d2453857b7d6328db6545f096181b771c24cc3 /internal/app/state/multi.go
parentf09133a224fabf2d16c7790654e39068cb59450f (diff)
internal/app: do not return from shim start
The whole RunState ugliness and the other horrendous error handling conditions for internal/app come from an old design proposal for maintaining all app containers under the same daemon process for a user. The proposal was ultimately rejected but the implementation remained. It is removed here to alleviate internal/app from much of its ugliness and unreadability. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/app/state/multi.go')
-rw-r--r--internal/app/state/multi.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/internal/app/state/multi.go b/internal/app/state/multi.go
index 80a3abff..9a400ac6 100644
--- a/internal/app/state/multi.go
+++ b/internal/app/state/multi.go
@@ -27,27 +27,27 @@ type multiStore struct {
lock sync.RWMutex
}
-func (s *multiStore) Do(aid int, f func(c Cursor)) (bool, error) {
+func (s *multiStore) Do(identity int, f func(c Cursor)) (bool, error) {
s.lock.RLock()
defer s.lock.RUnlock()
// load or initialise new backend
b := new(multiBackend)
b.lock.Lock()
- if v, ok := s.backends.LoadOrStore(aid, b); ok {
+ if v, ok := s.backends.LoadOrStore(identity, b); ok {
b = v.(*multiBackend)
} else {
- b.path = path.Join(s.base, strconv.Itoa(aid))
+ b.path = path.Join(s.base, strconv.Itoa(identity))
// ensure directory
if err := os.MkdirAll(b.path, 0700); err != nil && !errors.Is(err, fs.ErrExist) {
- s.backends.CompareAndDelete(aid, b)
+ s.backends.CompareAndDelete(identity, b)
return false, err
}
// open locker file
if l, err := os.OpenFile(b.path+".lock", os.O_RDWR|os.O_CREATE, 0600); err != nil {
- s.backends.CompareAndDelete(aid, b)
+ s.backends.CompareAndDelete(identity, b)
return false, err
} else {
b.lockfile = l