client

package
v1.12.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 7, 2021 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package client is a generated GoMock package.

Package client is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsRetryableError

func IsRetryableError(err error) bool

func IsRetryableStatus

func IsRetryableStatus(status int) bool

IsRetryableStatus is complaint with elastic.BulkProcessorService.RetryItemStatusCodes responses with these status will be kept in queue and retried until success 408 - Request Timeout 429 - Too Many Requests 500 - Node not connected 503 - Service Unavailable 507 - Insufficient Storage

func NewAwsHttpClient

func NewAwsHttpClient(config config.ESAWSRequestSigningConfig) (*http.Client, error)

Types

type BulkProcessor

type BulkProcessor interface {
	Stop() error
	Add(request *BulkableRequest)
}

type BulkProcessorParameters

type BulkProcessorParameters struct {
	Name          string
	NumOfWorkers  int
	BulkActions   int
	BulkSize      int
	FlushInterval time.Duration
	Backoff       elastic.Backoff
	BeforeFunc    elastic.BulkBeforeFunc
	AfterFunc     elastic.BulkAfterFunc
}

BulkProcessorParameters holds all required and optional parameters for executing bulk service

type BulkService

type BulkService interface {
	Do(ctx context.Context) error
	NumberOfActions() int
	Add(request *BulkableRequest)
}

type BulkableRequest

type BulkableRequest struct {
	RequestType BulkableRequestType
	Index       string
	ID          string
	Version     int64
	Doc         map[string]interface{}
}

type BulkableRequestType

type BulkableRequestType uint8
const (
	BulkableRequestTypeIndex BulkableRequestType = iota
	BulkableRequestTypeDelete
)

type CLIClient

type CLIClient interface {
	Client
	CatIndices(ctx context.Context) (elastic.CatIndicesResponse, error)
	Bulk() BulkService
	Delete(ctx context.Context, indexName string, docID string, version int64) error
}

func NewCLIClient

func NewCLIClient(url string, version string) (CLIClient, error)

type Client

type Client interface {
	Search(ctx context.Context, p *SearchParameters) (*elastic.SearchResult, error)
	Count(ctx context.Context, index string, query elastic.Query) (int64, error)
	RunBulkProcessor(ctx context.Context, p *BulkProcessorParameters) (BulkProcessor, error)

	OpenScroll(ctx context.Context, p *SearchParameters, keepAliveInterval string) (*elastic.SearchResult, error)
	Scroll(ctx context.Context, scrollID string, keepAliveInterval string) (*elastic.SearchResult, error)
	CloseScroll(ctx context.Context, id string) error

	// TODO (alex): move this to some admin client (and join with IntegrationTestsClient)
	PutMapping(ctx context.Context, index string, mapping map[string]enumspb.IndexedValueType) (bool, error)
	WaitForYellowStatus(ctx context.Context, index string) (string, error)
	GetMapping(ctx context.Context, index string) (map[string]string, error)
}

Client is a wrapper around Elasticsearch client library.

func NewClient

func NewClient(config *config.Elasticsearch, httpClient *http.Client, logger log.Logger) (Client, error)

type ClientV7

type ClientV7 interface {
	Client
	IsPointInTimeSupported(ctx context.Context) bool
	OpenPointInTime(ctx context.Context, index string, keepAliveInterval string) (string, error)
	ClosePointInTime(ctx context.Context, id string) (bool, error)
}

Combine ClientV7 with Client interface after ES v6 support removal.

type IntegrationTestsClient

type IntegrationTestsClient interface {
	CreateIndex(ctx context.Context, index string) (bool, error)
	IndexPutTemplate(ctx context.Context, templateName string, bodyString string) (bool, error)
	IndexExists(ctx context.Context, indexName string) (bool, error)
	DeleteIndex(ctx context.Context, indexName string) (bool, error)
	IndexPutSettings(ctx context.Context, indexName string, bodyString string) (bool, error)
	IndexGetSettings(ctx context.Context, indexName string) (map[string]*elastic.IndicesGetSettingsResponse, error)
}

