purger

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2021 License: Apache-2.0 Imports: 42 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusReceived     DeleteRequestStatus = "received"
	StatusBuildingPlan DeleteRequestStatus = "buildingPlan"
	StatusDeleting     DeleteRequestStatus = "deleting"
	StatusProcessed    DeleteRequestStatus = "processed"

	// CacheKindStore is for cache gen number for store cache
	CacheKindStore CacheKind = "store"
	// CacheKindResults is for cache gen number for results cache
	CacheKindResults CacheKind = "results"
)

Variables

View Source
var (
	ErrInvalidLengthDeletePlan = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowDeletePlan   = fmt.Errorf("proto: integer overflow")
)
View Source
var (
	ErrDeleteRequestNotFound = errors.New("could not find matching delete request")
)

Functions

This section is empty.

Types

type CacheKind added in v1.1.0

type CacheKind string

type ChunkDetails

type ChunkDetails struct {
	ID                       string    `protobuf:"bytes,1,opt,name=ID,proto3" json:"ID,omitempty"`
	PartiallyDeletedInterval *Interval `` /* 135-byte string literal not displayed */
}

func (*ChunkDetails) Descriptor

func (*ChunkDetails) Descriptor() ([]byte, []int)

func (*ChunkDetails) Equal

func (this *ChunkDetails) Equal(that interface{}) bool

func (*ChunkDetails) GetID

func (m *ChunkDetails) GetID() string

func (*ChunkDetails) GetPartiallyDeletedInterval

func (m *ChunkDetails) GetPartiallyDeletedInterval() *Interval

func (*ChunkDetails) GoString

func (this *ChunkDetails) GoString() string

func (*ChunkDetails) Marshal

func (m *ChunkDetails) Marshal() (dAtA []byte, err error)

func (*ChunkDetails) MarshalTo

func (m *ChunkDetails) MarshalTo(dAtA []byte) (int, error)

func (*ChunkDetails) MarshalToSizedBuffer

func (m *ChunkDetails) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*ChunkDetails) ProtoMessage

func (*ChunkDetails) ProtoMessage()

func (*ChunkDetails) Reset

func (m *ChunkDetails) Reset()

func (*ChunkDetails) Size

func (m *ChunkDetails) Size() (n int)

func (*ChunkDetails) String

func (this *ChunkDetails) String() string

func (*ChunkDetails) Unmarshal

func (m *ChunkDetails) Unmarshal(dAtA []byte) error

func (*ChunkDetails) XXX_DiscardUnknown

func (m *ChunkDetails) XXX_DiscardUnknown()

func (*ChunkDetails) XXX_Marshal

func (m *ChunkDetails) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ChunkDetails) XXX_Merge

func (m *ChunkDetails) XXX_Merge(src proto.Message)

func (*ChunkDetails) XXX_Size

func (m *ChunkDetails) XXX_Size() int

func (*ChunkDetails) XXX_Unmarshal

func (m *ChunkDetails) XXX_Unmarshal(b []byte) error

type ChunksGroup

type ChunksGroup struct {
	Labels []github_com_cortexproject_cortex_pkg_cortexpb.LabelAdapter `protobuf:"bytes,1,rep,name=labels,proto3,customtype=github.com/cortexproject/cortex/pkg/cortexpb.LabelAdapter" json:"labels"`
	Chunks []ChunkDetails                                              `protobuf:"bytes,2,rep,name=chunks,proto3" json:"chunks"`
}

ChunksGroup holds ChunkDetails and Labels for a group of chunks which have same series ID

func (*ChunksGroup) Descriptor

func (*ChunksGroup) Descriptor() ([]byte, []int)

func (*ChunksGroup) Equal

func (this *ChunksGroup) Equal(that interface{}) bool

func (*ChunksGroup) GetChunks

func (m *ChunksGroup) GetChunks() []ChunkDetails

func (*ChunksGroup) GoString

func (this *ChunksGroup) GoString() string

func (*ChunksGroup) Marshal

func (m *ChunksGroup) Marshal() (dAtA []byte, err error)

func (*ChunksGroup) MarshalTo

func (m *ChunksGroup) MarshalTo(dAtA []byte) (int, error)

func (*ChunksGroup) MarshalToSizedBuffer

func (m *ChunksGroup) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*ChunksGroup) ProtoMessage

func (*ChunksGroup) ProtoMessage()

func (*ChunksGroup) Reset

func (m *ChunksGroup) Reset()

func (*ChunksGroup) Size

func (m *ChunksGroup) Size() (n int)

func (*ChunksGroup) String

func (this *ChunksGroup) String() string

func (*ChunksGroup) Unmarshal

func (m *ChunksGroup) Unmarshal(dAtA []byte) error

func (*ChunksGroup) XXX_DiscardUnknown

