storage

package
v0.0.0-...-f1a580a Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunMigrations

func RunMigrations(dbConf *config.Storage) error

Types

type DB

type DB struct {
	*gorp.DbMap
}

func NewDB

func NewDB(dbConn *sql.DB) *DB

func (*DB) CreateOrUpdateStageAndStatusForIndex

func (db *DB) CreateOrUpdateStageAndStatusForIndex(requestId int, index string, stage string, status string, updateTime time.Time) error

func (*DB) DeleteReindexRequest

func (db *DB) DeleteReindexRequest(requestID int) error

Delete a reindex request

func (*DB) DeleteReindexRequestDetail

func (db *DB) DeleteReindexRequestDetail(id int) error

Delete a reindex request detail

func (*DB) GetLatestReindexRequestID

func (db *DB) GetLatestReindexRequestID() (int, error)

func (*DB) GetReindexStatus

func (db *DB) GetReindexStatus(requestID int) (*StatusResponse, error)

Get the latest reindex request status for a given request

func (*DB) GetStageForIndex

func (db *DB) GetStageForIndex(requestId int, index string) ([]*StageDetail, error)

func (*DB) InsertReindexRequest

func (db *DB) InsertReindexRequest(status string, currentTime time.Time) (int, error)

Create a new reindex request with a random request_id

func (*DB) InsertReindexRequestDetailed

func (db *DB) InsertReindexRequestDetailed(detail ReindexRequestDetailed, currentTime time.Time) error

Insert reindex request detailed entry

func (*DB) UpdateAliasesForIndex

func (db *DB) UpdateAliasesForIndex(index string, hasAlias bool, alias []string, requestID int, currentTime time.Time) error

func (*DB) UpdateReindexRequest

func (db *DB) UpdateReindexRequest(requestID int, status string, currentTime time.Time) error

Update an existing reindex request

func (*DB) UpdateReindexStatus

func (db *DB) UpdateReindexStatus(requestID int, index, status string, timestamp time.Time) error

func (*DB) UpdateStageDetailsForIndex

func (db *DB) UpdateStageDetailsForIndex(requestId int, index string, stageDetails []*StageDetail) error

func (*DB) UpdateTaskIDForReindexRequest

func (db *DB) UpdateTaskIDForReindexRequest(requestID int, indexName string, taskID string, currentTime time.Time) error

type IndexStatusDetail

type IndexStatusDetail struct {
	Index  string `json:"index"`
	Stage  string `json:"stage"`
	Status string `json:"status"`
}

type ReindexRequest

type ReindexRequest struct {
	ID          int       `db:"id"`
	Status      string    `db:"status"`
	CreatedAt   time.Time `db:"created_at"`
	LastUpdated time.Time `db:"last_updated"`
}

ReindexRequest represents the reindex_requests table

type ReindexRequestDetailed

type ReindexRequestDetailed struct {
	ID          int           `db:"id"`
	RequestID   int           `db:"request_id"`
	Index       string        `db:"index"`
	FromVersion string        `db:"from_version"`
	ToVersion   string        `db:"to_version"`
	Stage       []StageDetail `db:"stage"`
	OsTaskID    string        `db:"os_task_id"`
	Heartbeat   time.Time     `db:"heartbeat"`
	HavingAlias bool          `db:"having_alias"`
	AliasList   string        `db:"alias_list"`
	CreatedAt   time.Time     `db:"created_at"`
	UpdatedAt   time.Time     `db:"updated_at"`
}

ReindexRequestDetailed represents the reindex_request_detailed table

type StageDetail

type StageDetail struct {
	Stage     string    `json:"stage"`
	Status    string    `json:"status"`
	UpdatedAt time.Time `json:"updated_at"`
}

type StatusResponse

type StatusResponse struct {
	RequestID int                 `json:"request_id"`
	Status    string              `json:"status"`
	Indexes   []IndexStatusDetail `json:"indexes"`
}

StatusResponse represents the response structure for reindex status

Jump to

Keyboard shortcuts

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