Skip to content

Commit

Permalink
fixup no decodes
Browse files Browse the repository at this point in the history
  • Loading branch information
sanjit-bhat committed Jun 10, 2024
1 parent fc9e472 commit 117bfde
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
12 changes: 6 additions & 6 deletions ktmerkle/rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ type epochHash struct {
}

// rpc: no decode needed.
type putArg struct {
// rpc: invariant: len 32.
id merkle.Id
val merkle.Val
}

type idValEpoch struct {
// rpc: invariant: len 32.
id merkle.Id
val merkle.Val
epoch epochTy
}

type putArg struct {
// rpc: invariant: len 32.
id merkle.Id
val merkle.Val
}

type putReply struct {
epoch epochTy
// rpc: invariant: len 64.
Expand Down
13 changes: 4 additions & 9 deletions ktmerkle/rpc.out.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@ func (o *epochHash) encode() []byte {
b = marshal.WriteBytes(b, o.hash)
return b
}
func (o *putArg) encode() []byte {
func (o *idValEpoch) encode() []byte {
var b = make([]byte, 0)
b = marshal.WriteBytes(b, o.id)
b = marshalutil.WriteSlice1D(b, o.val)
b = marshal.WriteInt(b, o.epoch)
return b
}
func (o *idValEpoch) encode() []byte {
func (o *putArg) encode() []byte {
var b = make([]byte, 0)
b = marshal.WriteBytes(b, o.id)
b = marshalutil.WriteSlice1D(b, o.val)
b = marshal.WriteInt(b, o.epoch)
return b
}
func (o *idValEpoch) decode(b0 []byte) ([]byte, errorTy) {
func (o *putArg) decode(b0 []byte) ([]byte, errorTy) {
var b = b0
id, b, err := marshalutil.SafeReadBytes(b, 32)
if err {
Expand All @@ -36,13 +36,8 @@ func (o *idValEpoch) decode(b0 []byte) ([]byte, errorTy) {
if err {
return nil, err
}
epoch, b, err := marshalutil.SafeReadInt(b)
if err {
return nil, err
}
o.id = id
o.val = val
o.epoch = epoch
return b, errNone
}
func (o *putReply) encode() []byte {
Expand Down

0 comments on commit 117bfde

Please sign in to comment.