MCPcopy Index your code
hub / github.com/kovidgoyal/kitty / Serialize

Method Serialize

tools/rsync/algorithm.go:110–125  ·  view source on GitHub ↗
(ans []byte)

Source from the content-addressed store, hash-verified

108}
109
110func (self Operation) Serialize(ans []byte) {
111 switch self.Type {
112 case OpBlock:
113 bin.PutUint64(ans[1:], self.BlockIndex)
114 case OpBlockRange:
115 bin.PutUint64(ans[1:], self.BlockIndex)
116 bin.PutUint32(ans[9:], uint32(self.BlockIndexEnd-self.BlockIndex))
117 case OpHash:
118 bin.PutUint16(ans[1:], uint16(len(self.Data)))
119 copy(ans[3:], self.Data)
120 case OpData:
121 bin.PutUint32(ans[1:], uint32(len(self.Data)))
122 copy(ans[5:], self.Data)
123 }
124 ans[0] = byte(self.Type)
125}
126
127func (self *Operation) Unserialize(data []byte) (n int, err error) {
128 if len(data) < 1 {

Callers 2

send_opMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected