-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jesse Schmidt
committed
Jun 18, 2024
1 parent
3880ef4
commit bc226ce
Showing
22 changed files
with
716 additions
and
340 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/docker/config/features.conf | ||
features.conf | ||
/bin/* | ||
embed_*.go | ||
/tmp | ||
|
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package flags | ||
|
||
import ( | ||
"fmt" | ||
|
||
commonFlags "github.com/aerospike/tools-common-go/flags" | ||
"github.com/spf13/pflag" | ||
) | ||
|
||
type ClientFlags struct { | ||
Host *HostPortFlag | ||
Seeds *SeedsSliceFlag | ||
ListenerName StringOptionalFlag | ||
TLSFlags | ||
} | ||
|
||
func NewClientFlags() *ClientFlags { | ||
return &ClientFlags{ | ||
Host: NewDefaultHostPortFlag(), | ||
Seeds: &SeedsSliceFlag{}, | ||
TLSFlags: *NewTLSFlags(), | ||
} | ||
} | ||
|
||
func (cf *ClientFlags) NewClientFlagSet() *pflag.FlagSet { | ||
flagSet := &pflag.FlagSet{} | ||
flagSet.VarP(cf.Host, Host, "h", commonFlags.DefaultWrapHelpString(fmt.Sprintf("The AVS host to connect to. If cluster discovery is needed use --%s", Seeds))) //nolint:lll // For readability | ||
flagSet.Var(cf.Seeds, Seeds, commonFlags.DefaultWrapHelpString(fmt.Sprintf("The AVS seeds to use for cluster discovery. If no cluster discovery is needed (i.e. load-balancer) then use --%s", Host))) //nolint:lll // For readability | ||
flagSet.VarP(&cf.ListenerName, ListenerName, "l", commonFlags.DefaultWrapHelpString("The listener to ask the AVS server for as configured in the AVS server. Likely required for cloud deployments.")) | ||
|
||
flagSet.AddFlagSet(cf.NewTLSFlagSet(commonFlags.DefaultWrapHelpString)) | ||
|
||
return flagSet | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package flags | ||
|
||
const ( | ||
LogLevel = "log-level" | ||
Seeds = "seeds" | ||
Host = "host" | ||
ListenerName = "listener-name" | ||
Namespace = "namespace" | ||
Sets = "sets" | ||
IndexName = "index-name" | ||
VectorField = "vector-field" | ||
Dimension = "dimension" | ||
DistanceMetric = "distance-metric" | ||
IndexMeta = "index-meta" | ||
Timeout = "timeout" | ||
Verbose = "verbose" | ||
StorageNamespace = "storage-namespace" | ||
StorageSet = "storage-set" | ||
MaxEdges = "hnsw-max-edges" | ||
ConstructionEf = "hnsw-ef-construction" | ||
Ef = "hnsw-ef" | ||
BatchMaxRecords = "hnsw-batch-max-records" | ||
BatchInterval = "hnsw-batch-interval" | ||
BatchEnabled = "hnsw-batch-enabled" | ||
TLSProtocols = "tls-protocols" | ||
TLSCaFile = "tls-cafile" | ||
TLSCaPath = "tls-capath" | ||
TLSCertFile = "tls-certfile" | ||
TLSKeyFile = "tls-keyfile" | ||
TLSKeyFilePass = "tls-keyfile-password" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
//go:build unit | ||
|
||
package cmd | ||
|
||
import ( | ||
"asvec/cmd/flags" | ||
"testing" | ||
|
||
avs "github.com/aerospike/aerospike-proximus-client-go" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestParseBothHostSeedsFlag(t *testing.T) { | ||
testCases := []struct { | ||
seeds *flags.SeedsSliceFlag | ||
host *flags.HostPortFlag | ||
expectedSlice avs.HostPortSlice | ||
expectedIsLoadBalancer bool | ||
}{ | ||
{ | ||
&flags.SeedsSliceFlag{ | ||
Seeds: avs.HostPortSlice{ | ||
avs.NewHostPort("1.1.1.1", 5000, false), | ||
}, | ||
}, | ||
flags.NewDefaultHostPortFlag(), | ||
avs.HostPortSlice{ | ||
avs.NewHostPort("1.1.1.1", 5000, false), | ||
}, | ||
false, | ||
}, | ||
{ | ||
&flags.SeedsSliceFlag{ | ||
Seeds: avs.HostPortSlice{}, | ||
}, | ||
flags.NewDefaultHostPortFlag(), | ||
avs.HostPortSlice{ | ||
&flags.NewDefaultHostPortFlag().HostPort, | ||
}, | ||
true, | ||
}, | ||
} | ||
|
||
for _, tc := range testCases { | ||
actualSlice, actualBool := parseBothHostSeedsFlag(tc.seeds, tc.host) | ||
assert.Equal(t, tc.expectedSlice, actualSlice) | ||
assert.Equal(t, tc.expectedIsLoadBalancer, actualBool) | ||
} | ||
} |
Oops, something went wrong.