Documentation ¶
Index ¶
- Variables
- func TenantMiddleware(limits Limits, next http.Handler) http.Handler
- type DeleteRequest
- type DeleteRequestClientMetrics
- type DeleteRequestHandler
- func (dm *DeleteRequestHandler) AddDeleteRequestHandler(w http.ResponseWriter, r *http.Request)
- func (dm *DeleteRequestHandler) CancelDeleteRequestHandler(w http.ResponseWriter, r *http.Request)
- func (dm *DeleteRequestHandler) GetAllDeleteRequestsHandler(w http.ResponseWriter, r *http.Request)
- func (dm *DeleteRequestHandler) GetCacheGenerationNumberHandler(w http.ResponseWriter, r *http.Request)
- type DeleteRequestStatus
- type DeleteRequestsClient
- type DeleteRequestsManager
- func (d *DeleteRequestsManager) DropFromIndex(_ retention.ChunkEntry, _ model.Time, _ model.Time) bool
- func (d *DeleteRequestsManager) Expired(ref retention.ChunkEntry, _ model.Time) (bool, []retention.IntervalFilter)
- func (d *DeleteRequestsManager) IntervalMayHaveExpiredChunks(_ model.Interval, userID string) bool
- func (d *DeleteRequestsManager) MarkPhaseFailed()
- func (d *DeleteRequestsManager) MarkPhaseFinished()
- func (d *DeleteRequestsManager) MarkPhaseStarted()
- func (d *DeleteRequestsManager) MarkPhaseTimedOut()
- func (d *DeleteRequestsManager) Stop()
- type DeleteRequestsStore
- type DeleteRequestsStoreOption
- type Limits
Constants ¶
This section is empty.
Variables ¶
var ErrDeleteRequestNotFound = errors.New("could not find matching delete request")
Functions ¶
Types ¶
type DeleteRequest ¶
type DeleteRequest struct { RequestID string `json:"request_id"` StartTime model.Time `json:"start_time"` EndTime model.Time `json:"end_time"` Query string `json:"query"` Status DeleteRequestStatus `json:"status"` CreatedAt model.Time `json:"created_at"` UserID string `json:"-"` Metrics *deleteRequestsManagerMetrics `json:"-"` DeletedLines int32 `json:"-"` // contains filtered or unexported fields }
func (*DeleteRequest) FilterFunction ¶
FilterFunction returns a filter function that returns true if the given line matches
func (*DeleteRequest) IsDeleted ¶
func (d *DeleteRequest) IsDeleted(entry retention.ChunkEntry) (bool, []retention.IntervalFilter)
IsDeleted checks if the given ChunkEntry will be deleted by this DeleteRequest. It also returns the intervals of the ChunkEntry that will remain before filtering.
func (*DeleteRequest) SetQuery ¶
func (d *DeleteRequest) SetQuery(logQL string) error
type DeleteRequestClientMetrics ¶
type DeleteRequestClientMetrics struct {
// contains filtered or unexported fields
}
func NewDeleteRequestClientMetrics ¶
func NewDeleteRequestClientMetrics(r prometheus.Registerer) *DeleteRequestClientMetrics
type DeleteRequestHandler ¶
type DeleteRequestHandler struct {
// contains filtered or unexported fields
}
DeleteRequestHandler provides handlers for delete requests
func NewDeleteRequestHandler ¶
func NewDeleteRequestHandler(deleteStore DeleteRequestsStore, deleteRequestCancelPeriod time.Duration, registerer prometheus.Registerer) *DeleteRequestHandler
NewDeleteRequestHandler creates a DeleteRequestHandler
func (*DeleteRequestHandler) AddDeleteRequestHandler ¶
func (dm *DeleteRequestHandler) AddDeleteRequestHandler(w http.ResponseWriter, r *http.Request)
AddDeleteRequestHandler handles addition of a new delete request
func (*DeleteRequestHandler) CancelDeleteRequestHandler ¶
func (dm *DeleteRequestHandler) CancelDeleteRequestHandler(w http.ResponseWriter, r *http.Request)
CancelDeleteRequestHandler handles delete request cancellation
func (*DeleteRequestHandler) GetAllDeleteRequestsHandler ¶
func (dm *DeleteRequestHandler) GetAllDeleteRequestsHandler(w http.ResponseWriter, r *http.Request)
GetAllDeleteRequestsHandler handles get all delete requests
func (*DeleteRequestHandler) GetCacheGenerationNumberHandler ¶
func (dm *DeleteRequestHandler) GetCacheGenerationNumberHandler(w http.ResponseWriter, r *http.Request)
GetCacheGenerationNumberHandler handles requests for a user's cache generation number
type DeleteRequestStatus ¶
type DeleteRequestStatus string
const ( StatusReceived DeleteRequestStatus = "received" StatusProcessed DeleteRequestStatus = "processed" DeleteRequestsTableName = "delete_requests" )
type DeleteRequestsClient ¶
type DeleteRequestsClient interface { GetAllDeleteRequestsForUser(ctx context.Context, userID string) ([]DeleteRequest, error) Stop() }
func NewDeleteRequestsClient ¶
func NewDeleteRequestsClient(addr string, c httpClient, deleteClientMetrics *DeleteRequestClientMetrics, clientType string, opts ...DeleteRequestsStoreOption) (DeleteRequestsClient, error)
func NewPerTenantDeleteRequestsClient ¶
func NewPerTenantDeleteRequestsClient(c DeleteRequestsClient, l Limits) DeleteRequestsClient
type DeleteRequestsManager ¶
type DeleteRequestsManager struct {
// contains filtered or unexported fields
}
func NewDeleteRequestsManager ¶
func NewDeleteRequestsManager(store DeleteRequestsStore, deleteRequestCancelPeriod time.Duration, batchSize int, limits Limits, registerer prometheus.Registerer) *DeleteRequestsManager
func (*DeleteRequestsManager) DropFromIndex ¶
func (d *DeleteRequestsManager) DropFromIndex(_ retention.ChunkEntry, _ model.Time, _ model.Time) bool
func (*DeleteRequestsManager) Expired ¶
func (d *DeleteRequestsManager) Expired(ref retention.ChunkEntry, _ model.Time) (bool, []retention.IntervalFilter)
func (*DeleteRequestsManager) IntervalMayHaveExpiredChunks ¶
func (d *DeleteRequestsManager) IntervalMayHaveExpiredChunks(_ model.Interval, userID string) bool
func (*DeleteRequestsManager) MarkPhaseFailed ¶
func (d *DeleteRequestsManager) MarkPhaseFailed()
func (*DeleteRequestsManager) MarkPhaseFinished ¶
func (d *DeleteRequestsManager) MarkPhaseFinished()
func (*DeleteRequestsManager) MarkPhaseStarted ¶
func (d *DeleteRequestsManager) MarkPhaseStarted()
func (*DeleteRequestsManager) MarkPhaseTimedOut ¶
func (d *DeleteRequestsManager) MarkPhaseTimedOut()
func (*DeleteRequestsManager) Stop ¶
func (d *DeleteRequestsManager) Stop()
type DeleteRequestsStore ¶
type DeleteRequestsStore interface { AddDeleteRequest(ctx context.Context, userID string, startTime, endTime model.Time, query string) error GetDeleteRequestsByStatus(ctx context.Context, status DeleteRequestStatus) ([]DeleteRequest, error) GetAllDeleteRequestsForUser(ctx context.Context, userID string) ([]DeleteRequest, error) UpdateStatus(ctx context.Context, userID, requestID string, newStatus DeleteRequestStatus) error GetDeleteRequest(ctx context.Context, userID, requestID string) (*DeleteRequest, error) RemoveDeleteRequest(ctx context.Context, userID, requestID string, createdAt, startTime, endTime model.Time) error GetCacheGenerationNumber(ctx context.Context, userID string) (string, error) Stop() Name() string }
func NewDeleteStore ¶
func NewDeleteStore(workingDirectory string, indexStorageClient storage.Client) (DeleteRequestsStore, error)
NewDeleteStore creates a store for managing delete requests.
func NewDeleteStoreFromIndexClient ¶
func NewDeleteStoreFromIndexClient(ic index.Client) DeleteRequestsStore
func NewNoOpDeleteRequestsStore ¶
func NewNoOpDeleteRequestsStore() DeleteRequestsStore
type DeleteRequestsStoreOption ¶
type DeleteRequestsStoreOption func(c *deleteRequestsClient)
func WithRequestClientCacheDuration ¶
func WithRequestClientCacheDuration(d time.Duration) DeleteRequestsStoreOption