-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
80fb0f2
commit 4115e26
Showing
18 changed files
with
172 additions
and
122 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,55 @@ | ||
//-------------------------------------- | ||
// This file is autogenerated by grackle | ||
// DO NOT MANUALLY EDIT THIS FILE | ||
//-------------------------------------- | ||
|
||
package put_gk | ||
|
||
import ( | ||
"github.com/tchajed/marshal" | ||
) | ||
|
||
type S struct { | ||
OpId uint64 | ||
Key string | ||
Val string | ||
} | ||
|
||
func (p *S) approxSize() uint64 { | ||
return 0 | ||
OpId uint64 | ||
Key string | ||
Value string | ||
} | ||
|
||
func Marshal(p *S, prefix []byte) []byte { | ||
func Marshal(p S, prefix []byte) []byte { | ||
var enc = prefix | ||
|
||
enc = marshal.WriteInt(enc, p.OpId) | ||
keyBytes := []byte(p.Key) | ||
enc = marshal.WriteInt(enc, uint64(len(keyBytes))) | ||
enc = marshal.WriteBytes(enc, keyBytes) | ||
valBytes := []byte(p.Val) | ||
enc = marshal.WriteInt(enc, uint64(len(valBytes))) | ||
enc = marshal.WriteBytes(enc, valBytes) | ||
valueBytes := []byte(p.Value) | ||
enc = marshal.WriteInt(enc, uint64(len(valueBytes))) | ||
enc = marshal.WriteBytes(enc, valueBytes) | ||
|
||
return enc | ||
} | ||
|
||
func Unmarshal(s []byte) (*S, []byte) { | ||
p := new(S) | ||
func Unmarshal(s []byte) (S, []byte) { | ||
var enc = s // Needed for goose compatibility | ||
var opId uint64 | ||
var key string | ||
var value string | ||
|
||
p.OpId, enc = marshal.ReadInt(enc) | ||
opId, enc = marshal.ReadInt(enc) | ||
var keyLen uint64 | ||
var keyBytes []byte | ||
keyLen, enc = marshal.ReadInt(enc) | ||
keyBytes, enc = marshal.ReadBytesCopy(enc, keyLen) | ||
p.Key = string(keyBytes) | ||
var valLen uint64 | ||
var valBytes []byte | ||
valLen, enc = marshal.ReadInt(enc) | ||
valBytes, enc = marshal.ReadBytesCopy(enc, valLen) | ||
p.Val = string(valBytes) | ||
|
||
return p, enc | ||
key = string(keyBytes) | ||
var valueLen uint64 | ||
var valueBytes []byte | ||
valueLen, enc = marshal.ReadInt(enc) | ||
valueBytes, enc = marshal.ReadBytesCopy(enc, valueLen) | ||
value = string(valueBytes) | ||
|
||
return S{ | ||
OpId: opId, | ||
Key: key, | ||
Value: value, | ||
}, enc | ||
} |
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
Oops, something went wrong.