Skip to content

Commit

Permalink
a
Browse files Browse the repository at this point in the history
  • Loading branch information
ykadowak committed Feb 7, 2024
1 parent e1abbf7 commit b56ae7d
Show file tree
Hide file tree
Showing 13 changed files with 122 additions and 121 deletions.
3 changes: 2 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# limitations under the License.
#
run:
deadline: 30m
timeout: 30m
skip-dirs:
- (^|/)apis($|/)
- (^|/)hack/benchmark($|/)
Expand Down Expand Up @@ -122,6 +122,7 @@ linters:
# - whitespace
# - wrapcheck
# - wslissues:
issues:
exclude-use-default: false
exclude-rules:
- path: _test\.go
Expand Down
46 changes: 23 additions & 23 deletions internal/config/blob.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,45 +67,45 @@ type Blob struct {

// S3Config represents S3Config configuration.
type S3Config struct {
Endpoint string `json:"endpoint" yaml:"endpoint"`
Region string `json:"region" yaml:"region"`
AccessKey string `json:"access_key" yaml:"access_key"`
Endpoint string `json:"endpoint" yaml:"endpoint"`
Region string `json:"region" yaml:"region"`
AccessKey string `json:"access_key" yaml:"access_key"`
SecretAccessKey string `json:"secret_access_key" yaml:"secret_access_key"`
Token string `json:"token" yaml:"token"`

MaxRetries int `json:"max_retries" yaml:"max_retries"`
ForcePathStyle bool `json:"force_path_style" yaml:"force_path_style"`
UseAccelerate bool `json:"use_accelerate" yaml:"use_accelerate"`
UseARNRegion bool `json:"use_arn_region" yaml:"use_arn_region"`
UseDualStack bool `json:"use_dual_stack" yaml:"use_dual_stack"`
EnableSSL bool `json:"enable_ssl" yaml:"enable_ssl"`
EnableParamValidation bool `json:"enable_param_validation" yaml:"enable_param_validation"`
Enable100Continue bool `json:"enable_100_continue" yaml:"enable_100_continue"`
Token string `json:"token" yaml:"token"`

MaxRetries int `json:"max_retries" yaml:"max_retries"`
ForcePathStyle bool `json:"force_path_style" yaml:"force_path_style"`
UseAccelerate bool `json:"use_accelerate" yaml:"use_accelerate"`
UseARNRegion bool `json:"use_arn_region" yaml:"use_arn_region"`
UseDualStack bool `json:"use_dual_stack" yaml:"use_dual_stack"`
EnableSSL bool `json:"enable_ssl" yaml:"enable_ssl"`
EnableParamValidation bool `json:"enable_param_validation" yaml:"enable_param_validation"`
Enable100Continue bool `json:"enable_100_continue" yaml:"enable_100_continue"`
EnableContentMD5Validation bool `json:"enable_content_md5_validation" yaml:"enable_content_md5_validation"`
EnableEndpointDiscovery bool `json:"enable_endpoint_discovery" yaml:"enable_endpoint_discovery"`
EnableEndpointHostPrefix bool `json:"enable_endpoint_host_prefix" yaml:"enable_endpoint_host_prefix"`
EnableEndpointDiscovery bool `json:"enable_endpoint_discovery" yaml:"enable_endpoint_discovery"`
EnableEndpointHostPrefix bool `json:"enable_endpoint_host_prefix" yaml:"enable_endpoint_host_prefix"`

MaxPartSize string `json:"max_part_size" yaml:"max_part_size"`
MaxPartSize string `json:"max_part_size" yaml:"max_part_size"`
MaxChunkSize string `json:"max_chunk_size" yaml:"max_chunk_size"`
}

// CloudStorageConfig represents CloudStorage configuration.
type CloudStorageConfig struct {
URL string `json:"url" yaml:"url"`
URL string `json:"url" yaml:"url"`
Client *CloudStorageClient `json:"client" yaml:"client"`

WriteBufferSize int `json:"write_buffer_size" yaml:"write_buffer_size"`
WriteCacheControl string `json:"write_cache_control" yaml:"write_cache_control"`
WriteBufferSize int `json:"write_buffer_size" yaml:"write_buffer_size"`
WriteCacheControl string `json:"write_cache_control" yaml:"write_cache_control"`
WriteContentDisposition string `json:"write_content_disposition" yaml:"write_content_disposition"`
WriteContentEncoding string `json:"write_content_encoding" yaml:"write_content_encoding"`
WriteContentLanguage string `json:"write_content_language" yaml:"write_content_language"`
WriteContentType string `json:"write_content_type" yaml:"write_content_type"`
WriteContentEncoding string `json:"write_content_encoding" yaml:"write_content_encoding"`
WriteContentLanguage string `json:"write_content_language" yaml:"write_content_language"`
WriteContentType string `json:"write_content_type" yaml:"write_content_type"`
}

// CloudStorageClient represents CloudStorage client configuration.
type CloudStorageClient struct {
CredentialsFilePath string `json:"credentials_file_path" yaml:"credentials_file_path"`
CredentialsJSON string `json:"credentials_json" yaml:"credentials_json"`
CredentialsJSON string `json:"credentials_json" yaml:"credentials_json"`
}

// Bind binds the actual data from the Blob receiver field.
Expand Down
10 changes: 5 additions & 5 deletions internal/config/circuitbreaker.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ package config

// CircuitBreaker represents the configuration for the internal circuitbreaker package.
type CircuitBreaker struct {
ClosedErrorRate float32 `yaml:"closed_error_rate" json:"closed_error_rate,omitempty"`
HalfOpenErrorRate float32 `yaml:"half_open_error_rate" json:"half_open_error_rate,omitempty"`
MinSamples int64 `yaml:"min_samples" json:"min_samples,omitempty"`
OpenTimeout string `yaml:"open_timeout" json:"open_timeout,omitempty"`
ClosedRefreshTimeout string `yaml:"closed_refresh_timeout" json:"closed_refresh_timeout,omitempty"`
ClosedErrorRate float32 `json:"closed_error_rate,omitempty" yaml:"closed_error_rate"`
HalfOpenErrorRate float32 `json:"half_open_error_rate,omitempty" yaml:"half_open_error_rate"`
MinSamples int64 `json:"min_samples,omitempty" yaml:"min_samples"`
OpenTimeout string `json:"open_timeout,omitempty" yaml:"open_timeout"`
ClosedRefreshTimeout string `json:"closed_refresh_timeout,omitempty" yaml:"closed_refresh_timeout"`
}

func (cb *CircuitBreaker) Bind() *CircuitBreaker {
Expand Down
34 changes: 17 additions & 17 deletions internal/config/faiss.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,58 +20,58 @@ package config
// Faiss represent the faiss core configuration for server.
type Faiss struct {
// IndexPath represents the faiss index file path
IndexPath string `yaml:"index_path" json:"index_path,omitempty"`
IndexPath string `json:"index_path,omitempty" yaml:"index_path"`

// Dimension represents the faiss index dimension
Dimension int `yaml:"dimension" json:"dimension,omitempty" info:"dimension"`
Dimension int `info:"dimension" json:"dimension,omitempty" yaml:"dimension"`

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

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

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

// MetricType represents the metric type
MetricType string `yaml:"metric_type" json:"metric_type,omitempty" info:"metric_type"`
MetricType string `info:"metric_type" json:"metric_type,omitempty" yaml:"metric_type"`

// EnableInMemoryMode enables on memory faiss indexing mode
EnableInMemoryMode bool `yaml:"enable_in_memory_mode" json:"enable_in_memory_mode,omitempty"`
EnableInMemoryMode bool `json:"enable_in_memory_mode,omitempty" yaml:"enable_in_memory_mode"`

// AutoIndexCheckDuration represents checking loop duration about auto indexing execution
AutoIndexCheckDuration string `yaml:"auto_index_check_duration" json:"auto_index_check_duration,omitempty"`
AutoIndexCheckDuration string `json:"auto_index_check_duration,omitempty" yaml:"auto_index_check_duration"`

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

// AutoIndexDurationLimit represents auto indexing duration limit
AutoIndexDurationLimit string `yaml:"auto_index_duration_limit" json:"auto_index_duration_limit,omitempty"`
AutoIndexDurationLimit string `json:"auto_index_duration_limit,omitempty" yaml:"auto_index_duration_limit"`

// AutoIndexLength represents auto index length limit
AutoIndexLength int `yaml:"auto_index_length" json:"auto_index_length,omitempty"`
AutoIndexLength int `json:"auto_index_length,omitempty" yaml:"auto_index_length"`

// InitialDelayMaxDuration represents maximum duration for initial delay
InitialDelayMaxDuration string `yaml:"initial_delay_max_duration" json:"initial_delay_max_duration,omitempty"`
InitialDelayMaxDuration string `json:"initial_delay_max_duration,omitempty" yaml:"initial_delay_max_duration"`

// MinLoadIndexTimeout represents minimum duration of load index timeout
MinLoadIndexTimeout string `yaml:"min_load_index_timeout" json:"min_load_index_timeout,omitempty"`
MinLoadIndexTimeout string `json:"min_load_index_timeout,omitempty" yaml:"min_load_index_timeout"`

// MaxLoadIndexTimeout represents maximum duration of load index timeout
MaxLoadIndexTimeout string `yaml:"max_load_index_timeout" json:"max_load_index_timeout,omitempty"`
MaxLoadIndexTimeout string `json:"max_load_index_timeout,omitempty" yaml:"max_load_index_timeout"`

// LoadIndexTimeoutFactor represents a factor of load index timeout
LoadIndexTimeoutFactor string `yaml:"load_index_timeout_factor" json:"load_index_timeout_factor,omitempty"`
LoadIndexTimeoutFactor string `json:"load_index_timeout_factor,omitempty" yaml:"load_index_timeout_factor"`

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

// EnableCopyOnWrite enables copy on write saving
EnableCopyOnWrite bool `yaml:"enable_copy_on_write" json:"enable_copy_on_write,omitempty"`
EnableCopyOnWrite bool `json:"enable_copy_on_write,omitempty" yaml:"enable_copy_on_write"`

// VQueue represents the faiss vector queue buffer size
VQueue *VQueue `json:"vqueue,omitempty" yaml:"vqueue"`
Expand Down
12 changes: 6 additions & 6 deletions internal/config/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,22 @@ type Indexer struct {
Concurrency int `json:"concurrency" yaml:"concurrency"`

// AutoIndexDurationLimit represents auto indexing duration limit
AutoIndexDurationLimit string `yaml:"auto_index_duration_limit" json:"auto_index_duration_limit"`
AutoIndexDurationLimit string `json:"auto_index_duration_limit" yaml:"auto_index_duration_limit"`

// AutoSaveIndexDurationLimit represents auto save index duration limit
AutoSaveIndexDurationLimit string `yaml:"auto_save_index_duration_limit" json:"auto_save_index_duration_limit"`
AutoSaveIndexDurationLimit string `json:"auto_save_index_duration_limit" yaml:"auto_save_index_duration_limit"`

// AutoSaveIndexWaitDuration represents auto save index wait for next duration
AutoSaveIndexWaitDuration string `yaml:"auto_save_index_wait_duration" json:"auto_save_index_wait_duration"`
AutoSaveIndexWaitDuration string `json:"auto_save_index_wait_duration" yaml:"auto_save_index_wait_duration"`

// AutoIndexCheckDuration represent checking loop duration about auto indexing execution
AutoIndexCheckDuration string `yaml:"auto_index_check_duration" json:"auto_index_check_duration"`
AutoIndexCheckDuration string `json:"auto_index_check_duration" yaml:"auto_index_check_duration"`

// AutoIndexLength represent minimum auto index length
AutoIndexLength uint32 `yaml:"auto_index_length" json:"auto_index_length"`
AutoIndexLength uint32 `json:"auto_index_length" yaml:"auto_index_length"`

// CreationPoolSize represent create index batch pool size
CreationPoolSize uint32 `yaml:"creation_pool_size" json:"creation_pool_size"`
CreationPoolSize uint32 `json:"creation_pool_size" yaml:"creation_pool_size"`

// NodeName represents node name
NodeName string `json:"node_name" yaml:"node_name"`
Expand Down
22 changes: 11 additions & 11 deletions internal/config/net.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,25 @@ import (

// Net represents the network configuration tcp, udp, unix domain socket.
type Net struct {
DNS *DNS `yaml:"dns" json:"dns,omitempty"`
Dialer *Dialer `yaml:"dialer" json:"dialer,omitempty"`
SocketOption *SocketOption `yaml:"socket_option" json:"socket_option,omitempty"`
TLS *TLS `yaml:"tls" json:"tls,omitempty"`
DNS *DNS `json:"dns,omitempty" yaml:"dns"`
Dialer *Dialer `json:"dialer,omitempty" yaml:"dialer"`
SocketOption *SocketOption `json:"socket_option,omitempty" yaml:"socket_option"`
TLS *TLS `json:"tls,omitempty" yaml:"tls"`
}

// Dialer represents the configuration for dial.
type Dialer struct {
Timeout string `yaml:"timeout" json:"timeout,omitempty"`
Keepalive string `yaml:"keepalive" json:"keepalive,omitempty"`
FallbackDelay string `yaml:"fallback_delay" json:"fallback_delay,omitempty"`
DualStackEnabled bool `yaml:"dual_stack_enabled" json:"dual_stack_enabled,omitempty"`
Timeout string `json:"timeout,omitempty" yaml:"timeout"`
Keepalive string `json:"keepalive,omitempty" yaml:"keepalive"`
FallbackDelay string `json:"fallback_delay,omitempty" yaml:"fallback_delay"`
DualStackEnabled bool `json:"dual_stack_enabled,omitempty" yaml:"dual_stack_enabled"`
}

// DNS represents the configuration for resolving DNS.
type DNS struct {
CacheEnabled bool `yaml:"cache_enabled" json:"cache_enabled,omitempty"`
RefreshDuration string `yaml:"refresh_duration" json:"refresh_duration,omitempty"`
CacheExpiration string `yaml:"cache_expiration" json:"cache_expiration,omitempty"`
CacheEnabled bool `json:"cache_enabled,omitempty" yaml:"cache_enabled"`
RefreshDuration string `json:"refresh_duration,omitempty" yaml:"refresh_duration"`
CacheExpiration string `json:"cache_expiration,omitempty" yaml:"cache_expiration"`
}

// SocketOption represents the socket configurations.
Expand Down
Loading

0 comments on commit b56ae7d

Please sign in to comment.