Skip to content

Conversation

@yb01
Copy link
Collaborator

@yb01 yb01 commented Jun 10, 2022

code-level reuse the serializer package from the apimachinery/serializer package.
the heavy meta data, such as multiple type, versioning conversion in the serializer package has been removed.

@yb01 yb01 requested review from Sindica, q131172019 and sonyafenge and removed request for Sindica and sonyafenge June 10, 2022 04:32
@@ -0,0 +1,171 @@
/*
Copyright 2015 The Kubernetes Authors.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand the file was copied from Arktos. But the copyright header here looks a bit strange since all others do not have the header.

Identifier() Identifier
}

//// MemoryAllocator is responsible for allocating memory.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A lot of code commented out. Can those be simply deleted?

//type lengthDelimitedFramer struct{}
//
//// NewFrameWriter implements stream framing for this serializer
//func (lengthDelimitedFramer) NewFrameWriter(w io.Writer) io.Writer {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why FrameWriter here was commented?

wr := apiTypes.WatchRequest{}

err = json.Unmarshal(body, wr)
r, err := s.Decode(body, wr)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you tested protobuf encoding/decoding object as map index?

actualNodes := make([]types.LogicalNode, 0)
decNodes := make([]types.LogicalNode, 0)

dec := json.NewDecoder(recorder.Body)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here only test Json as client, right? Any plan for protobuf client test?


type Installer struct {
dist di.Interface
js serializer.Serializer
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

names and types are confusing. Can you make the name more self explainable or change the type?

content := req.Header.Get("Content-Type")
if content == "application/json" {
desiredSerializer = i.js
} else {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default to protobuf does not seem right


// Write writes a single frame to the nested writer, prepending it with the length in
// in bytes of data (as a 4 byte, bigendian uint32).
func (w *lengthDelimitedFrameWriter) Write(data []byte) (int, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When you have time, can you make a quick introduction to the framer? Many thanks!

@yb01
Copy link
Collaborator Author

yb01 commented Jun 14, 2022

put this PR on hold for now and to focus on the end to end test effort first.

@yb01
Copy link
Collaborator Author

yb01 commented Aug 30, 2022

close this PR. new PR #107 has the changes

@yb01 yb01 closed this Aug 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants