Skip to content

Commit

Permalink
Merge pull request containerd#11204 from djdongjin/bump-up-ttrpc
Browse files Browse the repository at this point in the history
bump up ttrpc to use its MD.Clone
  • Loading branch information
estesp authored Jan 2, 2025
2 parents c3efa0c + ee63381 commit aff7e2b
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 18 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ require (
github.com/containerd/otelttrpc v0.0.0-20240305015340-ea5083fda723
github.com/containerd/platforms v1.0.0-rc.0
github.com/containerd/plugin v1.0.0
github.com/containerd/ttrpc v1.2.6
github.com/containerd/ttrpc v1.2.7
github.com/containerd/typeurl/v2 v2.2.3
github.com/containerd/zfs/v2 v2.0.0-rc.0
github.com/containernetworking/cni v1.2.3
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -696,8 +696,8 @@ github.com/containerd/platforms v1.0.0-rc.0/go.mod h1:T1XAzzOdYs3it7l073MNXyxRwQ
github.com/containerd/plugin v1.0.0 h1:c8Kf1TNl6+e2TtMHZt+39yAPDbouRH9WAToRjex483Y=
github.com/containerd/plugin v1.0.0/go.mod h1:hQfJe5nmWfImiqT1q8Si3jLv3ynMUIBB47bQ+KexvO8=
github.com/containerd/ttrpc v1.2.2/go.mod h1:sIT6l32Ph/H9cvnJsfXM5drIVzTr5A2flTf1G5tYZak=
github.com/containerd/ttrpc v1.2.6 h1:zG+Kn5EZ6MUYCS1t2Hmt2J4tMVaLSFEJVOraDQwNPC4=
github.com/containerd/ttrpc v1.2.6/go.mod h1:YCXHsb32f+Sq5/72xHubdiJRQY9inL4a4ZQrAbN1q9o=
github.com/containerd/ttrpc v1.2.7 h1:qIrroQvuOL9HQ1X6KHe2ohc7p+HP/0VE6XPU7elJRqQ=
github.com/containerd/ttrpc v1.2.7/go.mod h1:YCXHsb32f+Sq5/72xHubdiJRQY9inL4a4ZQrAbN1q9o=
github.com/containerd/typeurl/v2 v2.2.3 h1:yNA/94zxWdvYACdYO8zofhrTVuQY73fFU1y++dYSw40=
github.com/containerd/typeurl/v2 v2.2.3/go.mod h1:95ljDnPfD3bAbDJRugOiShd/DlAAsxGtUBhJxIn7SCk=
github.com/containerd/zfs/v2 v2.0.0-rc.0 h1:0dRlgpoaepW7HuovtcvYQMF7NlpceQVdn7+3Udeth4M=
Expand Down
10 changes: 1 addition & 9 deletions pkg/namespaces/ttrpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,12 @@ const (
TTRPCHeader = "containerd-namespace-ttrpc"
)

func copyMetadata(src ttrpc.MD) ttrpc.MD {
md := ttrpc.MD{}
for k, v := range src {
md[k] = append(md[k], v...)
}
return md
}

func withTTRPCNamespaceHeader(ctx context.Context, namespace string) context.Context {
md, ok := ttrpc.GetMetadata(ctx)
if !ok {
md = ttrpc.MD{}
} else {
md = copyMetadata(md)
md = md.Clone()
}
md.Set(TTRPCHeader, namespace)
return ttrpc.WithMetadata(ctx, md)
Expand Down
2 changes: 1 addition & 1 deletion pkg/namespaces/ttrpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
func TestCopyTTRPCMetadata(t *testing.T) {
src := ttrpc.MD{}
src.Set("key", "a", "b", "c", "d")
md := copyMetadata(src)
md := src.Clone()

if !reflect.DeepEqual(src, md) {
t.Fatalf("metadata is copied incorrectly")
Expand Down
28 changes: 28 additions & 0 deletions vendor/github.com/containerd/ttrpc/metadata.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 11 additions & 4 deletions vendor/github.com/containerd/ttrpc/server.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ github.com/containerd/platforms
github.com/containerd/plugin
github.com/containerd/plugin/dynamic
github.com/containerd/plugin/registry
# github.com/containerd/ttrpc v1.2.6
# github.com/containerd/ttrpc v1.2.7
## explicit; go 1.19
github.com/containerd/ttrpc
# github.com/containerd/typeurl/v2 v2.2.3
Expand Down

0 comments on commit aff7e2b

Please sign in to comment.