func (m *ChunksGroup) XXX_DiscardUnknown()

func (*ChunksGroup) XXX_Marshal

func (m *ChunksGroup) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ChunksGroup) XXX_Merge

func (m *ChunksGroup) XXX_Merge(src proto.Message)

func (*ChunksGroup) XXX_Size

func (m *ChunksGroup) XXX_Size() int

func (*ChunksGroup) XXX_Unmarshal

func (m *ChunksGroup) XXX_Unmarshal(b []byte) error

type Config

type Config struct {
	Enable                    bool          `yaml:"enable"`
	NumWorkers                int           `yaml:"num_workers"`
	ObjectStoreType           string        `yaml:"object_store_type"`
	DeleteRequestCancelPeriod time.Duration `yaml:"delete_request_cancel_period"`
}

Config holds config for chunks Purger

func (*Config) RegisterFlags

func (cfg *Config) RegisterFlags(f *flag.FlagSet)

RegisterFlags registers CLI flags for Config

type DeletePlan

type DeletePlan struct {
	PlanInterval *Interval     `protobuf:"bytes,1,opt,name=plan_interval,json=planInterval,proto3" json:"plan_interval,omitempty"`
	ChunksGroup  []ChunksGroup `protobuf:"bytes,2,rep,name=chunks_group,json=chunksGroup,proto3" json:"chunks_group"`
}

DeletePlan holds all the chunks that are supposed to be deleted within an interval(usually a day) This Proto file is used just for storing Delete Plans in proto format.

func (*DeletePlan) Descriptor

func (*DeletePlan) Descriptor() ([]byte, []int)

func (*DeletePlan) Equal

func (this *DeletePlan) Equal(that interface{}) bool

func (*DeletePlan) GetChunksGroup

func (m *DeletePlan) GetChunksGroup() []ChunksGroup

func (*DeletePlan) GetPlanInterval

func (m *DeletePlan) GetPlanInterval() *Interval

func (*DeletePlan) GoString

func (this *DeletePlan) GoString() string

func (*DeletePlan) Marshal

func (m *DeletePlan) Marshal() (dAtA []byte, err error)

func (*DeletePlan) MarshalTo

func (m *DeletePlan) MarshalTo(dAtA []byte) (int, error)

func (*DeletePlan) MarshalToSizedBuffer

func (m *DeletePlan) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*DeletePlan) ProtoMessage

func (*DeletePlan) ProtoMessage()

func (*DeletePlan) Reset

func (m *DeletePlan) Reset()

func (*DeletePlan) Size

func (m *DeletePlan) Size() (n int)

func (*DeletePlan) String

func (this *DeletePlan) String() string

func (*DeletePlan) Unmarshal

func (m *DeletePlan) Unmarshal(dAtA []byte) error

func (*DeletePlan) XXX_DiscardUnknown

func (m *DeletePlan) XXX_DiscardUnknown()

func (*DeletePlan) XXX_Marshal

func (m *DeletePlan) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*DeletePlan) XXX_Merge

func (m *DeletePlan) XXX_Merge(src proto.Message)

func (*DeletePlan) XXX_Size

func (m *DeletePlan) XXX_Size() int

func (*DeletePlan) XXX_Unmarshal

func (m *DeletePlan) XXX_Unmarshal(b []byte) error

type DeleteRequest added in v1.0.0

type DeleteRequest struct {
	RequestID string              `json:"request_id"`
	UserID    string              `json:"-"`
	StartTime model.Time          `json:"start_time"`
	EndTime   model.Time          `json:"end_time"`
	Selectors []string            `json:"selectors"`
	Status    DeleteRequestStatus `json:"status"`
	Matchers  [][]*labels.Matcher `json:"-"`
	CreatedAt model.Time          `json:"created_at"`
}

DeleteRequest holds all the details about a delete request.

type DeleteRequestHandler

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

DeleteRequestHandler provides handlers for delete requests

func NewDeleteRequestHandler

