Documentation
¶
Index ¶
- func CreateClient() (clientUUID, token string, err error)
- func CreateClientWithName(name string) (clientUUID, token string, err error)
- func DeleteClient(clientUuid string) error
- func GetAllClientBasicInfo() (clients []models.Client, err error)
- func GetClientByUUID(uuid string) (client models.Client, err error)
- func GetClientTokenByUUID(uuid string) (token string, err error)
- func GetClientUUIDByToken(token string) (clientUUID string, err error)
- func HiddenClients() (map[string]bool, error)
- func ReportVerify(report v2.Report) error
- func SaveClient(updates map[string]interface{}) error
- func SaveClientInfo(update map[string]interface{}) error
- type ClientInfoApplier
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateClientWithName ¶
func DeleteClient ¶
func GetAllClientBasicInfo ¶
func GetClientByUUID ¶
// GetAllClients 获取所有客户端配置
func getAllClients() (clients []models.Client, err error) {
db := dbcore.GetDBInstance()
err = db.Find(&clients).Error
if err != nil {
return nil, err
}
return clients, nil
}
func GetClientTokenByUUID ¶
func GetClientUUIDByToken ¶
func HiddenClients ¶ added in v0.1.13
HiddenClients returns the uuid/hidden map for every client. Successful client writes invalidate the cache immediately; only uuid/hidden are loaded, never tokens or hardware details.
The result is a copy the caller owns. It used to hand back the cached map itself, so the "immutable snapshot" in the old comment was a convention rather than a property: one caller deleting or assigning an entry silently changed what every later caller saw, until the next client write refreshed the cache.
func SaveClient ¶
func SaveClientInfo ¶
Types ¶
type ClientInfoApplier ¶ added in v0.1.36
type ClientInfoApplier struct{}
ClientInfoApplier adapts SaveClient to internal/bulk's Applier.
It exists so bulk edits run through the *same* validation as a single-node edit rather than a second implementation of the rules, which is the whole reason `internal/bulk` takes an interface instead of a database handle. Two things about SaveClient make the adapter worth being explicit about rather than inlining a call:
- It **writes into the map it is given** — `updated_at` is set on it, and `expired_at` is normalised in place. `bulk.Apply` hands each node its own copy for that reason, so one node's timestamp cannot land on the next node's request.
- It returns the applier's own error text, which is what the per-node report shows. A generic "failed" would make the operator re-derive the reason by hand.
func (ClientInfoApplier) SaveClientInfo ¶ added in v0.1.36
func (ClientInfoApplier) SaveClientInfo(update map[string]interface{}) error
SaveClientInfo applies one partial update. Named for the operation, not the receiver, so it satisfies bulk.Applier without the caller importing this package's shape.