func NewIntegrationTestsClient

func NewIntegrationTestsClient(url string, version string) (IntegrationTestsClient, error)

type MockBulkProcessor

type MockBulkProcessor struct {
	// contains filtered or unexported fields
}

MockBulkProcessor is a mock of BulkProcessor interface.

func NewMockBulkProcessor

func NewMockBulkProcessor(ctrl *gomock.Controller) *MockBulkProcessor

NewMockBulkProcessor creates a new mock instance.

func (*MockBulkProcessor) Add

func (m *MockBulkProcessor) Add(request *BulkableRequest)

Add mocks base method.

func (*MockBulkProcessor) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockBulkProcessor) Stop

func (m *MockBulkProcessor) Stop() error

Stop mocks base method.

type MockBulkProcessorMockRecorder

type MockBulkProcessorMockRecorder struct {
	// contains filtered or unexported fields
}

MockBulkProcessorMockRecorder is the mock recorder for MockBulkProcessor.

func (*MockBulkProcessorMockRecorder) Add

func (mr *MockBulkProcessorMockRecorder) Add(request interface{}) *gomock.Call

Add indicates an expected call of Add.

func (*MockBulkProcessorMockRecorder) Stop

Stop indicates an expected call of Stop.

type MockCLIClient

type MockCLIClient struct {
	// contains filtered or unexported fields
}

MockCLIClient is a mock of CLIClient interface.

func NewMockCLIClient

func NewMockCLIClient(ctrl *gomock.Controller) *MockCLIClient

NewMockCLIClient creates a new mock instance.

func (*MockCLIClient) Bulk

func (m *MockCLIClient) Bulk() BulkService

Bulk mocks base method.

func (*MockCLIClient) CatIndices

func (m *MockCLIClient) CatIndices(ctx context.Context) (v7.CatIndicesResponse, error)

CatIndices mocks base method.

func (*MockCLIClient) CloseScroll added in v1.12.1

func (m *MockCLIClient) CloseScroll(ctx context.Context, id string) error

CloseScroll mocks base method.

func (*MockCLIClient) Count

func (m *MockCLIClient) Count(ctx context.Context, index string, query v7.Query) (int64, error)

Count mocks base method.

func (*MockCLIClient) Delete

func (m *MockCLIClient) Delete(ctx context.Context, indexName, docID string, version int64) error

Delete mocks base method.

func (*MockCLIClient) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockCLIClient) GetMapping

func (m *MockCLIClient) GetMapping(ctx context.Context, index string) (map[string]string, error)

GetMapping mocks base method.

func (*MockCLIClient) OpenScroll added in v1.12.1

func (m *MockCLIClient) OpenScroll(ctx context.Context, p *SearchParameters, keepAliveInterval string) (*v7.SearchResult, error)

OpenScroll mocks base method.

func (*MockCLIClient) PutMapping

func (m *MockCLIClient) PutMapping(ctx context.Context, index string, mapping map[string]v1.IndexedValueType) (bool, error)

PutMapping mocks base method.

func (*MockCLIClient) RunBulkProcessor

func (m *MockCLIClient) RunBulkProcessor(ctx context.Context, p *BulkProcessorParameters) (BulkProcessor, error)

RunBulkProcessor mocks base method.

func (*MockCLIClient) Scroll added in v1.12.1

func (m *MockCLIClient) Scroll(ctx context.Context, scrollID, keepAliveInterval string) (*v7.SearchResult, error)

Scroll mocks base method.

func (*MockCLIClient) Search

Search mocks base method.

func (*MockCLIClient) WaitForYellowStatus

func (m *MockCLIClient) WaitForYellowStatus(ctx context.Context, index string) (string, error)

WaitForYellowStatus mocks base method.

type MockCLIClientMockRecorder

type MockCLIClientMockRecorder struct {
	// contains filtered or unexported fields
}

MockCLIClientMockRecorder is the mock recorder for MockCLIClient.

func (*MockCLIClientMockRecorder) Bulk

Bulk indicates an expected call of Bulk.

