Skip to content

Commit

Permalink
refactor: rename put reply fields. prev names added clutter and didn'…
Browse files Browse the repository at this point in the history
…t help to understand that those openings are for the current epoch
  • Loading branch information
sanjit-bhat committed Jul 24, 2024
1 parent e6e6d1e commit 66eaa05
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions ktmerkle/ktmerkle.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func (s *server) put(id merkle.Id, val merkle.Val) *servPutReply {
info := s.chain.epochs[currEpoch]
s.mu.Unlock()
// TODO: rename this to prevLink and currDig. it's at the current info.
return &servPutReply{putEpoch: currEpoch + 1, prev2Link: info.prevLink, prevDig: info.dig, linkSig: info.linkSig, putSig: putSig, error: errNone}
return &servPutReply{putEpoch: currEpoch + 1, prevLink: info.prevLink, dig: info.dig, linkSig: info.linkSig, putSig: putSig, error: errNone}
}

func (s *server) getIdAt(id merkle.Id, epoch epochTy) *servGetIdAtReply {
Expand Down Expand Up @@ -298,7 +298,7 @@ func (c *client) put(val merkle.Val) (epochTy, *evidServLink, errorTy) {
return 0, nil, reply.error
}

evid, err0 := c.addLink(reply.putEpoch-1, reply.prev2Link, reply.prevDig, reply.linkSig)
evid, err0 := c.addLink(reply.putEpoch-1, reply.prevLink, reply.dig, reply.linkSig)
if err0 {
return 0, evid, err0
}
Expand Down
12 changes: 6 additions & 6 deletions ktmerkle/rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@ type servPutArg struct {
}

type servPutReply struct {
putEpoch epochTy
prev2Link linkTy
prevDig merkle.Digest
linkSig cryptoffi.Sig
putSig cryptoffi.Sig
error errorTy
putEpoch epochTy
prevLink linkTy
dig merkle.Digest
linkSig cryptoffi.Sig
putSig cryptoffi.Sig
error errorTy
}

type servGetIdAtArg struct {
Expand Down
12 changes: 6 additions & 6 deletions ktmerkle/rpc.out.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ func (o *servPutArg) decode(b0 []byte) ([]byte, errorTy) {
func (o *servPutReply) encode() []byte {
var b = make([]byte, 0)
b = marshal.WriteInt(b, o.putEpoch)
b = marshalutil.WriteSlice1D(b, o.prev2Link)
b = marshalutil.WriteSlice1D(b, o.prevDig)
b = marshalutil.WriteSlice1D(b, o.prevLink)
b = marshalutil.WriteSlice1D(b, o.dig)
b = marshalutil.WriteSlice1D(b, o.linkSig)
b = marshalutil.WriteSlice1D(b, o.putSig)
b = marshal.WriteBool(b, o.error)
Expand All @@ -76,11 +76,11 @@ func (o *servPutReply) decode(b0 []byte) ([]byte, errorTy) {
if err {
return nil, err
}
prev2Link, b, err := marshalutil.ReadSlice1D(b)
prevLink, b, err := marshalutil.ReadSlice1D(b)
if err {
return nil, err
}
prevDig, b, err := marshalutil.ReadSlice1D(b)
dig, b, err := marshalutil.ReadSlice1D(b)
if err {
return nil, err
}
Expand All @@ -97,8 +97,8 @@ func (o *servPutReply) decode(b0 []byte) ([]byte, errorTy) {
return nil, err
}
o.putEpoch = putEpoch
o.prev2Link = prev2Link
o.prevDig = prevDig
o.prevLink = prevLink
o.dig = dig
o.linkSig = linkSig
o.putSig = putSig
o.error = error
Expand Down

0 comments on commit 66eaa05

Please sign in to comment.