Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
harshil-goel committed Oct 19, 2024
1 parent f294c0e commit b566e13
Show file tree
Hide file tree
Showing 3 changed files with 171 additions and 154 deletions.
3 changes: 2 additions & 1 deletion posting/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -872,7 +872,6 @@ func (l *List) setMutation(startTs uint64, data []byte) {
l.mutationMap = newMutableMap()
}
l.mutationMap.set(startTs, pl)

if pl.CommitTs != 0 {
l.maxTs = x.Max(l.maxTs, pl.CommitTs)
}
Expand Down Expand Up @@ -903,6 +902,7 @@ func (l *List) Iterate(readTs uint64, afterUid uint64, f func(obj *pb.Posting) e
// If greater than zero, this timestamp must thus be greater than l.minTs.
func (l *List) pickPostings(readTs uint64) (uint64, []*pb.Posting) {
// This function would return zero ts for entries above readTs.
// either way, effective ts is returning ts.
effective := func(start, commit uint64) uint64 {
if commit > 0 && commit <= readTs {
// Has been committed and below the readTs.
Expand Down Expand Up @@ -1099,6 +1099,7 @@ func (l *List) getPostingAndLength(readTs, afterUid, uid uint64) (int, bool, *pb
var count int
var found bool
var post *pb.Posting

err := l.iterate(readTs, afterUid, func(p *pb.Posting) error {
if p.Uid == uid {
post = p
Expand Down
5 changes: 3 additions & 2 deletions posting/lists.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,9 @@ func (lc *LocalCache) getInternal(key []byte, readFromDisk bool) (*List, error)
}
} else {
pl = &List{
key: key,
plist: new(pb.PostingList),
key: key,
plist: new(pb.PostingList),
mutationMap: newMutableMap(),
}
}

Expand Down
Loading

0 comments on commit b566e13

Please sign in to comment.