entity

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// TimeNow is a function to get current time
	// it is a variable so that it can be mocked in tests
	TimeNow = time.Now
)

Functions

This section is empty.

Types

type BucketLockID

type BucketLockID struct {
	Storage string
	Bucket  string
}

func NewBucketLockID

func NewBucketLockID(storage string, bucket string) BucketLockID

type BucketReplicationPolicy

type BucketReplicationPolicy struct {
	User        string
	FromStorage string
	FromBucket  string
	ToStorage   string
	ToBucket    string
}

func NewBucketRepliationPolicy

func NewBucketRepliationPolicy(user string, fromStorage string, fromBucket string, toStorage string, toBucket string) BucketReplicationPolicy

func (BucketReplicationPolicy) Destination

func (BucketReplicationPolicy) LookupID

func (BucketReplicationPolicy) RoutingID

func (BucketReplicationPolicy) Validate

func (p BucketReplicationPolicy) Validate() error

type BucketReplicationPolicyDestination

type BucketReplicationPolicyDestination struct {
	ToStorage string
	ToBucket  string
}

type BucketReplicationPolicyID

type BucketReplicationPolicyID struct {
	User       string
	FromBucket string
}

func NewBucketReplicationPolicyID

func NewBucketReplicationPolicyID(user string, fromBucket string) BucketReplicationPolicyID

type BucketRoutingPolicyID

type BucketRoutingPolicyID struct {
	User   string
	Bucket string
}

func NewBucketRoutingPolicyID

func NewBucketRoutingPolicyID(user string, bucket string) BucketRoutingPolicyID

type ConsistencyCheckID

type ConsistencyCheckID struct {
	Locations []ConsistencyCheckLocation
}

func NewConsistencyCheckID

func NewConsistencyCheckID(locations ...ConsistencyCheckLocation) ConsistencyCheckID

type ConsistencyCheckLocation

type ConsistencyCheckLocation struct {
	Storage string
	Bucket  string
}

func NewConsistencyCheckLocation

func NewConsistencyCheckLocation(storage string, bucket string) ConsistencyCheckLocation

type ConsistencyCheckObjectID

type ConsistencyCheckObjectID struct {
	Storage            string
	Prefix             string
	ConsistencyCheckID ConsistencyCheckID
}

func NewConsistencyCheckObjectID

func NewConsistencyCheckObjectID(consistencyCheckID ConsistencyCheckID, storage string, prefix string) ConsistencyCheckObjectID

type ConsistencyCheckReportEntry

type ConsistencyCheckReportEntry struct {
	Object         string
	Etag           string
	StorageEntries []ConsistencyCheckSetEntry
	Size           uint64
	VersionIndex   uint64
}

func NewConsistencyCheckReportEntry

func NewConsistencyCheckReportEntry(object string, versionIndex uint64, size uint64, etag string, storageEntries []ConsistencyCheckSetEntry) ConsistencyCheckReportEntry

type ConsistencyCheckReportEntryPage

type ConsistencyCheckReportEntryPage struct {
	Entries []ConsistencyCheckReportEntry
	Cursor  uint64
}

func NewConsistencyCheckReportEntryPage

func NewConsistencyCheckReportEntryPage(entries []ConsistencyCheckReportEntry, cursor uint64) ConsistencyCheckReportEntryPage

type ConsistencyCheckSetEntry

type ConsistencyCheckSetEntry struct {
	Location  ConsistencyCheckLocation
	VersionID string
}

func NewConsistencyCheckSetEntry

func NewConsistencyCheckSetEntry(location ConsistencyCheckLocation) ConsistencyCheckSetEntry

func NewVersionedConsistencyCheckSetEntry

func NewVersionedConsistencyCheckSetEntry(location ConsistencyCheckLocation, versionID string) ConsistencyCheckSetEntry

type ConsistencyCheckSetID

type ConsistencyCheckSetID struct {
	Object             string
	Etag               string
	ConsistencyCheckID ConsistencyCheckID
	Size               uint64
	VersionIndex       uint64
}

func NewEtagConsistencyCheckSetID

func NewEtagConsistencyCheckSetID(consistencyCheckID ConsistencyCheckID, object string, size uint64, etag string) ConsistencyCheckSetID

func NewNameConsistencyCheckSetID

func NewNameConsistencyCheckSetID(consistencyCheckID ConsistencyCheckID, object string) ConsistencyCheckSetID

func NewSizeConsistencyCheckSetID

func NewSizeConsistencyCheckSetID(consistencyCheckID ConsistencyCheckID, object string, size uint64) ConsistencyCheckSetID

func NewVersionedEtagConsistencyCheckSetID

