MCPcopy
hub / github.com/docker/docker-agent / sessionStore

Method sessionStore

cmd/root/backend.go:92–107  ·  view source on GitHub ↗

sessionStore returns the backend-owned session store, opening it on first use. The store is shared by the initial runtime and by every runtime spawned by [localBackend.Spawner].

(ctx context.Context, req runtime.CreateSessionRequest)

Source from the content-addressed store, hash-verified

90// first use. The store is shared by the initial runtime and by every
91// runtime spawned by [localBackend.Spawner].
92func (b *localBackend) sessionStore(ctx context.Context, req runtime.CreateSessionRequest) (session.Store, error) {
93 b.storeOnce.Do(func() {
94 sessionDB, err := pathx.ExpandHomeDir(req.SessionDB)
95 if err != nil {
96 b.storeErr = err
97 return
98 }
99 store, err := session.NewSQLiteSessionStore(context.WithoutCancel(ctx), sessionDB)
100 if err != nil {
101 b.storeErr = fmt.Errorf("creating session store: %w", err)
102 return
103 }
104 b.store = store
105 })
106 return b.store, b.storeErr
107}
108
109func (b *localBackend) CreateSession(ctx context.Context, loaded *teamloader.LoadResult, req runtime.CreateSessionRequest) (runtime.Runtime, *session.Session, func(), error) {
110 store, err := b.sessionStore(ctx, req)

Callers 2

CreateSessionMethod · 0.95
ResumeWorkingDirMethod · 0.95

Calls 2

NewSQLiteSessionStoreFunction · 0.92
DoMethod · 0.65

Tested by

no test coverage detected