aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/app/state
diff options
context:
space:
mode:
Diffstat (limited to 'internal/app/state')
-rw-r--r--internal/app/state/multi.go10
-rw-r--r--internal/app/state/state.go2
2 files changed, 6 insertions, 6 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
diff --git a/internal/app/state/state.go b/internal/app/state/state.go
index 42750ec6..6a3a82db 100644
--- a/internal/app/state/state.go
+++ b/internal/app/state/state.go
@@ -17,7 +17,7 @@ type Store interface {
// Do calls f exactly once and ensures store exclusivity until f returns.
// Returns whether f is called and any errors during the locking process.
// Cursor provided to f becomes invalid as soon as f returns.
- Do(aid int, f func(c Cursor)) (ok bool, err error)
+ Do(identity int, f func(c Cursor)) (ok bool, err error)
// List queries the store and returns a list of aids known to the store.
// Note that some or all returned aids might not have any active apps.