policy

package
v0.5.13 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ReplicationPolicies

type ReplicationPolicies struct {
	From string
	To   map[ReplicationPolicyDest]tasks.Priority
}

type ReplicationPolicyDest added in v0.5.13

type ReplicationPolicyDest string

func (ReplicationPolicyDest) Parse added in v0.5.13

func (d ReplicationPolicyDest) Parse() (storage string, bucket *string)

type ReplicationPolicyStatus

type ReplicationPolicyStatus struct {
	CreatedAt       time.Time `redis:"created_at"`
	IsPaused        bool      `redis:"paused"`
	InitObjListed   int64     `redis:"obj_listed"`
	InitObjDone     int64     `redis:"obj_done"`
	InitBytesListed int64     `redis:"bytes_listed"`
	InitBytesDone   int64     `redis:"bytes_done"`
	Events          int64     `redis:"events"`
	EventsDone      int64     `redis:"events_done"`
	AgentURL        string    `redis:"agent_url,omitempty"`

	InitDoneAt      *time.Time `redis:"init_done_at,omitempty"`
	LastEmittedAt   *time.Time `redis:"last_emitted_at,omitempty"`
	LastProcessedAt *time.Time `redis:"last_processed_at,omitempty"`

	ListingStarted bool `redis:"listing_started"`

	SwitchStatus SwitchStatus `redis:"-"`
}

type ReplicationPolicyStatusExtended

type ReplicationPolicyStatusExtended struct {
	ReplicationPolicyStatus
	User     string
	Bucket   string
	From     string
	To       string
	ToBucket *string
}

type ReplicationSwitch

type ReplicationSwitch struct {
	IsDone       bool          `redis:"IsDone"`
	OldMain      string        `redis:"OldMain"`
	OldFollowers string        `redis:"OldFollowers"`
	MultipartTTL time.Duration `redis:"MultipartTTL"`
	StartedAt    time.Time     `redis:"StartedAt"`
	DoneAt       *time.Time    `redis:"DoneAt,omitempty"`
}

func (*ReplicationSwitch) GetOldFollowers

func (r *ReplicationSwitch) GetOldFollowers() map[ReplicationPolicyDest]tasks.Priority

func (*ReplicationSwitch) SetOldFollowers added in v0.5.2

func (r *ReplicationSwitch) SetOldFollowers(f map[ReplicationPolicyDest]tasks.Priority)

type Service

type Service interface {
	// GetRoutingPolicy returns destination storage name.
	// Errors:
	//   dom.ErrRoutingBlock - if access to bucket should be blocked because bucket is used as replication destination.
	//   dom.ErrNotFound - if replication is not configured.
	GetRoutingPolicy(ctx context.Context, user, bucket string) (string, error)

	GetUserRoutingPolicy(ctx context.Context, user string) (string, error)
	AddUserRoutingPolicy(ctx context.Context, user, toStorage string) error

	IsReplicationSwitchInProgress(ctx context.Context, user, bucket string) (bool, error)
	GetReplicationSwitch(ctx context.Context, user, bucket string) (ReplicationSwitch, error)
	DoReplicationSwitch(ctx context.Context, user, bucket, newMain string) error
	ReplicationSwitchDone(ctx context.Context, user, bucket string) error

	GetBucketReplicationPolicies(ctx context.Context, user, bucket string) (ReplicationPolicies, error)
	GetUserReplicationPolicies(ctx context.Context, user string) (ReplicationPolicies, error)
	AddUserReplicationPolicy(ctx context.Context, user string, from string, to string, priority tasks.Priority) error
	DeleteUserReplication(ctx context.Context, user string, from string, to string) error

	AddBucketReplicationPolicy(ctx context.Context, user, bucket, from string, to string, toBucket *string, priority tasks.Priority, agentURL *string) error
	GetReplicationPolicyInfo(ctx context.Context, user, bucket, from, to string, toBucket *string) (ReplicationPolicyStatus, error)
	ListReplicationPolicyInfo(ctx context.Context) ([]ReplicationPolicyStatusExtended, error)
	IsReplicationPolicyExists(ctx context.Context, user, bucket, from, to string, toBucket *string) (bool, error)
	IsReplicationPolicyPaused(ctx context.Context, user, bucket, from, to string, toBucket *string) (bool, error)
	IncReplInitObjListed(ctx context.Context, user, bucket, from, to string, toBucket *string, bytes int64, eventTime time.Time) error
	IncReplInitObjDone(ctx context.Context, user, bucket, from, to string, toBucket *string, bytes int64, eventTime time.Time) error
	ObjListStarted(ctx context.Context, user, bucket, from, to string, toBucket *string) error
	IncReplEvents(ctx context.Context, user, bucket, from, to string, toBucket *string, eventTime time.Time) error
	IncReplEventsDone(ctx context.Context, user, bucket, from, to string, toBucket *string, eventTime time.Time) error

	PauseReplication(ctx context.Context, user, bucket, from string, to string, toBucket *string) error
	ResumeReplication(ctx context.Context, user, bucket, from string, to string, toBucket *string) error
	DeleteReplication(ctx context.Context, user, bucket, from string, to string, toBucket *string) error
	DeleteBucketReplicationsByUser(ctx context.Context, user, from string, to string) ([]string, error)
	// contains filtered or unexported methods
}

func NewService

func NewService(client redis.UniversalClient) Service

type SwitchStatus added in v0.5.2

type SwitchStatus int
const (
	NotStarted SwitchStatus = iota
	InProgress
	Done
)

Jump to

Keyboard shortcuts

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