func (*MockCLIClientMockRecorder) CatIndices

func (mr *MockCLIClientMockRecorder) CatIndices(ctx interface{}) *gomock.Call

CatIndices indicates an expected call of CatIndices.

func (*MockCLIClientMockRecorder) CloseScroll added in v1.12.1

func (mr *MockCLIClientMockRecorder) CloseScroll(ctx, id interface{}) *gomock.Call

CloseScroll indicates an expected call of CloseScroll.

func (*MockCLIClientMockRecorder) Count

func (mr *MockCLIClientMockRecorder) Count(ctx, index, query interface{}) *gomock.Call

Count indicates an expected call of Count.

func (*MockCLIClientMockRecorder) Delete

func (mr *MockCLIClientMockRecorder) Delete(ctx, indexName, docID, version interface{}) *gomock.Call

Delete indicates an expected call of Delete.

func (*MockCLIClientMockRecorder) GetMapping

func (mr *MockCLIClientMockRecorder) GetMapping(ctx, index interface{}) *gomock.Call

GetMapping indicates an expected call of GetMapping.

func (*MockCLIClientMockRecorder) OpenScroll added in v1.12.1

func (mr *MockCLIClientMockRecorder) OpenScroll(ctx, p, keepAliveInterval interface{}) *gomock.Call

OpenScroll indicates an expected call of OpenScroll.

func (*MockCLIClientMockRecorder) PutMapping

func (mr *MockCLIClientMockRecorder) PutMapping(ctx, index, mapping interface{}) *gomock.Call

PutMapping indicates an expected call of PutMapping.

func (*MockCLIClientMockRecorder) RunBulkProcessor

func (mr *MockCLIClientMockRecorder) RunBulkProcessor(ctx, p interface{}) *gomock.Call

RunBulkProcessor indicates an expected call of RunBulkProcessor.

func (*MockCLIClientMockRecorder) Scroll added in v1.12.1

func (mr *MockCLIClientMockRecorder) Scroll(ctx, scrollID, keepAliveInterval interface{}) *gomock.Call

Scroll indicates an expected call of Scroll.

func (*MockCLIClientMockRecorder) Search

func (mr *MockCLIClientMockRecorder) Search(ctx, p interface{}) *gomock.Call

Search indicates an expected call of Search.

func (*MockCLIClientMockRecorder) WaitForYellowStatus

func (mr *MockCLIClientMockRecorder) WaitForYellowStatus(ctx, index interface{}) *gomock.Call

WaitForYellowStatus indicates an expected call of WaitForYellowStatus.

type MockClient

type MockClient struct {
	// contains filtered or unexported fields
}

MockClient is a mock of Client interface.

func NewMockClient

func NewMockClient(ctrl *gomock.Controller) *MockClient

NewMockClient creates a new mock instance.

func (*MockClient) CloseScroll added in v1.12.1

func (m *MockClient) CloseScroll(ctx context.Context, id string) error

CloseScroll mocks base method.

func (*MockClient) Count

func (m *MockClient) Count(ctx context.Context, index string, query v7.Query) (int64, error)

Count mocks base method.

func (*MockClient) EXPECT

func (m *MockClient) EXPECT() *MockClientMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockClient) GetMapping

func (m *MockClient) GetMapping(ctx context.Context, index string) (map[string]string, error)

GetMapping mocks base method.

func (*MockClient) OpenScroll added in v1.12.1

func (m *MockClient) OpenScroll(ctx context.Context, p *SearchParameters, keepAliveInterval string) (*v7.SearchResult, error)

OpenScroll mocks base method.

func (*MockClient) PutMapping

func (m *MockClient) PutMapping(ctx context.Context, index string, mapping map[string]v1.IndexedValueType) (bool, error)

PutMapping mocks base method.

func (*MockClient) RunBulkProcessor

func (m *MockClient) RunBulkProcessor(ctx context.Context, p *BulkProcessorParameters) (BulkProcessor, error)

RunBulkProcessor mocks base method.

func (*MockClient) Scroll added in v1.12.1