func NewDeleteRequestHandler(deleteStore *DeleteStore, 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 added in v1.2.0

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 added in v1.0.0

type DeleteRequestStatus string

type DeleteStore added in v1.0.0

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

DeleteStore provides all the methods required to manage lifecycle of delete request and things related to it.

func NewDeleteStore added in v1.0.0

func NewDeleteStore(cfg DeleteStoreConfig, indexClient chunk.IndexClient) (*DeleteStore, error)

NewDeleteStore creates a store for managing delete requests.

func (*DeleteStore) AddDeleteRequest added in v1.0.0

func (ds *DeleteStore) AddDeleteRequest(ctx context.Context, userID string, startTime, endTime model.Time, selectors []string) error

Add creates entries for a new delete request.

func (*DeleteStore) GetAllDeleteRequestsForUser added in v1.0.0

func (ds *DeleteStore) GetAllDeleteRequestsForUser(ctx context.Context, userID string) ([]DeleteRequest, error)

GetAllDeleteRequestsForUser returns all delete requests for a user.

func (*DeleteStore) GetDeleteRequest added in v1.0.0

func (ds *DeleteStore) GetDeleteRequest(ctx context.Context, userID, requestID string) (*DeleteRequest, error)

GetDeleteRequest returns delete request with given requestID.

func (*DeleteStore) GetDeleteRequestsByStatus added in v1.0.0

func (ds *DeleteStore) GetDeleteRequestsByStatus(ctx context.Context, status DeleteRequestStatus) ([]DeleteRequest, error)

GetDeleteRequestsByStatus returns all delete requests for given status.

func (*DeleteStore) GetDeleteRequestsForUserByStatus added in v1.0.0

func (ds *DeleteStore) GetDeleteRequestsForUserByStatus(ctx context.Context, userID string, status DeleteRequestStatus) ([]DeleteRequest, error)

GetDeleteRequestsForUserByStatus returns all delete requests for a user with given status.

func (*DeleteStore) GetPendingDeleteRequestsForUser added in v1.0.0

func (ds *DeleteStore) GetPendingDeleteRequestsForUser(ctx context.Context, userID string) ([]DeleteRequest, error)

GetPendingDeleteRequestsForUser returns all delete requests for a user which are not processed.

func (*DeleteStore) RemoveDeleteRequest added in v1.2.0

func (ds *DeleteStore) RemoveDeleteRequest(ctx context.Context, userID, requestID string, createdAt, startTime, endTime model.Time) error

RemoveDeleteRequest removes a delete request and increments cache gen number

func (*DeleteStore) UpdateStatus added in v1.0.0

func (ds *DeleteStore) UpdateStatus(ctx context.Context, userID, requestID string, newStatus DeleteRequestStatus) error

UpdateStatus updates status of a delete request.

type DeleteStoreAPI added in v1.4.0

type DeleteStoreAPI interface {
	GetPendingDeleteRequestsForUser(ctx context.Context, id string) ([]DeleteRequest, error)
	// contains filtered or unexported methods
}

Used for easier injection of mocks.

type DeleteStoreConfig added in v1.0.0

type DeleteStoreConfig struct {
	Store             string                  `yaml:"store"`
	RequestsTableName string                  `yaml:"requests_table_name"`
	ProvisionConfig   TableProvisioningConfig `yaml:"table_provisioning"`
}

DeleteStoreConfig holds configuration for delete store.

func (DeleteStoreConfig) GetTables added in v1.2.0

func (cfg DeleteStoreConfig) GetTables() []chunk.TableDesc

func (*DeleteStoreConfig) RegisterFlags added in v1.0.0

func (cfg *DeleteStoreConfig) RegisterFlags(f *flag.FlagSet)

RegisterFlags adds the flags required to configure this flag set.

type DeleteTenantStatusResponse added in v1.6.0

type DeleteTenantStatusResponse struct {
	TenantID      string `json:"tenant_id"`
	BlocksDeleted bool   `json:"blocks_deleted"`
}

type Interval

type Interval struct {
	StartTimestampMs int64 `protobuf:"varint,1,opt,name=start_timestamp_ms,json=startTimestampMs,proto3" json:"start_timestamp_ms,omitempty"`
	EndTimestampMs   int64 `protobuf:"varint,2,opt,name=end_timestamp_ms,json=endTimestampMs,proto3" json:"end_timestamp_ms,omitempty"`
}

func (*Interval) Descriptor

func (*Interval) Descriptor() ([]byte, []int)

func (*Interval) Equal

func (this *Interval) Equal(that interface{}) bool

func (*Interval) GetEndTimestampMs

func (m *Interval) GetEndTimestampMs() int64

func (*Interval) GetStartTimestampMs

func (m *Interval) GetStartTimestampMs() int64

func (*Interval) GoString

func (this *Interval) GoString() string

func (*Interval) Marshal

func (m *Interval) Marshal() (dAtA []byte, err error)

func (*Interval) MarshalTo

func (m *Interval) MarshalTo(dAtA []byte) (int, error)

func (*Interval) MarshalToSizedBuffer

func (m *Interval) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Interval) ProtoMessage

func (*Interval) ProtoMessage()

func (*Interval) Reset

func (m *Interval) Reset()

func (*Interval) Size

func (m *Interval) Size() (n int)

func (*Interval) String

func (this *Interval) String() string

func (*Interval) Unmarshal

func (m *Interval) Unmarshal(dAtA []byte) error

func (*Interval) XXX_DiscardUnknown

func (m *Interval) XXX_DiscardUnknown()

