Skip to content

Commit ab2c224

Browse files
committed
session: remove session name property
This seems to be completely unused. I believe it is remnant of pre-buildkit session implementation and was used for either logging of some transfer reuse. Signed-off-by: Tonis Tiigi <[email protected]>
1 parent 8a287ce commit ab2c224

File tree

5 files changed

+4
-23
lines changed

5 files changed

+4
-23
lines changed

client/solve.go

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import (
77
"io"
88
"maps"
99
"os"
10-
"path/filepath"
1110
"strings"
1211
"time"
1312

@@ -120,7 +119,7 @@ func (c *Client) solve(ctx context.Context, def *llb.Definition, runGateway runG
120119
if opt.SessionPreInitialized {
121120
return nil, errors.Errorf("no session provided for preinitialized option")
122121
}
123-
s, err = session.NewSession(statusContext, defaultSessionName(), opt.SharedKey)
122+
s, err = session.NewSession(statusContext, opt.SharedKey)
124123
if err != nil {
125124
return nil, errors.Wrap(err, "failed to create session")
126125
}
@@ -419,14 +418,6 @@ func prepareSyncedFiles(def *llb.Definition, localMounts map[string]fsutil.FS) (
419418
return result, nil
420419
}
421420

422-
func defaultSessionName() string {
423-
wd, err := os.Getwd()
424-
if err != nil {
425-
return "unknown"
426-
}
427-
return filepath.Base(wd)
428-
}
429-
430421
type cacheOptions struct {
431422
options controlapi.CacheOptions
432423
contentStores map[string]content.Store // key: ID of content store ("local:" + csDir)

session/content/content_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func TestContentAttachable(t *testing.T) {
4040
}
4141
}
4242

43-
s, err := session.NewSession(ctx, "foo", "bar")
43+
s, err := session.NewSession(ctx, "bar")
4444
require.NoError(t, err)
4545

4646
m, err := session.NewManager()

session/filesync/filesync_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func TestFileSyncIncludePatterns(t *testing.T) {
3030
err = os.WriteFile(filepath.Join(tmpDir, "bar"), []byte("content2"), 0600)
3131
require.NoError(t, err)
3232

33-
s, err := session.NewSession(ctx, "foo", "bar")
33+
s, err := session.NewSession(ctx, "bar")
3434
require.NoError(t, err)
3535

3636
m, err := session.NewManager()

session/manager.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ type Caller interface {
1616
Context() context.Context
1717
Supports(method string) bool
1818
Conn() *grpc.ClientConn
19-
Name() string
2019
SharedKey() string
2120
}
2221

@@ -106,7 +105,6 @@ func (sm *Manager) handleConn(ctx context.Context, conn net.Conn, opts map[strin
106105

107106
h := http.Header(opts)
108107
id := h.Get(headerSessionID)
109-
name := h.Get(headerSessionName)
110108
sharedKey := h.Get(headerSessionSharedKey)
111109

112110
ctx, cc, err := grpcClientConn(ctx, conn)
@@ -118,7 +116,6 @@ func (sm *Manager) handleConn(ctx context.Context, conn net.Conn, opts map[strin
118116
c := &client{
119117
Session: Session{
120118
id: id,
121-
name: name,
122119
sharedKey: sharedKey,
123120
ctx: ctx,
124121
cancelCtx: cancel,
@@ -197,10 +194,6 @@ func (c *client) Context() context.Context {
197194
return c.context()
198195
}
199196

200-
func (c *client) Name() string {
201-
return c.name
202-
}
203-
204197
func (c *client) SharedKey() string {
205198
return c.sharedKey
206199
}

session/session.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ type Attachable interface {
3838
type Session struct {
3939
mu sync.Mutex // synchronizes conn run and close
4040
id string
41-
name string
4241
sharedKey string
4342
ctx context.Context
4443
cancelCtx func(error)
@@ -49,7 +48,7 @@ type Session struct {
4948
}
5049

5150
// NewSession returns a new long running session
52-
func NewSession(ctx context.Context, name, sharedKey string) (*Session, error) {
51+
func NewSession(ctx context.Context, sharedKey string) (*Session, error) {
5352
id := identity.NewID()
5453

5554
serverOpts := []grpc.ServerOption{
@@ -67,7 +66,6 @@ func NewSession(ctx context.Context, name, sharedKey string) (*Session, error) {
6766

6867
s := &Session{
6968
id: id,
70-
name: name,
7169
sharedKey: sharedKey,
7270
grpcServer: grpc.NewServer(serverOpts...),
7371
}
@@ -103,7 +101,6 @@ func (s *Session) Run(ctx context.Context, dialer Dialer) error {
103101

104102
meta := make(map[string][]string)
105103
meta[headerSessionID] = []string{s.id}
106-
meta[headerSessionName] = []string{s.name}
107104
meta[headerSessionSharedKey] = []string{s.sharedKey}
108105

109106
for name, svc := range s.grpcServer.GetServiceInfo() {

0 commit comments

Comments
 (0)