Documentation ¶
Overview ¶
Package rollover implements elasticsearch rollover tasks.
Index ¶
- func BindRolloverIndices()
- func FilterReadyToBeDeleteIndices(aliasURL string, allIdx []string) (indices []string, err error)
- func FilterToBeDeleteIndicies(allInd []string, idxSt *IdxSetting) (indices []string, err error)
- func GetAliasURL(st *IdxSetting) string
- func GetIdxRolloverReqBodyByIdxAlias(idxSt *IdxSetting) (jb *bytes.Buffer, err error)
- func IsIdxIsWriteAlias(idx string, aliases []*AliasesResp) (ret bool)
- func IsIdxShouldDelete(now time.Time, dateStr string, expires time.Duration) (bool, error)
- func LoadAllIndicesNames(api string) (indices []string, err error)
- func NewIndex(ctx context.Context, api string, st *IdxSetting) (err error)
- func RemoveIndexByName(ctx context.Context, api, index string) (err error)
- func RunDeleteTask(ctx context.Context, sem *semaphore.Weighted, st *IdxSetting)
- func RunRolloverTask(ctx context.Context, sem *semaphore.Weighted, st *IdxSetting)
- type AliasesResp
- type IdxSetting
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BindRolloverIndices ¶
func BindRolloverIndices()
BindRolloverIndices bind the task to rollover indices
func FilterReadyToBeDeleteIndices ¶
FilterReadyToBeDeleteIndices filter indices that is ready to be deleted
func FilterToBeDeleteIndicies ¶
func FilterToBeDeleteIndicies(allInd []string, idxSt *IdxSetting) (indices []string, err error)
FilterToBeDeleteIndicies return the indices that need be delete
func GetAliasURL ¶
func GetAliasURL(st *IdxSetting) string
GetAliasURL return the ES alisese endpoint
func GetIdxRolloverReqBodyByIdxAlias ¶
func GetIdxRolloverReqBodyByIdxAlias(idxSt *IdxSetting) (jb *bytes.Buffer, err error)
func IsIdxIsWriteAlias ¶
func IsIdxIsWriteAlias(idx string, aliases []*AliasesResp) (ret bool)
IsIdxIsWriteAlias check is indices' alias is write-alias
func IsIdxShouldDelete ¶
IsIdxShouldDelete check whether a index is should tobe deleted dateStr like `2016.10.31`, treated as +0800
func LoadAllIndicesNames ¶
LoadAllIndicesNames load all indices name by ES API
func RemoveIndexByName ¶
RemoveIndexByName delete index by elasticsearch RESTful API
func RunDeleteTask ¶
func RunDeleteTask(ctx context.Context, sem *semaphore.Weighted, st *IdxSetting)
RunDeleteTask start to delete indices
func RunRolloverTask ¶
func RunRolloverTask(ctx context.Context, sem *semaphore.Weighted, st *IdxSetting)
Types ¶
type AliasesResp ¶
type AliasesResp struct {
Index string `json:"index"`
}
AliasesResp is the response of es aliases API
func LoadAliases ¶
func LoadAliases(url string) (aliases []*AliasesResp, err error)
LoadAliases load all indices aliases from ES
type IdxSetting ¶
type IdxSetting struct { Regexp *regexp.Regexp Rollover string Expires time.Duration IdxAlias string NRepls int NShards int IdxWriteAlias string Mapping template.HTML API string IsSkipCreate bool }
IdxSetting is the task settings
func LoadSettings ¶
func LoadSettings() (idxSettings []*IdxSetting, err error)
LoadSettings load task settings