sync: migrate ai-operator to Gitea (2026-08-10)

This commit is contained in:
konturai-ops
2026-08-10 15:26:52 +00:00
commit 53652b95ad
173 changed files with 16676 additions and 0 deletions
+47
View File
@@ -0,0 +1,47 @@
package handoff
import "sync"
type Store struct {
mu sync.RWMutex
requests map[string]HandoffRequest
byCall map[string]string
}
func NewStore() *Store {
return &Store{requests: map[string]HandoffRequest{}, byCall: map[string]string{}}
}
func (s *Store) Put(req HandoffRequest) {
s.mu.Lock()
defer s.mu.Unlock()
s.requests[req.ID] = req
s.byCall[req.CallID] = req.ID
}
func (s *Store) Get(id string) (HandoffRequest, bool) {
s.mu.RLock()
defer s.mu.RUnlock()
req, ok := s.requests[id]
return req, ok
}
func (s *Store) GetByCall(callID string) (HandoffRequest, bool) {
s.mu.RLock()
defer s.mu.RUnlock()
id, ok := s.byCall[callID]
if !ok {
return HandoffRequest{}, false
}
req, ok := s.requests[id]
return req, ok
}
func (s *Store) DeleteByCall(callID string) {
s.mu.Lock()
defer s.mu.Unlock()
if id, ok := s.byCall[callID]; ok {
delete(s.requests, id)
delete(s.byCall, callID)
}
}