Skip to content

Commit

Permalink
Renamed fields in checker
Browse files Browse the repository at this point in the history
  • Loading branch information
Caio Brandão committed Sep 2, 2021
1 parent 751ffbc commit 9f5beea
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
32 changes: 16 additions & 16 deletions storage/memory/memory.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,12 +226,12 @@ func (m *memory) RemoveTriples(ctx context.Context, ts []*triple.Triple) error {
// checker provides the mechanics to check if a predicate/triple should be
// considered on a certain operation.
type checker struct {
max bool
m int
c int
o *storage.LookupOptions
op *predicate.Predicate
ota *time.Time
max bool
pageSize int
paddedPageSize int
o *storage.LookupOptions
op *predicate.Predicate
ota *time.Time
}

// newChecker creates a new checker for a given LookupOptions configuration.
Expand All @@ -243,12 +243,12 @@ func newChecker(o *storage.LookupOptions, op *predicate.Predicate) *checker {
}
}
return &checker{
max: o.MaxElements > 0,
m: o.MaxElements,
c: o.MaxElements * o.Offset,
o: o,
op: op,
ota: ta,
max: o.MaxElements > 0,
pageSize: o.MaxElements,
paddedPageSize: o.MaxElements * o.Offset,
o: o,
op: op,
ota: ta,
}
}

Expand Down Expand Up @@ -277,15 +277,15 @@ func (c *checker) CheckGlobalTimeBounds(p *predicate.Predicate) bool {
// CheckLimitAndUpdate checks if the internal offset value is reached, if not updates the value,
// and check if the internal page limit is reached, if not updates the value.
func (c *checker) CheckLimitAndUpdate() bool {
if c.max && c.m <= 0 {
if c.max && c.pageSize <= 0 {
return false
}
if c.c > 0 {
c.c--
if c.paddedPageSize > 0 {
c.paddedPageSize--
return false
}

c.m--
c.pageSize--
return true
}

Expand Down
4 changes: 2 additions & 2 deletions storage/memory/memory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,8 @@ func TestObjects(t *testing.T) {
}
}

// Tests the offset field of LookupOptions expecting return all the objects in the same order they appear in
// the triples slice
// Tests the offset field of LookupOptions expecting return all the objects in
// the same order they appear in the triples slice
func TestObjectsOffset(t *testing.T) {
ts, ctx := getTestOffsetTriples(t), context.Background()
g, _ := NewStore().NewGraph(ctx, "test")
Expand Down

0 comments on commit 9f5beea

Please sign in to comment.