func (*Interval) XXX_Marshal

func (m *Interval) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Interval) XXX_Merge

func (m *Interval) XXX_Merge(src proto.Message)

func (*Interval) XXX_Size

func (m *Interval) XXX_Size() int

func (*Interval) XXX_Unmarshal

func (m *Interval) XXX_Unmarshal(b []byte) error

type Purger added in v1.2.0

type Purger struct {
	services.Service
	// contains filtered or unexported fields
}

Purger does the purging of data which is requested to be deleted. Purger only works for chunks.

func NewPurger added in v1.2.0

func NewPurger(cfg Config, deleteStore *DeleteStore, chunkStore chunk.Store, storageClient chunk.ObjectClient, registerer prometheus.Registerer) (*Purger, error)

NewPurger creates a new Purger

type TableProvisioningConfig added in v1.2.0

type TableProvisioningConfig struct {
	chunk.ActiveTableProvisionConfig `yaml:",inline"`
	TableTags                        chunk.Tags `yaml:"tags"`
}

TableProvisioningConfig holds config for table throuput and autoscaling. Currently only used by DynamoDB.

func (*TableProvisioningConfig) RegisterFlags added in v1.2.0

func (cfg *TableProvisioningConfig) RegisterFlags(argPrefix string, f *flag.FlagSet)

RegisterFlags adds the flags required to config this to the given FlagSet. Adding a separate RegisterFlags here instead of using it from embedded chunk.ActiveTableProvisionConfig to be able to manage defaults separately. Defaults for WriteScale and ReadScale are shared for now to avoid adding further complexity since autoscaling is disabled anyways by default.

type TenantDeletionAPI added in v1.8.0

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

func NewTenantDeletionAPI added in v1.8.0

func NewTenantDeletionAPI(storageCfg cortex_tsdb.BlocksStorageConfig, cfgProvider bucket.TenantConfigProvider, logger log.Logger, reg prometheus.Registerer) (*TenantDeletionAPI, error)

func (*TenantDeletionAPI) DeleteTenant added in v1.8.0

func (api *TenantDeletionAPI) DeleteTenant(w http.ResponseWriter, r *http.Request)

func (*TenantDeletionAPI) DeleteTenantStatus added in v1.8.0

func (api *TenantDeletionAPI) DeleteTenantStatus(w http.ResponseWriter, r *http.Request)

type TombstonesLoader added in v1.0.0

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

TombstonesLoader loads delete requests and gen numbers from store and keeps checking for updates. It keeps checking for changes in gen numbers, which also means changes in delete requests and reloads specific users delete requests.

func NewTombstonesLoader added in v1.0.0

func NewTombstonesLoader(deleteStore DeleteStoreAPI, registerer prometheus.Registerer) *TombstonesLoader

NewTombstonesLoader creates a TombstonesLoader

func (*TombstonesLoader) GetPendingTombstones added in v1.0.0

func (tl *TombstonesLoader) GetPendingTombstones(userID string) (*TombstonesSet, error)

GetPendingTombstones returns all pending tombstones

func (*TombstonesLoader) GetPendingTombstonesForInterval added in v1.0.0

func (tl *TombstonesLoader) GetPendingTombstonesForInterval(userID string, from, to model.Time) (*TombstonesSet, error)

GetPendingTombstones returns all pending tombstones

func (*TombstonesLoader) GetResultsCacheGenNumber added in v1.1.0

func (tl *TombstonesLoader) GetResultsCacheGenNumber(tenantIDs []string) string

GetResultsCacheGenNumber returns results cache gen number for a user

func (*TombstonesLoader) GetStoreCacheGenNumber added in v1.1.0

func (tl *TombstonesLoader) GetStoreCacheGenNumber(tenantIDs []string) string

GetStoreCacheGenNumber returns store cache gen number for a user

func (*TombstonesLoader) Stop added in v1.0.0

func (tl *TombstonesLoader) Stop()

Stop stops TombstonesLoader

type TombstonesSet added in v1.0.0

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

TombstonesSet holds all the pending delete requests for a user

func (TombstonesSet) GetDeletedIntervals added in v1.0.0

func (ts TombstonesSet) GetDeletedIntervals(lbls labels.Labels, from, to model.Time) []model.Interval

GetDeletedIntervals returns non-overlapping, sorted deleted intervals.

func (TombstonesSet) HasTombstonesForInterval added in v1.0.0

func (ts TombstonesSet) HasTombstonesForInterval(from, to model.Time) bool

HasTombstonesForInterval tells whether there are any tombstones which overlapping given interval

func (TombstonesSet) Len added in v1.0.0

func (ts TombstonesSet) Len() int

Len returns number of tombstones that are there

Jump to

Keyboard shortcuts

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