Skip to content

Commit b56ae7d

Browse files
committed
a
1 parent e1abbf7 commit b56ae7d

13 files changed

Lines changed: 122 additions & 121 deletions

File tree

.golangci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# limitations under the License.
1515
#
1616
run:
17-
deadline: 30m
17+
timeout: 30m
1818
skip-dirs:
1919
- (^|/)apis($|/)
2020
- (^|/)hack/benchmark($|/)
@@ -122,6 +122,7 @@ linters:
122122
# - whitespace
123123
# - wrapcheck
124124
# - wslissues:
125+
issues:
125126
exclude-use-default: false
126127
exclude-rules:
127128
- path: _test\.go

internal/config/blob.go

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -67,45 +67,45 @@ type Blob struct {
6767

6868
// S3Config represents S3Config configuration.
6969
type S3Config struct {
70-
Endpoint string `json:"endpoint" yaml:"endpoint"`
71-
Region string `json:"region" yaml:"region"`
72-
AccessKey string `json:"access_key" yaml:"access_key"`
70+
Endpoint string `json:"endpoint" yaml:"endpoint"`
71+
Region string `json:"region" yaml:"region"`
72+
AccessKey string `json:"access_key" yaml:"access_key"`
7373
SecretAccessKey string `json:"secret_access_key" yaml:"secret_access_key"`
74-
Token string `json:"token" yaml:"token"`
75-
76-
MaxRetries int `json:"max_retries" yaml:"max_retries"`
77-
ForcePathStyle bool `json:"force_path_style" yaml:"force_path_style"`
78-
UseAccelerate bool `json:"use_accelerate" yaml:"use_accelerate"`
79-
UseARNRegion bool `json:"use_arn_region" yaml:"use_arn_region"`
80-
UseDualStack bool `json:"use_dual_stack" yaml:"use_dual_stack"`
81-
EnableSSL bool `json:"enable_ssl" yaml:"enable_ssl"`
82-
EnableParamValidation bool `json:"enable_param_validation" yaml:"enable_param_validation"`
83-
Enable100Continue bool `json:"enable_100_continue" yaml:"enable_100_continue"`
74+
Token string `json:"token" yaml:"token"`
75+
76+
MaxRetries int `json:"max_retries" yaml:"max_retries"`
77+
ForcePathStyle bool `json:"force_path_style" yaml:"force_path_style"`
78+
UseAccelerate bool `json:"use_accelerate" yaml:"use_accelerate"`
79+
UseARNRegion bool `json:"use_arn_region" yaml:"use_arn_region"`
80+
UseDualStack bool `json:"use_dual_stack" yaml:"use_dual_stack"`
81+
EnableSSL bool `json:"enable_ssl" yaml:"enable_ssl"`
82+
EnableParamValidation bool `json:"enable_param_validation" yaml:"enable_param_validation"`
83+
Enable100Continue bool `json:"enable_100_continue" yaml:"enable_100_continue"`
8484
EnableContentMD5Validation bool `json:"enable_content_md5_validation" yaml:"enable_content_md5_validation"`
85-
EnableEndpointDiscovery bool `json:"enable_endpoint_discovery" yaml:"enable_endpoint_discovery"`
86-
EnableEndpointHostPrefix bool `json:"enable_endpoint_host_prefix" yaml:"enable_endpoint_host_prefix"`
85+
EnableEndpointDiscovery bool `json:"enable_endpoint_discovery" yaml:"enable_endpoint_discovery"`
86+
EnableEndpointHostPrefix bool `json:"enable_endpoint_host_prefix" yaml:"enable_endpoint_host_prefix"`
8787

88-
MaxPartSize string `json:"max_part_size" yaml:"max_part_size"`
88+
MaxPartSize string `json:"max_part_size" yaml:"max_part_size"`
8989
MaxChunkSize string `json:"max_chunk_size" yaml:"max_chunk_size"`
9090
}
9191

9292
// CloudStorageConfig represents CloudStorage configuration.
9393
type CloudStorageConfig struct {
94-
URL string `json:"url" yaml:"url"`
94+
URL string `json:"url" yaml:"url"`
9595
Client *CloudStorageClient `json:"client" yaml:"client"`
9696

97-
WriteBufferSize int `json:"write_buffer_size" yaml:"write_buffer_size"`
98-
WriteCacheControl string `json:"write_cache_control" yaml:"write_cache_control"`
97+
WriteBufferSize int `json:"write_buffer_size" yaml:"write_buffer_size"`
98+
WriteCacheControl string `json:"write_cache_control" yaml:"write_cache_control"`
9999
WriteContentDisposition string `json:"write_content_disposition" yaml:"write_content_disposition"`
100-
WriteContentEncoding string `json:"write_content_encoding" yaml:"write_content_encoding"`
101-
WriteContentLanguage string `json:"write_content_language" yaml:"write_content_language"`
102-
WriteContentType string `json:"write_content_type" yaml:"write_content_type"`
100+
WriteContentEncoding string `json:"write_content_encoding" yaml:"write_content_encoding"`
101+
WriteContentLanguage string `json:"write_content_language" yaml:"write_content_language"`
102+
WriteContentType string `json:"write_content_type" yaml:"write_content_type"`
103103
}
104104

105105
// CloudStorageClient represents CloudStorage client configuration.
106106
type CloudStorageClient struct {
107107
CredentialsFilePath string `json:"credentials_file_path" yaml:"credentials_file_path"`
108-
CredentialsJSON string `json:"credentials_json" yaml:"credentials_json"`
108+
CredentialsJSON string `json:"credentials_json" yaml:"credentials_json"`
109109
}
110110

111111
// Bind binds the actual data from the Blob receiver field.

internal/config/circuitbreaker.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ package config
1515

1616
// CircuitBreaker represents the configuration for the internal circuitbreaker package.
1717
type CircuitBreaker struct {
18-
ClosedErrorRate float32 `yaml:"closed_error_rate" json:"closed_error_rate,omitempty"`
19-
HalfOpenErrorRate float32 `yaml:"half_open_error_rate" json:"half_open_error_rate,omitempty"`
20-
MinSamples int64 `yaml:"min_samples" json:"min_samples,omitempty"`
21-
OpenTimeout string `yaml:"open_timeout" json:"open_timeout,omitempty"`
22-
ClosedRefreshTimeout string `yaml:"closed_refresh_timeout" json:"closed_refresh_timeout,omitempty"`
18+
ClosedErrorRate float32 `json:"closed_error_rate,omitempty" yaml:"closed_error_rate"`
19+
HalfOpenErrorRate float32 `json:"half_open_error_rate,omitempty" yaml:"half_open_error_rate"`
20+
MinSamples int64 `json:"min_samples,omitempty" yaml:"min_samples"`
21+
OpenTimeout string `json:"open_timeout,omitempty" yaml:"open_timeout"`
22+
ClosedRefreshTimeout string `json:"closed_refresh_timeout,omitempty" yaml:"closed_refresh_timeout"`
2323
}
2424

2525
func (cb *CircuitBreaker) Bind() *CircuitBreaker {

internal/config/faiss.go

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,58 +20,58 @@ package config
2020
// Faiss represent the faiss core configuration for server.
2121
type Faiss struct {
2222
// IndexPath represents the faiss index file path
23-
IndexPath string `yaml:"index_path" json:"index_path,omitempty"`
23+
IndexPath string `json:"index_path,omitempty" yaml:"index_path"`
2424

2525
// Dimension represents the faiss index dimension
26-
Dimension int `yaml:"dimension" json:"dimension,omitempty" info:"dimension"`
26+
Dimension int `info:"dimension" json:"dimension,omitempty" yaml:"dimension"`
2727

2828
// Nlist represents the number of Voronoi cells
2929
// ref: https://github.com/facebookresearch/faiss/wiki/Faster-search
30-
Nlist int `yaml:"nlist" json:"nlist,omitempty" info:"nlist"`
30+
Nlist int `info:"nlist" json:"nlist,omitempty" yaml:"nlist"`
3131

3232
// M represents the number of subquantizers
3333
// ref: https://github.com/facebookresearch/faiss/wiki/Faiss-indexes-(composite)#cell-probe-method-with-a-pq-index-as-coarse-quantizer
34-
M int `yaml:"m" json:"m,omitempty" info:"m"`
34+
M int `info:"m" json:"m,omitempty" yaml:"m"`
3535

3636
// NbitsPerIdx represents the number of bit per subvector index
3737
// ref: https://github.com/facebookresearch/faiss/wiki/FAQ#can-i-ignore-warning-clustering-xxx-points-to-yyy-centroids
38-
NbitsPerIdx int `yaml:"nbits_per_idx" json:"nbits_per_idx,omitempty" info:"nbits_per_idx"`
38+
NbitsPerIdx int `info:"nbits_per_idx" json:"nbits_per_idx,omitempty" yaml:"nbits_per_idx"`
3939

4040
// MetricType represents the metric type
41-
MetricType string `yaml:"metric_type" json:"metric_type,omitempty" info:"metric_type"`
41+
MetricType string `info:"metric_type" json:"metric_type,omitempty" yaml:"metric_type"`
4242

4343
// EnableInMemoryMode enables on memory faiss indexing mode
44-
EnableInMemoryMode bool `yaml:"enable_in_memory_mode" json:"enable_in_memory_mode,omitempty"`
44+
EnableInMemoryMode bool `json:"enable_in_memory_mode,omitempty" yaml:"enable_in_memory_mode"`
4545

4646
// AutoIndexCheckDuration represents checking loop duration about auto indexing execution
47-
AutoIndexCheckDuration string `yaml:"auto_index_check_duration" json:"auto_index_check_duration,omitempty"`
47+
AutoIndexCheckDuration string `json:"auto_index_check_duration,omitempty" yaml:"auto_index_check_duration"`
4848

4949
// AutoSaveIndexDuration represents checking loop duration about auto save index execution
50-
AutoSaveIndexDuration string `yaml:"auto_save_index_duration" json:"auto_save_index_duration,omitempty"`
50+
AutoSaveIndexDuration string `json:"auto_save_index_duration,omitempty" yaml:"auto_save_index_duration"`
5151

5252
// AutoIndexDurationLimit represents auto indexing duration limit
53-
AutoIndexDurationLimit string `yaml:"auto_index_duration_limit" json:"auto_index_duration_limit,omitempty"`
53+
AutoIndexDurationLimit string `json:"auto_index_duration_limit,omitempty" yaml:"auto_index_duration_limit"`
5454

5555
// AutoIndexLength represents auto index length limit
56-
AutoIndexLength int `yaml:"auto_index_length" json:"auto_index_length,omitempty"`
56+
AutoIndexLength int `json:"auto_index_length,omitempty" yaml:"auto_index_length"`
5757

5858
// InitialDelayMaxDuration represents maximum duration for initial delay
59-
InitialDelayMaxDuration string `yaml:"initial_delay_max_duration" json:"initial_delay_max_duration,omitempty"`
59+
InitialDelayMaxDuration string `json:"initial_delay_max_duration,omitempty" yaml:"initial_delay_max_duration"`
6060

6161
// MinLoadIndexTimeout represents minimum duration of load index timeout
62-
MinLoadIndexTimeout string `yaml:"min_load_index_timeout" json:"min_load_index_timeout,omitempty"`
62+
MinLoadIndexTimeout string `json:"min_load_index_timeout,omitempty" yaml:"min_load_index_timeout"`
6363

6464
// MaxLoadIndexTimeout represents maximum duration of load index timeout
65-
MaxLoadIndexTimeout string `yaml:"max_load_index_timeout" json:"max_load_index_timeout,omitempty"`
65+
MaxLoadIndexTimeout string `json:"max_load_index_timeout,omitempty" yaml:"max_load_index_timeout"`
6666

6767
// LoadIndexTimeoutFactor represents a factor of load index timeout
68-
LoadIndexTimeoutFactor string `yaml:"load_index_timeout_factor" json:"load_index_timeout_factor,omitempty"`
68+
LoadIndexTimeoutFactor string `json:"load_index_timeout_factor,omitempty" yaml:"load_index_timeout_factor"`
6969

7070
// EnableProactiveGC enables more proactive GC call for reducing heap memory allocation
71-
EnableProactiveGC bool `yaml:"enable_proactive_gc" json:"enable_proactive_gc,omitempty"`
71+
EnableProactiveGC bool `json:"enable_proactive_gc,omitempty" yaml:"enable_proactive_gc"`
7272

7373
// EnableCopyOnWrite enables copy on write saving
74-
EnableCopyOnWrite bool `yaml:"enable_copy_on_write" json:"enable_copy_on_write,omitempty"`
74+
EnableCopyOnWrite bool `json:"enable_copy_on_write,omitempty" yaml:"enable_copy_on_write"`
7575

7676
// VQueue represents the faiss vector queue buffer size
7777
VQueue *VQueue `json:"vqueue,omitempty" yaml:"vqueue"`

internal/config/index.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,22 +35,22 @@ type Indexer struct {
3535
Concurrency int `json:"concurrency" yaml:"concurrency"`
3636

3737
// AutoIndexDurationLimit represents auto indexing duration limit
38-
AutoIndexDurationLimit string `yaml:"auto_index_duration_limit" json:"auto_index_duration_limit"`
38+
AutoIndexDurationLimit string `json:"auto_index_duration_limit" yaml:"auto_index_duration_limit"`
3939

4040
// AutoSaveIndexDurationLimit represents auto save index duration limit
41-
AutoSaveIndexDurationLimit string `yaml:"auto_save_index_duration_limit" json:"auto_save_index_duration_limit"`
41+
AutoSaveIndexDurationLimit string `json:"auto_save_index_duration_limit" yaml:"auto_save_index_duration_limit"`
4242

4343
// AutoSaveIndexWaitDuration represents auto save index wait for next duration
44-
AutoSaveIndexWaitDuration string `yaml:"auto_save_index_wait_duration" json:"auto_save_index_wait_duration"`
44+
AutoSaveIndexWaitDuration string `json:"auto_save_index_wait_duration" yaml:"auto_save_index_wait_duration"`
4545

4646
// AutoIndexCheckDuration represent checking loop duration about auto indexing execution
47-
AutoIndexCheckDuration string `yaml:"auto_index_check_duration" json:"auto_index_check_duration"`
47+
AutoIndexCheckDuration string `json:"auto_index_check_duration" yaml:"auto_index_check_duration"`
4848

4949
// AutoIndexLength represent minimum auto index length
50-
AutoIndexLength uint32 `yaml:"auto_index_length" json:"auto_index_length"`
50+
AutoIndexLength uint32 `json:"auto_index_length" yaml:"auto_index_length"`
5151

5252
// CreationPoolSize represent create index batch pool size
53-
CreationPoolSize uint32 `yaml:"creation_pool_size" json:"creation_pool_size"`
53+
CreationPoolSize uint32 `json:"creation_pool_size" yaml:"creation_pool_size"`
5454

5555
// NodeName represents node name
5656
NodeName string `json:"node_name" yaml:"node_name"`

internal/config/net.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,25 +25,25 @@ import (
2525

2626
// Net represents the network configuration tcp, udp, unix domain socket.
2727
type Net struct {
28-
DNS *DNS `yaml:"dns" json:"dns,omitempty"`
29-
Dialer *Dialer `yaml:"dialer" json:"dialer,omitempty"`
30-
SocketOption *SocketOption `yaml:"socket_option" json:"socket_option,omitempty"`
31-
TLS *TLS `yaml:"tls" json:"tls,omitempty"`
28+
DNS *DNS `json:"dns,omitempty" yaml:"dns"`
29+
Dialer *Dialer `json:"dialer,omitempty" yaml:"dialer"`
30+
SocketOption *SocketOption `json:"socket_option,omitempty" yaml:"socket_option"`
31+
TLS *TLS `json:"tls,omitempty" yaml:"tls"`
3232
}
3333

3434
// Dialer represents the configuration for dial.
3535
type Dialer struct {
36-
Timeout string `yaml:"timeout" json:"timeout,omitempty"`
37-
Keepalive string `yaml:"keepalive" json:"keepalive,omitempty"`
38-
FallbackDelay string `yaml:"fallback_delay" json:"fallback_delay,omitempty"`
39-
DualStackEnabled bool `yaml:"dual_stack_enabled" json:"dual_stack_enabled,omitempty"`
36+
Timeout string `json:"timeout,omitempty" yaml:"timeout"`
37+
Keepalive string `json:"keepalive,omitempty" yaml:"keepalive"`
38+
FallbackDelay string `json:"fallback_delay,omitempty" yaml:"fallback_delay"`
39+
DualStackEnabled bool `json:"dual_stack_enabled,omitempty" yaml:"dual_stack_enabled"`
4040
}
4141

4242
// DNS represents the configuration for resolving DNS.
4343
type DNS struct {
44-
CacheEnabled bool `yaml:"cache_enabled" json:"cache_enabled,omitempty"`
45-
RefreshDuration string `yaml:"refresh_duration" json:"refresh_duration,omitempty"`
46-
CacheExpiration string `yaml:"cache_expiration" json:"cache_expiration,omitempty"`
44+
CacheEnabled bool `json:"cache_enabled,omitempty" yaml:"cache_enabled"`
45+
RefreshDuration string `json:"refresh_duration,omitempty" yaml:"refresh_duration"`
46+
CacheExpiration string `json:"cache_expiration,omitempty" yaml:"cache_expiration"`
4747
}
4848

4949
// SocketOption represents the socket configurations.

0 commit comments

Comments
 (0)