Documentation ¶
Index ¶
- Constants
- Variables
- func BuildAliasNameFromNamespace(ns *namespace.Namespace) string
- func BuildIndexNameFromNamespace(ns *namespace.Namespace) string
- func WithInstantRefresh() func(*DiscoveryRepository)
- type AssetModel
- type Client
- type ClientOption
- type Config
- type DiscoveryRepository
- func (repo *DiscoveryRepository) CreateNamespace(ctx context.Context, ns *namespace.Namespace) error
- func (repo *DiscoveryRepository) DeleteByID(ctx context.Context, ns *namespace.Namespace, assetID string) error
- func (repo *DiscoveryRepository) DeleteByURN(ctx context.Context, ns *namespace.Namespace, assetURN string) error
- func (repo *DiscoveryRepository) Search(ctx context.Context, cfg asset.SearchConfig) ([]asset.SearchResult, error)
- func (repo *DiscoveryRepository) Suggest(ctx context.Context, cfg asset.SearchConfig) (results []string, err error)
- func (repo *DiscoveryRepository) Upsert(ctx context.Context, ns *namespace.Namespace, ast *asset.Asset) error
- type Route
Constants ¶
View Source
const ( // DefaultShardCountPerIndex provides shard count in an index. For large scale, it should be at least 12 DefaultShardCountPerIndex = 6 // DedicatedTenantIndexPrefix is used to avoid index conflicts with system managed indices DedicatedTenantIndexPrefix = "compass-idx" // TenantIndexAliasPrefix is used to avoid index/alias conflicts, convention is same for // dedicated and shared tenants TenantIndexAliasPrefix = "compass-alias" )DefaultSharedIndexName = "compass-idx-default"
Variables ¶
View Source
var ( DefaultRoute = &Route{ Index: DefaultSharedIndexName, ReadKey: uuid.Nil.String(), WriteKey: uuid.Nil.String(), FilterKey: uuid.Nil.String(), } )
Functions ¶
func WithInstantRefresh ¶
func WithInstantRefresh() func(*DiscoveryRepository)
WithInstantRefresh refresh the affected shards to make insert operations visible to search instantly
Types ¶
type AssetModel ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) CreateIdxAlias ¶
func (*Client) CreateIndex ¶
func (*Client) IndexExists ¶
IndexExists checks for the existence of an index
type ClientOption ¶
type ClientOption func(*Client)
func WithClient ¶
func WithClient(cli *elasticsearch.Client) ClientOption
type Config ¶
type Config struct {
Brokers string `mapstructure:"brokers" default:"http://localhost:9200"`
}
type DiscoveryRepository ¶
type DiscoveryRepository struct {
// contains filtered or unexported fields
}
DiscoveryRepository implements discovery.Repository with elasticsearch as the backing store.
func NewDiscoveryRepository ¶
func NewDiscoveryRepository(cli *Client, opts ...func(*DiscoveryRepository)) *DiscoveryRepository
func (*DiscoveryRepository) CreateNamespace ¶
func (*DiscoveryRepository) DeleteByID ¶
func (*DiscoveryRepository) DeleteByURN ¶
func (*DiscoveryRepository) Search ¶
func (repo *DiscoveryRepository) Search(ctx context.Context, cfg asset.SearchConfig) ([]asset.SearchResult, error)
Search the asset store
func (*DiscoveryRepository) Suggest ¶
func (repo *DiscoveryRepository) Suggest(ctx context.Context, cfg asset.SearchConfig) (results []string, err error)
type Route ¶
type Route struct { // Index could be shared or a dedicated, if dedicated it will be identified by namespace name // for most cases it will be `DefaultSharedIndexName` Index string `json:"index"` // ReadKey route search query to respective shards // for most cases it will be namespace id ReadKey string `json:"read_key"` // WriteKey route index query to respective shards // for most cases it will be namespace id WriteKey string `json:"write_key"` // FilterKey finds set of documents uniquely for a tenant // for most cases it will be namespace id FilterKey string `json:"filter_key"` }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.