deletion

package
v2.4.3 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2022 License: AGPL-3.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDeleteRequestNotFound = errors.New("could not find matching delete request")

Functions

This section is empty.

Types

type DeleteRequest

type DeleteRequest struct {
	RequestID string              `json:"request_id"`
	StartTime model.Time          `json:"start_time"`
	EndTime   model.Time          `json:"end_time"`
	Selectors []string            `json:"selectors"`
	Status    DeleteRequestStatus `json:"status"`
	CreatedAt model.Time          `json:"created_at"`

	UserID   string              `json:"-"`
	Matchers [][]*labels.Matcher `json:"-"`
}

DeleteRequest holds all the details about a delete request.

func (*DeleteRequest) IsDeleted

func (d *DeleteRequest) IsDeleted(entry retention.ChunkEntry) (bool, []model.Interval)

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 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

type DeleteRequestStatus

type DeleteRequestStatus string
const (
	StatusReceived  DeleteRequestStatus = "received"
	StatusProcessed DeleteRequestStatus = "processed"

	DeleteRequestsTableName = "delete_requests"
)

type DeleteRequestsManager

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

func NewDeleteRequestsManager

func NewDeleteRequestsManager(store DeleteRequestsStore, deleteRequestCancelPeriod time.Duration, registerer prometheus.Registerer) *DeleteRequestsManager

func (*DeleteRequestsManager) DropFromIndex

func (d *DeleteRequestsManager) DropFromIndex(_ retention.ChunkEntry, _ model.Time, _ model.Time) bool

func (*DeleteRequestsManager) Expired

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) Stop

func (d *DeleteRequestsManager) Stop()

type DeleteRequestsStore

type DeleteRequestsStore interface {
	AddDeleteRequest(ctx context.Context, userID string, startTime, endTime model.Time, selectors []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
	Stop()
}

func NewDeleteStore

func NewDeleteStore(workingDirectory string, indexStorageClient storage.Client) (DeleteRequestsStore, error)

NewDeleteStore creates a store for managing delete requests.

func NewDeleteStoreFromIndexClient

func NewDeleteStoreFromIndexClient(ic chunk.IndexClient) DeleteRequestsStore

func NewNoOpDeleteRequestsStore

func NewNoOpDeleteRequestsStore() DeleteRequestsStore

Jump to

Keyboard shortcuts

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