entity

package
v0.7.4 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2026 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 NewBucketReplicationPolicy added in v0.7.3

func NewBucketReplicationPolicy(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 DiffCheckStatus added in v0.7.3

type DiffCheckStatus struct {
	Settings   DiffSettings
	Queue      DiffQueueStatus
	Consistent bool
}

type DiffFixCopyObject added in v0.7.3

type DiffFixCopyObject struct {
	Name  string
	IsDir bool
}

func NewDiffFixCopyObject added in v0.7.3

func NewDiffFixCopyObject(name string, isDir bool) DiffFixCopyObject

type DiffFixID added in v0.7.3

type DiffFixID struct {
	Destination string
	DiffID      DiffID
}

func NewDiffFixID added in v0.7.3

func NewDiffFixID(diffID DiffID, destination string) DiffFixID

type DiffID added in v0.7.3

type DiffID struct {
	Locations []DiffLocation
}

func NewDiffID added in v0.7.3

func NewDiffID(locations ...DiffLocation) DiffID

type DiffLocation added in v0.7.3

type DiffLocation struct {
	Storage string
	Bucket  string
}

func NewDiffLocation added in v0.7.3

func NewDiffLocation(storage string, bucket string) DiffLocation

type DiffObjectID added in v0.7.3

type DiffObjectID struct {
	Storage string
	Prefix  string
	DiffID  DiffID
}

func NewDiffObjectID added in v0.7.3

func NewDiffObjectID(diffID DiffID, storage string, prefix string) DiffObjectID

type DiffQueueStatus added in v0.7.3

type DiffQueueStatus struct {
	Queued    uint64
	Completed uint64
	Ready     bool
}

type DiffReportEntry added in v0.7.3

type DiffReportEntry struct {
	Object         string
	Etag           string
	StorageEntries []DiffSetEntry
	Size           uint64
	VersionIndex   uint64
}

func NewDiffReportEntry added in v0.7.3

func NewDiffReportEntry(object string, versionIndex uint64, size uint64, etag string, storageEntries []DiffSetEntry) DiffReportEntry

type DiffReportEntryPage added in v0.7.3

type DiffReportEntryPage struct {
	Entries []DiffReportEntry
	Cursor  uint64
}

func NewDiffReportEntryPage added in v0.7.3

func NewDiffReportEntryPage(entries []DiffReportEntry, cursor uint64) DiffReportEntryPage

type DiffSetEntry added in v0.7.3

type DiffSetEntry struct {
	Location  DiffLocation
	VersionID string
	IsDir     bool
}

func NewDiffSetEntry added in v0.7.3

func NewDiffSetEntry(location DiffLocation, isDir bool) DiffSetEntry

func NewVersionedDiffSetEntry added in v0.7.3

func NewVersionedDiffSetEntry(location DiffLocation, versionID string) DiffSetEntry

type DiffSetID added in v0.7.3

type DiffSetID struct {
	Object       string
	Etag         string
	DiffID       DiffID
	Size         uint64
	VersionIndex uint64
}

func NewEtagDiffSetID added in v0.7.3

func NewEtagDiffSetID(diffID DiffID, object string, size uint64, etag string) DiffSetID

func NewNameDiffSetID added in v0.7.3

func NewNameDiffSetID(diffID DiffID, object string) DiffSetID

func NewSizeDiffSetID added in v0.7.3

func NewSizeDiffSetID(diffID DiffID, object string, size uint64) DiffSetID

func NewVersionedEtagDiffSetID added in v0.7.3

func NewVersionedEtagDiffSetID(diffID DiffID, object string, versionIndex uint64, size uint64, etag string) DiffSetID

func NewVersionedNameDiffSetID added in v0.7.3

func NewVersionedNameDiffSetID(diffID DiffID, object string, versionIndex uint64) DiffSetID

func NewVersionedSizeDiffSetID added in v0.7.3

func NewVersionedSizeDiffSetID(diffID DiffID, object string, versionIndex uint64, size uint64) DiffSetID

type DiffSettings added in v0.7.3

type DiffSettings struct {
	User        string
	Versioned   bool
	IgnoreEtags bool
	IgnoreSizes bool
}

func NewDiffSettings added in v0.7.3

func NewDiffSettings(user string, versioned bool, ignoreSizes bool, ignoreEtags bool) DiffSettings

type DiffStatus added in v0.7.3

type DiffStatus struct {
	FixQueue  *DiffQueueStatus
	Locations []DiffLocation
	Check     DiffCheckStatus
}

type MigrationBucketID added in v0.7.0

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

func NewMigrationBucketIDFromUniversalReplicationID added in v0.7.0

func NewMigrationBucketIDFromUniversalReplicationID(replicationID UniversalReplicationID) MigrationBucketID

type MigrationObjectID added in v0.7.0

type MigrationObjectID struct {
	User        string
	FromStorage string
	ToStorage   string
	FromBucket  string
	ToBucket    string
	Prefix      string
}

func NewMigrationObjectID added in v0.7.0

func NewMigrationObjectID(user string, fromStorage string, fromBucket string, toStorage string, toBucket string, prefix string) MigrationObjectID

func NewMigrationObjectIDFromUniversalReplicationID added in v0.7.0

func NewMigrationObjectIDFromUniversalReplicationID(replicationID UniversalReplicationID, bucket string, prefix string) MigrationObjectID

func NewNonRecursiveMigrationObjectIDFromUniversalReplicationID added in v0.7.0

func NewNonRecursiveMigrationObjectIDFromUniversalReplicationID(replicationID UniversalReplicationID, bucket string) MigrationObjectID

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 ObjectVersionInfo added in v0.7.0

type ObjectVersionInfo struct {
	Version      string
	Size         uint64
	DeleteMarker bool
}

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 ReplicationOptions added in v0.7.0

type ReplicationOptions struct {
	AgentURL    string
	EventSource dom.EventSource
}

type ReplicationStatus

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

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

	// Options belongs to status to store in the same hash in Redis.
	// Embedded stucts are not supported by redis tag parser.
	// TODO: add other replication options here, like copy origin timestamp, etc.
	AgentURL    string `redis:"agent_url,omitempty"`
	EventSource string `redis:"event_source,omitempty"`

	IsArchived bool `redis:"archived"`
}

func StatusFromOptions added in v0.7.0

func StatusFromOptions(opts ReplicationOptions) ReplicationStatus

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 list buckets/object tasks.
	InitMigrationListing QueueStats
	// Aggregated stats for initial migration queues.
	InitMigration QueueStats
	// Aggregated stats for event migration queues.
	EventMigration QueueStats
}

func (*ReplicationStatusExtended) InitDone

func (r *ReplicationStatusExtended) InitDone() bool

func (*ReplicationStatusExtended) Latency added in v0.7.0

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 UserUploadObject added in v0.7.0

type UserUploadObject struct {
	Object   string
	UploadID string
}

func NewUserUploadObject added in v0.7.0

func NewUserUploadObject(object string, uploadID string) UserUploadObject

type UserUploadObjectID added in v0.7.0

type UserUploadObjectID struct {
	User   string
	Bucket string
}

func NewUserUploadObjectID added in v0.7.0

func NewUserUploadObjectID(user string, bucket string) UserUploadObjectID

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