예제 #1
0
// 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)
}
예제 #2
0
파일: app.go 프로젝트: zenododobird/horizon
// 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
}
예제 #3
0
// 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))
}
예제 #4
0
// 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)
}
예제 #5
0
파일: app.go 프로젝트: raymens/horizon
// 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))
}
예제 #6
0
func (action *LedgerShowAction) LoadRecord() {
	action.Err = db.Get(action.Ctx, action.Query, &action.Record)
}
예제 #7
0
func (action *OperationShowAction) LoadRecord() {
	action.Err = db.Get(action.Ctx, action.Query, &action.Record)
}
예제 #8
0
// LoadRecord populates action.Record
func (action *AccountShowAction) LoadRecord() {
	action.Err = db.Get(action.Ctx, action.Query, &action.Record)
}