// LoadRecord populates action.Record func (action *AccountShowAction) LoadRecord() { action.LoadQuery() if action.Err != nil { return } action.Err = db.Get(action.Ctx, action.Query, &action.Record) }
// UpdateMetrics triggers a refresh of several metrics gauges, such as open // db connections and ledger state func (a *App) UpdateLedgerState() { var ls db.LedgerState q := db.LedgerStateQuery{a.HistoryQuery(), a.CoreQuery()} err := db.Get(context.Background(), q, &ls) if err != nil { log.WithStack(err). WithField("err", err.Error()). Error("failed to load ledger state") return } a.latestLedgerState = ls }
// JSON is a method for actions.JSON func (action *LedgerShowAction) JSON() { query := action.Query() if action.Err != nil { return } action.Err = db.Get(action.Ctx, query, &action.Record) if action.Err != nil { return } hal.Render(action.W, NewLedgerResource(action.Record)) }
// JSON is a method for actions.JSON func (action *OperationShowAction) JSON() { query := action.Query() if action.Err != nil { return } action.Err = db.Get(action.Ctx, query, &action.Record) if action.Err != nil { return } r, err := NewOperationResource(action.Record) if err != nil { return } hal.Render(action.W, r) }
// UpdateMetrics triggers a refresh of several metrics gauges, such as open // db connections and ledger state func (a *App) UpdateMetrics(ctx context.Context) { a.goroutineGauge.Update(int64(runtime.NumGoroutine())) var ls db.LedgerState q := db.LedgerStateQuery{a.HistoryQuery(), a.CoreQuery()} err := db.Get(ctx, q, &ls) if err != nil { log.WithStack(ctx, err). WithField("err", err.Error()). Error("failed to load ledger state") return } a.horizonLedgerGauge.Update(int64(ls.HorizonSequence)) a.stellarCoreLedgerGauge.Update(int64(ls.StellarCoreSequence)) a.horizonConnGauge.Update(int64(a.historyDb.Stats().OpenConnections)) a.stellarCoreConnGauge.Update(int64(a.coreDb.Stats().OpenConnections)) }
func (action *LedgerShowAction) LoadRecord() { action.Err = db.Get(action.Ctx, action.Query, &action.Record) }
func (action *OperationShowAction) LoadRecord() { action.Err = db.Get(action.Ctx, action.Query, &action.Record) }
// LoadRecord populates action.Record func (action *AccountShowAction) LoadRecord() { action.Err = db.Get(action.Ctx, action.Query, &action.Record) }