func NewVersionedEtagConsistencyCheckSetID(consistencyCheckID ConsistencyCheckID, object string, versionIndex uint64, size uint64, etag string) ConsistencyCheckSetID

func NewVersionedNameConsistencyCheckSetID

func NewVersionedNameConsistencyCheckSetID(consistencyCheckID ConsistencyCheckID, object string, versionIndex uint64) ConsistencyCheckSetID

func NewVersionedSizeConsistencyCheckSetID

func NewVersionedSizeConsistencyCheckSetID(consistencyCheckID ConsistencyCheckID, object string, versionIndex uint64, size uint64) ConsistencyCheckSetID

type ConsistencyCheckSettings

type ConsistencyCheckSettings struct {
	Versioned bool
	WithSize  bool
	WithEtag  bool
}

func NewConsistencyCheckSettings

func NewConsistencyCheckSettings(versioned bool, withSize bool, withEtag bool) ConsistencyCheckSettings

type ConsistencyCheckStatus

type ConsistencyCheckStatus struct {
	Locations  []ConsistencyCheckLocation
	Queued     uint64
	Completed  uint64
	Ready      bool
	Consistent bool
	ConsistencyCheckSettings
}

type ObjectLockID

type ObjectLockID struct {
	Storage string
	Bucket  string
	Name    string
	Version string
}

func NewObjectLockID

func NewObjectLockID(storage string, bucket string, name string) ObjectLockID

func NewVersionedObjectLockID

func NewVersionedObjectLockID(storage string, bucket string, name string, version string) ObjectLockID

type QueueStats

type QueueStats struct {
	// Number of tasks left. Includes, new, in_progress, and retried tasks.
	Unprocessed int
	// Total number of successfully processed tasks.
	Done int
	// Age of the oldest pending task in the queue.
	Latency time.Duration
	// Approx bytes used by the queue and its tasks in Redis.
	MemoryUsage int64
}

type ReplicationStatus

type ReplicationStatus struct {
	CreatedAt time.Time `redis:"created_at"`

	ArchivedAt *time.Time `redis:"archived_at,omitempty"`
	AgentURL   string     `redis:"agent_url,omitempty"`

	IsArchived bool `redis:"archived"`
}

type ReplicationStatusExtended

type ReplicationStatusExtended struct {
	*ReplicationStatus
	Switch *ReplicationSwitchInfo `redis:"-"`

	// True if at least one of the queues is paused.
	IsPaused bool
	// Aggregated stats for initial migration queues.
	InitMigration QueueStats
	// Aggregated stats for event migration queues.
	EventMigration QueueStats
}

func (*ReplicationStatusExtended) InitDone

func (r *ReplicationStatusExtended) InitDone() bool

type ReplicationSwitchDowntimeOpts

type ReplicationSwitchDowntimeOpts struct {
	Cron                *string       `redis:"cron,omitempty"`
	StartAt             *time.Time    `redis:"startAt,omitempty"`
	MaxEventLag         *uint32       `redis:"maxEventLag,omitempty"`
	MaxDuration         time.Duration `redis:"maxDuration,omitempty"`
	StartOnInitDone     bool          `redis:"onInitDone"`
	SkipBucketCheck     bool          `redis:"skipBucketCheck,omitempty"`
	ContinueReplication bool          `redis:"continueReplication,omitempty"`
}

func (*ReplicationSwitchDowntimeOpts) GetCron

func (w *ReplicationSwitchDowntimeOpts) GetCron() (string, bool)

func (*ReplicationSwitchDowntimeOpts) GetMaxDuration

func (w *ReplicationSwitchDowntimeOpts) GetMaxDuration() (time.Duration, bool)

func (*ReplicationSwitchDowntimeOpts) GetMaxEventLag

func (w *ReplicationSwitchDowntimeOpts) GetMaxEventLag() (uint32, bool)

func (*ReplicationSwitchDowntimeOpts) GetStartAt

func (w *ReplicationSwitchDowntimeOpts) GetStartAt() (time.Time, bool)

type ReplicationSwitchInfo

type ReplicationSwitchInfo struct {
	// Time of switch creation
	CreatedAt time.Time `redis:"createdAt"`
	// Time of last switch was in progress
	LastStartedAt *time.Time `redis:"startedAt,omitempty"`
	// Time of last switch was done
	DoneAt *time.Time `redis:"doneAt,omitempty"`
	// Options for downtime switch
	ReplicationSwitchDowntimeOpts
	// ID of replication policy of this switch
	ReplicationIDStr string `redis:"replicationID"`
	// Last status of switch
	LastStatus ReplicationSwitchStatus `redis:"lastStatus,omitempty"`
	// History of switch status changes
	History []string `redis:"-"`
	// Options for zero downtime switch
	ReplicationSwitchZeroDowntimeOpts
}