func (m *MockClient) Scroll(ctx context.Context, scrollID, keepAliveInterval string) (*v7.SearchResult, error)

Scroll mocks base method.

func (*MockClient) Search

Search mocks base method.

func (*MockClient) WaitForYellowStatus

func (m *MockClient) WaitForYellowStatus(ctx context.Context, index string) (string, error)

WaitForYellowStatus mocks base method.

type MockClientMockRecorder

type MockClientMockRecorder struct {
	// contains filtered or unexported fields
}

MockClientMockRecorder is the mock recorder for MockClient.

func (*MockClientMockRecorder) CloseScroll added in v1.12.1

func (mr *MockClientMockRecorder) CloseScroll(ctx, id interface{}) *gomock.Call

CloseScroll indicates an expected call of CloseScroll.

func (*MockClientMockRecorder) Count

func (mr *MockClientMockRecorder) Count(ctx, index, query interface{}) *gomock.Call

Count indicates an expected call of Count.

func (*MockClientMockRecorder) GetMapping

func (mr *MockClientMockRecorder) GetMapping(ctx, index interface{}) *gomock.Call

GetMapping indicates an expected call of GetMapping.

func (*MockClientMockRecorder) OpenScroll added in v1.12.1

func (mr *MockClientMockRecorder) OpenScroll(ctx, p, keepAliveInterval interface{}) *gomock.Call

OpenScroll indicates an expected call of OpenScroll.

func (*MockClientMockRecorder) PutMapping

func (mr *MockClientMockRecorder) PutMapping(ctx, index, mapping interface{}) *gomock.Call

PutMapping indicates an expected call of PutMapping.

func (*MockClientMockRecorder) RunBulkProcessor

func (mr *MockClientMockRecorder) RunBulkProcessor(ctx, p interface{}) *gomock.Call

RunBulkProcessor indicates an expected call of RunBulkProcessor.

func (*MockClientMockRecorder) Scroll added in v1.12.1

func (mr *MockClientMockRecorder) Scroll(ctx, scrollID, keepAliveInterval interface{}) *gomock.Call

Scroll indicates an expected call of Scroll.

func (*MockClientMockRecorder) Search

func (mr *MockClientMockRecorder) Search(ctx, p interface{}) *gomock.Call

Search indicates an expected call of Search.

func (*MockClientMockRecorder) WaitForYellowStatus

func (mr *MockClientMockRecorder) WaitForYellowStatus(ctx, index interface{}) *gomock.Call

WaitForYellowStatus indicates an expected call of WaitForYellowStatus.

type MockClientV7

type MockClientV7 struct {
	// contains filtered or unexported fields
}

MockClientV7 is a mock of ClientV7 interface.

func NewMockClientV7

func NewMockClientV7(ctrl *gomock.Controller) *MockClientV7

NewMockClientV7 creates a new mock instance.

func (*MockClientV7) ClosePointInTime

func (m *MockClientV7) ClosePointInTime(ctx context.Context, id string) (bool, error)

ClosePointInTime mocks base method.

func (*MockClientV7) CloseScroll added in v1.12.1

func (m *MockClientV7) CloseScroll(ctx context.Context, id string) error

CloseScroll mocks base method.

func (*MockClientV7) Count

func (m *MockClientV7) Count(ctx context.Context, index string, query v7.Query) (int64, error)

Count mocks base method.

func (*MockClientV7) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockClientV7) GetMapping

func (m *MockClientV7) GetMapping(ctx context.Context, index string) (map[string]string, error)

GetMapping mocks base method.

func (*MockClientV7) IsPointInTimeSupported added in v1.12.1

func (m *MockClientV7) IsPointInTimeSupported(ctx context.Context) bool

IsPointInTimeSupported mocks base method.

func (*MockClientV7) OpenPointInTime

func (m *MockClientV7) OpenPointInTime(ctx context.Context, index, keepAliveInterval string) (string, error)

OpenPointInTime mocks base method.

func (*MockClientV7) OpenScroll added in v1.12.1

