sourceApi

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FileSource SourceType = "file"
	WebSource  SourceType = "web"

	SourceStateUnknown    SourceState = "Unknown"
	SourceStatePending    SourceState = "Pending"
	SourceStateScheduling SourceState = "Scheduling"
	SourceStateProcessing SourceState = "Processing"
	SourceStateIdle       SourceState = "Idle"
	SourceStateReady      SourceState = "ReadyToUse"
	SourceStateFailed     SourceState = "Failed"
	SourceStateDropped    SourceState = "Dropped"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DatabaseRequest

type DatabaseRequest struct {
	Name         string `yaml:"name" json:"name" validate:"required,max=63,id" binding:"required,max=63,id" help:"Name of the database"`
	Owner        string `yaml:"owner" json:"owner" validate:"required,max=63,id" binding:"required,max=63,id" help:"Owner of the database"`
	PasswordFile string `yaml:"password_file" json:"-" validate:"required,file" binding:"-" help:"Path to the password file of the database owner"`
	Password     string `yaml:"-" json:"password" binding:"required,min=8,max=256" help:"Password of the database owner"`

	InstanceName string `` /* 137-byte string literal not displayed */
	MigrateFrom  string `` /* 155-byte string literal not displayed */
	BackupPath   string `yaml:"backup_path" json:"-" validate:"omitempty,file" binding:"-" help:"Path to the backup file"`
}

func (*DatabaseRequest) GetName

func (s *DatabaseRequest) GetName() string

func (*DatabaseRequest) IsConfigChanged

func (s *DatabaseRequest) IsConfigChanged(newSource *DatabaseRequest) bool

func (*DatabaseRequest) PasswordContent

func (s *DatabaseRequest) PasswordContent() (string, error)

type DatabaseSource

type DatabaseSource struct {
	*DatabaseRequest

	Type SourceType `yaml:"-"`

	DatabaseSourceStatus
}

func (*DatabaseSource) NextRetryDelay

func (s *DatabaseSource) NextRetryDelay() time.Duration

func (*DatabaseSource) ResetRetryDelay

func (s *DatabaseSource) ResetRetryDelay()

func (*DatabaseSource) Synced

func (s *DatabaseSource) Synced() bool

func (*DatabaseSource) UpdateState

func (s *DatabaseSource) UpdateState(dbStatus *grpcServerApi.DbStatusResponse) bool

type DatabaseSourceStatus

type DatabaseSourceStatus struct {
	ExpectState SourceState `yaml:"-"`
	State       SourceState `yaml:"-"`
	UpdatedAt   time.Time   `yaml:"-"`

	RetryDelay int `yaml:"-"`
	RetryTimes int `yaml:"-"`

	LastErrorMsg    string    `yaml:"-"`
	LastScheduledAt time.Time `yaml:"-"`
	NextScheduleAt  time.Time `yaml:"-"`
}

type SourceAdder

type SourceAdder interface {
	AddDatabaseSource(source *DatabaseSource) error
}

type SourceGetter

type SourceGetter interface {
	IsReady(name string, instName string) bool
	GetSource(name string) *DatabaseSource
}

type SourceHandler

type SourceHandler interface {
	SourceAdder
	SourceRemover
	SourceGetter
}

type SourceRemover

type SourceRemover interface {
	MarkDatabaseSourceIdle(name string) error
}

type SourceState

type SourceState string

type SourceType

type SourceType string

Jump to

Keyboard shortcuts

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