-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
protobuf: add vtproto to supplement protobuf marshaling
This adds the vtproto generator to generate code that results in faster marshaling and unmarshaling. vtproto is similar to gogo but it generates additional code on top of the existing protobuf structures rather than changing the generator itself. Signed-off-by: Jonathan A. Sternberg <[email protected]>
- Loading branch information
1 parent
e98dfb6
commit f653bda
Showing
15 changed files
with
1,775 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,19 @@ | ||
package types | ||
|
||
import ( | ||
"os" | ||
|
||
"google.golang.org/protobuf/proto" | ||
) | ||
import "os" | ||
|
||
func (s *Stat) IsDir() bool { | ||
return os.FileMode(s.Mode).IsDir() | ||
} | ||
|
||
func (s *Stat) Marshal() ([]byte, error) { | ||
return proto.MarshalOptions{Deterministic: true}.Marshal(s) | ||
return s.MarshalVTStrict() | ||
} | ||
|
||
func (s *Stat) Unmarshal(dAtA []byte) error { | ||
return proto.UnmarshalOptions{Merge: true}.Unmarshal(dAtA, s) | ||
return s.UnmarshalVT(dAtA) | ||
} | ||
|
||
func (s *Stat) Clone() *Stat { | ||
clone := &Stat{ | ||
Path: s.Path, | ||
Mode: s.Mode, | ||
Uid: s.Uid, | ||
Gid: s.Gid, | ||
Size: s.Size, | ||
ModTime: s.ModTime, | ||
Linkname: s.Linkname, | ||
Devmajor: s.Devmajor, | ||
Devminor: s.Devminor, | ||
} | ||
if s.Xattrs != nil { | ||
s.Xattrs = make(map[string][]byte, len(s.Xattrs)) | ||
for k, v := range s.Xattrs { | ||
clone.Xattrs[k] = v | ||
} | ||
} | ||
return clone | ||
return s.CloneVT() | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.