func (m *MockClientV7) OpenScroll(ctx context.Context, p *SearchParameters, keepAliveInterval string) (*v7.SearchResult, error)

OpenScroll mocks base method.

func (*MockClientV7) PutMapping

func (m *MockClientV7) PutMapping(ctx context.Context, index string, mapping map[string]v1.IndexedValueType) (bool, error)

PutMapping mocks base method.

func (*MockClientV7) RunBulkProcessor

func (m *MockClientV7) RunBulkProcessor(ctx context.Context, p *BulkProcessorParameters) (BulkProcessor, error)

RunBulkProcessor mocks base method.

func (*MockClientV7) Scroll added in v1.12.1

func (m *MockClientV7) Scroll(ctx context.Context, scrollID, keepAliveInterval string) (*v7.SearchResult, error)

Scroll mocks base method.

func (*MockClientV7) Search

Search mocks base method.

func (*MockClientV7) WaitForYellowStatus

func (m *MockClientV7) WaitForYellowStatus(ctx context.Context, index string) (string, error)

WaitForYellowStatus mocks base method.

type MockClientV7MockRecorder

type MockClientV7MockRecorder struct {
	// contains filtered or unexported fields
}

MockClientV7MockRecorder is the mock recorder for MockClientV7.

func (*MockClientV7MockRecorder) ClosePointInTime

func (mr *MockClientV7MockRecorder) ClosePointInTime(ctx, id interface{}) *gomock.Call

ClosePointInTime indicates an expected call of ClosePointInTime.

func (*MockClientV7MockRecorder) CloseScroll added in v1.12.1

func (mr *MockClientV7MockRecorder) CloseScroll(ctx, id interface{}) *gomock.Call

CloseScroll indicates an expected call of CloseScroll.

func (*MockClientV7MockRecorder) Count

func (mr *MockClientV7MockRecorder) Count(ctx, index, query interface{}) *gomock.Call

Count indicates an expected call of Count.

func (*MockClientV7MockRecorder) GetMapping

func (mr *MockClientV7MockRecorder) GetMapping(ctx, index interface{}) *gomock.Call

GetMapping indicates an expected call of GetMapping.

func (*MockClientV7MockRecorder) IsPointInTimeSupported added in v1.12.1

func (mr *MockClientV7MockRecorder) IsPointInTimeSupported(ctx interface{}) *gomock.Call

IsPointInTimeSupported indicates an expected call of IsPointInTimeSupported.

func (*MockClientV7MockRecorder) OpenPointInTime

func (mr *MockClientV7MockRecorder) OpenPointInTime(ctx, index, keepAliveInterval interface{}) *gomock.Call

OpenPointInTime indicates an expected call of OpenPointInTime.

func (*MockClientV7MockRecorder) OpenScroll added in v1.12.1

func (mr *MockClientV7MockRecorder) OpenScroll(ctx, p, keepAliveInterval interface{}) *gomock.Call

OpenScroll indicates an expected call of OpenScroll.

func (*MockClientV7MockRecorder) PutMapping

func (mr *MockClientV7MockRecorder) PutMapping(ctx, index, mapping interface{}) *gomock.Call

PutMapping indicates an expected call of PutMapping.

func (*MockClientV7MockRecorder) RunBulkProcessor

func (mr *MockClientV7MockRecorder) RunBulkProcessor(ctx, p interface{}) *gomock.Call

RunBulkProcessor indicates an expected call of RunBulkProcessor.

func (*MockClientV7MockRecorder) Scroll added in v1.12.1

func (mr *MockClientV7MockRecorder) Scroll(ctx, scrollID, keepAliveInterval interface{}) *gomock.Call

Scroll indicates an expected call of Scroll.

func (*MockClientV7MockRecorder) Search

func (mr *MockClientV7MockRecorder) Search(ctx, p interface{}) *gomock.Call

Search indicates an expected call of Search.

func (*MockClientV7MockRecorder) WaitForYellowStatus

func (mr *MockClientV7MockRecorder) WaitForYellowStatus(ctx, index interface{}) *gomock.Call

