objectttl

package
v1.36.0 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2026 License: BSD-3-Clause Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Coordinator

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

func NewCoordinator

func NewCoordinator(schemaReader schemaUC.SchemaReader, schemaGetter schemaUC.SchemaGetter, db *db.DB,
	logger logrus.FieldLogger, clusterClient *http.Client, nodeResolver nodeResolver, localStatus *LocalStatus,
) *Coordinator

func (*Coordinator) Abort added in v1.36.0

func (c *Coordinator) Abort(ctx context.Context, targetOwnNode bool) (bool, error)

func (*Coordinator) Start

func (c *Coordinator) Start(ctx context.Context, targetOwnNode bool, ttlTime, deletionTime time.Time) error

Start triggers the deletion of expired objects.

It is expected to be called periodically, e.g., via a cron job on the RAFT Leader to ensure that there are no parallel executions running. The RAFT leader will send a request to a remote node in multi-node clusters as the coordinator of the next deletion run to not add any additional load on the leader. In single-node clusters, it will execute the deletion locally.

There should always only one deletion run ongoing at any time. In case of remote deletions it will check with the last node used for deletion if the previous run is still ongoing and skip the current run if so.

type DeletedCounters added in v1.36.0

type DeletedCounters map[string]*atomic.Int32

func (DeletedCounters) ToLogFields added in v1.36.0

func (dc DeletedCounters) ToLogFields(maxCollectionNameLen int) (fields logrus.Fields, total int32)

type LocalStatus added in v1.36.0

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

LocalStatus keeps status of ongoing TTL deletion on local node. isRunning is set to true when TTL deletion start and reset when finishes. Status is global per node. Only one deletion can run at a time, following requests to start new deletion should be rejected until ongoing one finishes. When running flag is set new context is created to be passed to started process. Context can be cancelled by abort call, which should eventually stop ongoing deletion. Abort call do not change isRunning flag. It is changed when deletion is actually finished, as context can be verified with delay.

func NewLocalStatus added in v1.36.0

func NewLocalStatus() *LocalStatus

func (*LocalStatus) IsRunning added in v1.36.0

func (s *LocalStatus) IsRunning() bool

func (*LocalStatus) ResetRunning added in v1.36.0

func (s *LocalStatus) ResetRunning(cause string) (success bool)

func (*LocalStatus) SetRunning added in v1.36.0

func (s *LocalStatus) SetRunning() (success bool, ctx context.Context)

type ObjectsExpiredAbortResponse added in v1.36.0

type ObjectsExpiredAbortResponse struct {
	Aborted bool `json:"aborted"`
}

func (ObjectsExpiredAbortResponse) CheckContentTypeHeader added in v1.36.0

func (p ObjectsExpiredAbortResponse) CheckContentTypeHeader(r *http.Response) (string, bool)

func (ObjectsExpiredAbortResponse) MIME added in v1.36.0

func (ObjectsExpiredAbortResponse) SetContentTypeHeader added in v1.36.0

func (p ObjectsExpiredAbortResponse) SetContentTypeHeader(w http.ResponseWriter)

type ObjectsExpiredPayload

type ObjectsExpiredPayload struct {
	Class        string `json:"class"`
	ClassVersion uint64 `json:"class_version"`
	Prop         string `json:"prop"`
	TtlMilli     int64  `json:"ttlMilli"`
	DelMilli     int64  `json:"delMilli"`
}

func (ObjectsExpiredPayload) CheckContentTypeHeaderReq

func (p ObjectsExpiredPayload) CheckContentTypeHeaderReq(r *http.Request) (string, bool)

func (ObjectsExpiredPayload) MIME

func (p ObjectsExpiredPayload) MIME() string

func (ObjectsExpiredPayload) SetContentTypeHeaderReq

func (p ObjectsExpiredPayload) SetContentTypeHeaderReq(r *http.Request)

type ObjectsExpiredStatusResponse

type ObjectsExpiredStatusResponse struct {
	DeletionOngoing bool `json:"deletion_ongoing"`
}

func (ObjectsExpiredStatusResponse) CheckContentTypeHeader added in v1.36.0

func (p ObjectsExpiredStatusResponse) CheckContentTypeHeader(r *http.Response) (string, bool)

func (ObjectsExpiredStatusResponse) MIME

func (ObjectsExpiredStatusResponse) SetContentTypeHeader

func (p ObjectsExpiredStatusResponse) SetContentTypeHeader(w http.ResponseWriter)

Jump to

Keyboard shortcuts

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