Contains all information about replication switch including its configuration and current status.

func (*ReplicationSwitchInfo) GetLastStartAt

func (s *ReplicationSwitchInfo) GetLastStartAt() (time.Time, bool)

func (*ReplicationSwitchInfo) IsTimeToStart

func (s *ReplicationSwitchInfo) IsTimeToStart() (bool, error)

func (*ReplicationSwitchInfo) IsZeroDowntime

func (s *ReplicationSwitchInfo) IsZeroDowntime() bool

func (*ReplicationSwitchInfo) ReplicationID

func (s *ReplicationSwitchInfo) ReplicationID() UniversalReplicationID

func (*ReplicationSwitchInfo) SetReplicationID

func (s *ReplicationSwitchInfo) SetReplicationID(id UniversalReplicationID)

func (*ReplicationSwitchInfo) Validate

func (s *ReplicationSwitchInfo) Validate() error

type ReplicationSwitchStatus

type ReplicationSwitchStatus string
const (
	// StatusNotStarted means that switch donwntime is not started yet
	// Relevant only for downtime switches
	StatusNotStarted ReplicationSwitchStatus = "not_started"
	// StatusInProgress means that downtime is started, bucket is blocked until task queue is drained or timeout
	StatusInProgress ReplicationSwitchStatus = "in_progress"
	// StatusCheckInProgress means that task queue is drained and bucket is blocked until src and dst bucket contents will be checked
	// Relevant only for downtime switches
	StatusCheckInProgress ReplicationSwitchStatus = "check_in_progress"
	// StatusDone means that switch is successfully finished and data is routed to new bucket.
	StatusDone ReplicationSwitchStatus = "done"
	// StatusError means that switch was aborted due to error
	// Relevant only for downtime switches
	StatusError ReplicationSwitchStatus = "error"
	// StatusSkipped means that switch attempt was skipped because conditions were not met
	// Relevant only for downtime switches
	StatusSkipped ReplicationSwitchStatus = "skipped"
)

func (ReplicationSwitchStatus) MarshalBinary

func (s ReplicationSwitchStatus) MarshalBinary() (data []byte, err error)

func (*ReplicationSwitchStatus) UnmarshalBinary

func (s *ReplicationSwitchStatus) UnmarshalBinary(data []byte) error

type ReplicationSwitchZeroDowntimeOpts

type ReplicationSwitchZeroDowntimeOpts struct {
	MultipartTTL time.Duration `redis:"multipartTTL,omitempty"`
}

type UniversalReplicationID

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

func UniversalFromUserReplication

func UniversalFromUserReplication(policy UserReplicationPolicy) UniversalReplicationID

func UniversalIDFromString

func UniversalIDFromString(s string) (UniversalReplicationID, error)

func (*UniversalReplicationID) AsBucketID

func (*UniversalReplicationID) AsString

func (r *UniversalReplicationID) AsString() string

func (*UniversalReplicationID) AsUserID

func (*UniversalReplicationID) FromStorage

func (r *UniversalReplicationID) FromStorage() string

func (*UniversalReplicationID) FromToBuckets

func (r *UniversalReplicationID) FromToBuckets(taskBucket string) (from, to string)

func (*UniversalReplicationID) IsEmpty

func (r *UniversalReplicationID) IsEmpty() bool

func (UniversalReplicationID) MarshalJSON

func (r UniversalReplicationID) MarshalJSON() ([]byte, error)

func (*UniversalReplicationID) Swap

Returns a new UniversalReplicationID with swapped source and destination

func (*UniversalReplicationID) ToStorage

func (r *UniversalReplicationID) ToStorage() string

func (*UniversalReplicationID) UnmarshalJSON

func (r *UniversalReplicationID) UnmarshalJSON(data []byte) error

func (*UniversalReplicationID) User

func (r *UniversalReplicationID) User() string

func (*UniversalReplicationID) Validate

func (r *UniversalReplicationID) Validate() error

type UserReplicationPolicy

type UserReplicationPolicy struct {
	User        string
	FromStorage string
	ToStorage   string
}

func NewUserReplicationPolicy

func NewUserReplicationPolicy(user string, fromStorage string, toStorage string) UserReplicationPolicy

func (UserReplicationPolicy) LookupID

func (p UserReplicationPolicy) LookupID() string

func (UserReplicationPolicy) RoutingID

func (p UserReplicationPolicy) RoutingID() string

func (UserReplicationPolicy) Validate

func (p UserReplicationPolicy) Validate() error

type VersionedObjectID

type VersionedObjectID struct {
	Storage string
	Bucket  string
	Name    string
}

func NewVersionedObjectID

func NewVersionedObjectID(storage string, bucket string, name string) VersionedObjectID

Jump to

Keyboard shortcuts

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