Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deepsource: RVV-B0001 confusing naming of struct fields or methods #1844

Merged
8 changes: 4 additions & 4 deletions hack/benchmark/assets/x1b/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ type ivecs struct {
*file
}

func open(fname string, elementSize int) (f *file, err error) {
func doOpen(fname string, elementSize int) (f *file, err error) {
fp, err := os.Open(fname)
if err != nil {
return nil, err
Expand Down Expand Up @@ -164,23 +164,23 @@ func (iv *ivecs) Load(i int) (interface{}, error) {
}

func NewUint8Vectors(fname string) (Uint8Vectors, error) {
f, err := open(fname, 1)
f, err := doOpen(fname, 1)
if err != nil {
return nil, err
}
return &bvecs{f}, nil
}

func NewFloatVectors(fname string) (FloatVectors, error) {
f, err := open(fname, 4)
f, err := doOpen(fname, 4)
if err != nil {
return nil, err
}
return &fvecs{f}, nil
}

func NewInt32Vectors(fname string) (Int32Vectors, error) {
f, err := open(fname, 4)
f, err := doOpen(fname, 4)
if err != nil {
return nil, err
}
Expand Down
4 changes: 2 additions & 2 deletions hack/benchmark/assets/x1b/loader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"github.com/vdaas/vald/internal/test/goleak"
)

func Test_open(t *testing.T) {
func Test_doOpen(t *testing.T) {
t.Parallel()
type args struct {
fname string
Expand Down Expand Up @@ -94,7 +94,7 @@ func Test_open(t *testing.T) {
checkFunc = defaultCheckFunc
}

gotF, err := open(test.args.fname, test.args.elementSize)
gotF, err := doOpen(test.args.fname, test.args.elementSize)
if err := checkFunc(test.want, gotF, err); err != nil {
tt.Errorf("error = %v", err)
}
Expand Down
10 changes: 3 additions & 7 deletions internal/db/rdb/mysql/mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,8 @@ func (m *mySQLClient) SetVectors(ctx context.Context, vecs ...Vector) error {
return tx.Commit()
}

func (m *mySQLClient) deleteVector(ctx context.Context, val string) error {
// DeleteVector deletes vector data from backup_vector table and podIPs from pod_ip table using vector's uuid.
func (m *mySQLClient) DeleteVector(ctx context.Context, val string) error {
if !m.connected.Load().(bool) {
return errors.ErrMySQLConnectionClosed
}
Expand Down Expand Up @@ -432,15 +433,10 @@ func (m *mySQLClient) deleteVector(ctx context.Context, val string) error {
return tx.Commit()
}

// DeleteVector deletes vector data from backup_vector table and podIPs from pod_ip table using vector's uuid.
func (m *mySQLClient) DeleteVector(ctx context.Context, uuid string) error {
return m.deleteVector(ctx, uuid)
}

// DeleteVectors is the same as DeleteVector() but it deletes multiple records.
func (m *mySQLClient) DeleteVectors(ctx context.Context, uuids ...string) (err error) {
for _, uuid := range uuids {
err = m.deleteVector(ctx, uuid)
err = m.DeleteVector(ctx, uuid)
if err != nil {
return err
}
Expand Down
Loading