mirror of
https://github.com/hanzoai/tasks.git
synced 2026-10-30 14:56:19 +00:00
## What changed?
<!-- Describe what has changed in this PR -->
Remove license header from every file. Because it is really hard to
follow in this PR here is the summary:
1. License header is removed from all `.go` and `.proto` files
:fireworks::fireworks:🎆.
2. `LICENSE` file in the root directory has only Temporal and Uber
copyrights.
3. 5 other `LICENSE` files added to the packages which have copyrights
different from Temporal and Uber: Datadog, Xargin, "Mat Ryer, Tyler
Bunnell and contributors".
4. `license_file` flag is removed from all code generation tools.
5. `copyright_file` flag is removed from `go:generate mockgen`
directive.
6. All copyright related targets are removed from `Makefile`.
7. Updated Temporal copyright year to 2025 everywhere.
## Why?
<!-- Tell your future self why have you made these changes -->
I double checked with legal department that it is not needed to have
license header in every file. One file per repo is enough. I put all
copyrights to the root `LICENSE` file and removed header from all other
files. Also updated tools and `Makefile`.
70 lines
2.7 KiB
Go
70 lines
2.7 KiB
Go
//go:generate mockgen -package $GOPACKAGE -source $GOFILE -destination client_mock.go
|
|
|
|
package client
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
"github.com/olivere/elastic/v7"
|
|
enumspb "go.temporal.io/api/enums/v1"
|
|
)
|
|
|
|
const (
|
|
versionTypeExternal = "external"
|
|
minimumCloseIdleConnectionsInterval = 15 * time.Second
|
|
)
|
|
|
|
type (
|
|
// Client is a wrapper around Elasticsearch client library.
|
|
Client interface {
|
|
Get(ctx context.Context, index string, docID string) (*elastic.GetResult, error)
|
|
Search(ctx context.Context, p *SearchParameters) (*elastic.SearchResult, error)
|
|
Count(ctx context.Context, index string, query elastic.Query) (int64, error)
|
|
CountGroupBy(ctx context.Context, index string, query elastic.Query, aggName string, agg elastic.Aggregation) (*elastic.SearchResult, error)
|
|
RunBulkProcessor(ctx context.Context, p *BulkProcessorParameters) (BulkProcessor, 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)
|
|
IndexExists(ctx context.Context, indexName string) (bool, error)
|
|
CreateIndex(ctx context.Context, index string, body map[string]any) (bool, error)
|
|
DeleteIndex(ctx context.Context, indexName string) (bool, error)
|
|
CatIndices(ctx context.Context, target string) (elastic.CatIndicesResponse, error)
|
|
|
|
OpenScroll(ctx context.Context, p *SearchParameters, keepAliveInterval string) (*elastic.SearchResult, error)
|
|
Scroll(ctx context.Context, id string, keepAliveInterval string) (*elastic.SearchResult, error)
|
|
CloseScroll(ctx context.Context, id string) error
|
|
|
|
IsPointInTimeSupported(ctx context.Context) bool
|
|
OpenPointInTime(ctx context.Context, index string, keepAliveInterval string) (string, error)
|
|
ClosePointInTime(ctx context.Context, id string) (bool, error)
|
|
}
|
|
|
|
CLIClient interface {
|
|
Client
|
|
Delete(ctx context.Context, indexName string, docID string, version int64) error
|
|
}
|
|
|
|
IntegrationTestsClient interface {
|
|
Client
|
|
IndexPutTemplate(ctx context.Context, templateName string, bodyString string) (bool, error)
|
|
IndexPutSettings(ctx context.Context, indexName string, bodyString string) (bool, error)
|
|
IndexGetSettings(ctx context.Context, indexName string) (map[string]*elastic.IndicesGetSettingsResponse, error)
|
|
Ping(ctx context.Context) error
|
|
}
|
|
|
|
// SearchParameters holds all required and optional parameters for executing a search.
|
|
SearchParameters struct {
|
|
Index string
|
|
Query elastic.Query
|
|
PageSize int
|
|
Sorter []elastic.Sorter
|
|
|
|
SearchAfter []interface{}
|
|
ScrollID string
|
|
PointInTime *elastic.PointInTime
|
|
}
|
|
)
|