feat: publish standalone worker
Separate worker packaging and service lifecycle from the control plane.
Этот коммит содержится в:
36
app/models/server_ip.go
Обычный файл
36
app/models/server_ip.go
Обычный файл
@@ -0,0 +1,36 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"rsgit.ru/rsmon/rsmon/app/models/concerns"
|
||||
)
|
||||
|
||||
// ServerIp is a single IP (v4 or v6) bound to a Server. The
|
||||
// canonical source for these rows is the deploymentd server-inventory
|
||||
// receiver (M1) and the network-diagnostics partial plan; today the
|
||||
// only writer is operator-entered via /api/v1/servers/:id/ips.
|
||||
//
|
||||
// `address` is Postgres `inet` so range queries (`<<` / `>>`) work
|
||||
// without parsing text. One row per (server_id, address). The
|
||||
// `is_primary` flag is set when more than one IP exists and the
|
||||
// deploymentd payload signals a primary; otherwise the first row wins.
|
||||
//
|
||||
//nolint:revive // ServerIP rename deferred to M3; rstuff schema uses ServerIp verbatim and parity test depends on it.
|
||||
type ServerIp struct {
|
||||
concerns.Model
|
||||
|
||||
ServerID int64 `gorm:"type:bigint REFERENCES servers(id) ON DELETE CASCADE;not null;index" json:"server_id"`
|
||||
Server *Server `json:"-"`
|
||||
// Address is mapped to Postgres inet via raw SQL in Migrate(); the
|
||||
// GORM `type:` tag is not enough because gorm.io/driver/postgres
|
||||
// does not register `inet` in its type map. Field is stored as a
|
||||
// string and validated by the API layer (see
|
||||
// app/controllers/api/server.go ServerIPsAdd).
|
||||
Address string `gorm:"type:inet;not null" json:"address"`
|
||||
IsPrimary bool `gorm:"not null;default:false" json:"is_primary"`
|
||||
RelatedSitesCount int `gorm:"not null;default:0" json:"related_sites_count"`
|
||||
|
||||
concerns.Timestamped
|
||||
}
|
||||
|
||||
// TableName provides functionality.
|
||||
func (ServerIp) TableName() string { return "server_ips" }
|
||||
Ссылка в новой задаче
Block a user