purger

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2020 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

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 ChunkDetails

type ChunkDetails struct {
	ID                       string    `protobuf:"bytes,1,opt,name=ID,json=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_ingester_client.LabelAdapter `` /* 131-byte string literal not displayed */
	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"`
}

Config holds config for DataPurger

func (*Config) RegisterFlags

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

RegisterFlags registers CLI flags for Config

type DataPurger

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

DataPurger does the purging of data which is requested to be deleted

func NewDataPurger

func NewDataPurger(cfg Config, deleteStore *DeleteStore, chunkStore chunk.Store, storageClient chunk.ObjectClient) (*DataPurger, error)

NewDataPurger creates a new DataPurger

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) (*DeleteRequestHandler, error)

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) 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
const (
	StatusReceived     DeleteRequestStatus = "received"
	StatusBuildingPlan DeleteRequestStatus = "buildingPlan"
	StatusDeleting     DeleteRequestStatus = "deleting"
	StatusProcessed    DeleteRequestStatus = "processed"
)

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

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

DeleteStoreConfig holds configuration for delete store

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 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 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 *DeleteStore) *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) 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