Skip to content

Commit

Permalink
expore reindex as a public interface (#131)
Browse files Browse the repository at this point in the history
  • Loading branch information
poonai committed Mar 7, 2024
1 parent ce80f55 commit 61af08c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions table.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ type TableDeleter[T any] interface {

type TableWriter[T any] interface {
AddIndex(idxs []*Index[T], reIndex ...bool) error
ReIndex(idxs []*Index[T]) error

TableInserter[T]
TableUpdater[T]
Expand Down Expand Up @@ -256,12 +257,12 @@ func (t *_table[T]) AddIndex(idxs []*Index[T], reIndex ...bool) error {
t.mutex.Unlock()

if len(reIndex) > 0 && reIndex[0] {
return t.reindex(idxs)
return t.ReIndex(idxs)
}
return nil
}

func (t *_table[T]) reindex(idxs []*Index[T]) error {
func (t *_table[T]) ReIndex(idxs []*Index[T]) error {
idxsMap := make(map[IndexID]*Index[T])
for _, idx := range idxs {
idxsMap[idx.IndexID] = idx
Expand Down

0 comments on commit 61af08c

Please sign in to comment.