mirror of
https://github.com/lorsanstand/HomeOps-Hub.git
synced 2026-09-18 17:28:27 +03:00
refactor: sync
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
package command_store
|
||||
|
||||
import (
|
||||
"sync"
|
||||
|
||||
"github.com/lorsanstand/HomeOps-Hub/agent/internal/domain"
|
||||
)
|
||||
|
||||
type CommandStore struct {
|
||||
mutex sync.RWMutex
|
||||
store map[string]*domain.Command
|
||||
}
|
||||
|
||||
func (c *CommandStore) Get(name string) (*domain.Command, bool) {
|
||||
c.mutex.RLock()
|
||||
function, ok := c.store[name]
|
||||
c.mutex.Unlock()
|
||||
return function, ok
|
||||
}
|
||||
Reference in New Issue
Block a user