rename sessionStore field to sessionMgr

This commit is contained in:
Levi Neely 2026-05-19 17:34:14 +02:00
parent 60d140acba
commit 4faa341558
1 changed files with 10 additions and 10 deletions

View File

@ -170,7 +170,7 @@ type Server struct {
utilStore Store utilStore Store
pluginStore Store pluginStore Store
skillStore Store skillStore Store
sessionStore *SessionManager sessionMgr *SessionManager
transcriptStore Store transcriptStore Store
tmpStore Store tmpStore Store
rootStore *store.DirStore rootStore *store.DirStore
@ -215,7 +215,7 @@ func New(sink *olog.Sink, opts ...ServerOption) *Server {
for _, o := range opts { for _, o := range opts {
o(s) o(s)
} }
s.sessionStore = store.NewSessionManager(store.SessionManagerConfig{ s.sessionMgr = store.NewSessionManager(store.SessionManagerConfig{
AgentsDir: agentsDir, AgentsDir: agentsDir,
SessionsDir: sessionsDir, SessionsDir: sessionsDir,
Log: s.log, Log: s.log,
@ -262,7 +262,7 @@ func (s *Server) storeRoutes() []storeRoute {
{"/a/", func() Store { return s.agentStore }}, {"/a/", func() Store { return s.agentStore }},
{"/p/", func() Store { return s.promptStore }}, {"/p/", func() Store { return s.promptStore }},
{"/m/", func() Store { return s.memStore }}, {"/m/", func() Store { return s.memStore }},
{"/s/", func() Store { return s.sessionStore.Store() }}, {"/s/", func() Store { return s.sessionMgr.Store() }},
{"/sk/", func() Store { return s.skillStore }}, {"/sk/", func() Store { return s.skillStore }},
{"/u/", func() Store { return s.utilStore }}, {"/u/", func() Store { return s.utilStore }},
{"/x/", func() Store { return s.pluginStore }}, {"/x/", func() Store { return s.pluginStore }},
@ -343,7 +343,7 @@ func (s *Server) fileOwnerGroup(path string) (uid, gid string) {
if strings.HasPrefix(path, "/s/") { if strings.HasPrefix(path, "/s/") {
parts := strings.SplitN(strings.TrimPrefix(path, "/s/"), "/", 2) parts := strings.SplitN(strings.TrimPrefix(path, "/s/"), "/", 2)
if len(parts) >= 1 && parts[0] != "new" && !isSessionManagerFile(path) { if len(parts) >= 1 && parts[0] != "new" && !isSessionManagerFile(path) {
if sess := s.sessionStore.Session(parts[0]); sess != nil { if sess := s.sessionMgr.Session(parts[0]); sess != nil {
return sess.Uname(), "agent" return sess.Uname(), "agent"
} }
} }
@ -646,7 +646,7 @@ func (s *Server) attach(cs *connState, fc *plan9.Fcall) *plan9.Fcall {
s.log.Debug("Tattach uname=%q", fc.Uname) s.log.Debug("Tattach uname=%q", fc.Uname)
// Assign group membership based on whether uname is a session principal. // Assign group membership based on whether uname is a session principal.
if fc.Uname != "" { if fc.Uname != "" {
if s.sessionStore.SessionByUname(fc.Uname) != nil { if s.sessionMgr.SessionByUname(fc.Uname) != nil {
s.AddGroup("agent", fc.Uname) s.AddGroup("agent", fc.Uname)
} else { } else {
s.AddGroup("user", fc.Uname) s.AddGroup("user", fc.Uname)
@ -1038,12 +1038,12 @@ func (s *Server) handleWrite(path, input, uname string) error {
// Shutdown kills all active sessions and batch jobs. // Shutdown kills all active sessions and batch jobs.
func (s *Server) Shutdown() { func (s *Server) Shutdown() {
s.sessionStore.Shutdown() s.sessionMgr.Shutdown()
} }
// InterruptAll cancels any in-progress agent turn on every active session. // InterruptAll cancels any in-progress agent turn on every active session.
func (s *Server) InterruptAll() { func (s *Server) InterruptAll() {
s.sessionStore.InterruptAll() s.sessionMgr.InterruptAll()
} }
// readDir serializes directory entries for the given path, respecting offset and count. // readDir serializes directory entries for the given path, respecting offset and count.
@ -1222,7 +1222,7 @@ func (s *Server) makeStat(path string) plan9.Dir {
if strings.HasPrefix(path, "/s/") { if strings.HasPrefix(path, "/s/") {
parts := strings.SplitN(strings.TrimPrefix(path, "/"), "/", 3) parts := strings.SplitN(strings.TrimPrefix(path, "/"), "/", 3)
if len(parts) == 3 && parts[0] == "s" { if len(parts) == 3 && parts[0] == "s" {
if sess := s.sessionStore.Session(parts[1]); sess != nil { if sess := s.sessionMgr.Session(parts[1]); sess != nil {
if base == "chat" { if base == "chat" {
length, vers := sess.LogInfo() length, vers := sess.LogInfo()
dir.Length = uint64(length) dir.Length = uint64(length)
@ -1246,7 +1246,7 @@ func (s *Server) makeStat(path string) plan9.Dir {
if dir.Length == 0 && !isDir { if dir.Length == 0 && !isDir {
switch { switch {
case isSessionManagerFile(path): case isSessionManagerFile(path):
if content, err := storeRead(s.sessionStore.Store(), base); err == nil { if content, err := storeRead(s.sessionMgr.Store(), base); err == nil {
dir.Length = uint64(len(content)) dir.Length = uint64(len(content))
} }
case path == "/backends": case path == "/backends":
@ -1296,7 +1296,7 @@ func (s *Server) makeStat(path string) plan9.Dir {
} }
case strings.HasPrefix(path, "/s/"): case strings.HasPrefix(path, "/s/"):
name := strings.TrimPrefix(path, "/s/") name := strings.TrimPrefix(path, "/s/")
if info, err := s.sessionStore.Store().Stat(name); err == nil { if info, err := s.sessionMgr.Store().Stat(name); err == nil {
dir.Length = uint64(info.Size()) dir.Length = uint64(info.Size())
} }
} }