WaitForYellowStatus indicates an expected call of WaitForYellowStatus.

type MockIntegrationTestsClient

type MockIntegrationTestsClient struct {
	// contains filtered or unexported fields
}

MockIntegrationTestsClient is a mock of IntegrationTestsClient interface.

func NewMockIntegrationTestsClient

func NewMockIntegrationTestsClient(ctrl *gomock.Controller) *MockIntegrationTestsClient

NewMockIntegrationTestsClient creates a new mock instance.

func (*MockIntegrationTestsClient) CreateIndex

func (m *MockIntegrationTestsClient) CreateIndex(ctx context.Context, index string) (bool, error)

CreateIndex mocks base method.

func (*MockIntegrationTestsClient) DeleteIndex

func (m *MockIntegrationTestsClient) DeleteIndex(ctx context.Context, indexName string) (bool, error)

DeleteIndex mocks base method.

func (*MockIntegrationTestsClient) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockIntegrationTestsClient) IndexExists

func (m *MockIntegrationTestsClient) IndexExists(ctx context.Context, indexName string) (bool, error)

IndexExists mocks base method.

func (*MockIntegrationTestsClient) IndexGetSettings

func (m *MockIntegrationTestsClient) IndexGetSettings(ctx context.Context, indexName string) (map[string]*v7.IndicesGetSettingsResponse, error)

IndexGetSettings mocks base method.

func (*MockIntegrationTestsClient) IndexPutSettings

func (m *MockIntegrationTestsClient) IndexPutSettings(ctx context.Context, indexName, bodyString string) (bool, error)

IndexPutSettings mocks base method.

func (*MockIntegrationTestsClient) IndexPutTemplate

func (m *MockIntegrationTestsClient) IndexPutTemplate(ctx context.Context, templateName, bodyString string) (bool, error)

IndexPutTemplate mocks base method.

type MockIntegrationTestsClientMockRecorder

type MockIntegrationTestsClientMockRecorder struct {
	// contains filtered or unexported fields
}

MockIntegrationTestsClientMockRecorder is the mock recorder for MockIntegrationTestsClient.

func (*MockIntegrationTestsClientMockRecorder) CreateIndex

func (mr *MockIntegrationTestsClientMockRecorder) CreateIndex(ctx, index interface{}) *gomock.Call

CreateIndex indicates an expected call of CreateIndex.

func (*MockIntegrationTestsClientMockRecorder) DeleteIndex

func (mr *MockIntegrationTestsClientMockRecorder) DeleteIndex(ctx, indexName interface{}) *gomock.Call

DeleteIndex indicates an expected call of DeleteIndex.

func (*MockIntegrationTestsClientMockRecorder) IndexExists

func (mr *MockIntegrationTestsClientMockRecorder) IndexExists(ctx, indexName interface{}) *gomock.Call

IndexExists indicates an expected call of IndexExists.

func (*MockIntegrationTestsClientMockRecorder) IndexGetSettings

func (mr *MockIntegrationTestsClientMockRecorder) IndexGetSettings(ctx, indexName interface{}) *gomock.Call

IndexGetSettings indicates an expected call of IndexGetSettings.

func (*MockIntegrationTestsClientMockRecorder) IndexPutSettings

func (mr *MockIntegrationTestsClientMockRecorder) IndexPutSettings(ctx, indexName, bodyString interface{}) *gomock.Call

IndexPutSettings indicates an expected call of IndexPutSettings.

func (*MockIntegrationTestsClientMockRecorder) IndexPutTemplate

func (mr *MockIntegrationTestsClientMockRecorder) IndexPutTemplate(ctx, templateName, bodyString interface{}) *gomock.Call

IndexPutTemplate indicates an expected call of IndexPutTemplate.

type SearchParameters

type SearchParameters struct {
	Index    string
	Query    elastic.Query
	PageSize int
	Sorter   []elastic.Sorter

	SearchAfter []interface{}
	PointInTime *elastic.PointInTime
}

SearchParameters holds all required and optional parameters for executing a search.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL