Documentation
¶
Index ¶
- type Hook
- func (h *Hook) AfterBeginBlock(ctx sdk.Context, req abci.RequestBeginBlock, res abci.ResponseBeginBlock)
- func (h *Hook) AfterDeliverTx(ctx sdk.Context, req abci.RequestDeliverTx, res abci.ResponseDeliverTx)
- func (h *Hook) AfterEndBlock(ctx sdk.Context, req abci.RequestEndBlock, res abci.ResponseEndBlock)
- func (h *Hook) AfterInitChain(ctx sdk.Context, req abci.RequestInitChain, res abci.ResponseInitChain)
- func (h *Hook) ApplyQuery(req abci.RequestQuery) (res abci.ResponseQuery, stop bool)
- func (h *Hook) BeforeCommit()
- type RawReport
- type RawRequest
- type Report
- type Request
- type RequestedValidator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Hook ¶
type Hook struct {
// contains filtered or unexported fields
}
Hook inherits from Band app hook to save latest request into SQL database.
func (*Hook) AfterBeginBlock ¶
func (h *Hook) AfterBeginBlock(ctx sdk.Context, req abci.RequestBeginBlock, res abci.ResponseBeginBlock)
AfterBeginBlock specify actions need to do after begin block period (app.Hook interface).
func (*Hook) AfterDeliverTx ¶
func (h *Hook) AfterDeliverTx(ctx sdk.Context, req abci.RequestDeliverTx, res abci.ResponseDeliverTx)
AfterDeliverTx specify actions need to do after transaction has been processed (app.Hook interface).
func (*Hook) AfterEndBlock ¶
func (h *Hook) AfterEndBlock(ctx sdk.Context, req abci.RequestEndBlock, res abci.ResponseEndBlock)
AfterEndBlock specify actions need to do after end block period (app.Hook interface).
func (*Hook) AfterInitChain ¶
func (h *Hook) AfterInitChain(ctx sdk.Context, req abci.RequestInitChain, res abci.ResponseInitChain)
AfterInitChain specify actions need to do after chain initialization (app.Hook interface).
func (*Hook) ApplyQuery ¶
func (h *Hook) ApplyQuery(req abci.RequestQuery) (res abci.ResponseQuery, stop bool)
ApplyQuery catch the custom query that matches specific paths (app.Hook interface).
func (*Hook) BeforeCommit ¶
func (h *Hook) BeforeCommit()
BeforeCommit specify actions need to do before commit block (app.Hook interface).
type RawReport ¶
type RawReport struct {
gorm.Model
// ReportID is a foreign key of Report model
ReportID uint
ExternalID int64
// Data is proto's RawReport.data field encoded in base64
Data string `gorm:"size:1024"`
ExitCode uint32
}
RawReport is GORM model of RawReport proto message
func NewRawReport ¶
func NewRawReport(requestID types.RequestID, externalID types.ExternalID, data []byte, exitCode uint32) RawReport
NewRawReport creates new instance of RawReport
type RawRequest ¶
type RawRequest struct {
gorm.Model
// RequestID is a foreign key of Request model
RequestID uint
ExternalID int64
DataSourceID int64
// Calldata is proto's RawRequest.calldata field encoded in base64
Calldata string `gorm:"size:1024"`
}
RawRequest is GORM model of RawRequest proto message
func NewRawRequest ¶
func NewRawRequest(requestID types.RequestID, externalID types.ExternalID, dataSourceID types.DataSourceID, calldata []byte) RawRequest
NewRawRequest creates new instance of RawRequest
type Report ¶
type Report struct {
gorm.Model
// RequestID is a foreign key of Request model
RequestID uint
Validator string
RawReports []RawReport `gorm:"constraint:OnDelete:CASCADE"`
InBeforeResolve bool
}
Report is GORM model of Report proto message
func GenerateReportModel ¶
GenerateReportModel converts proto's Report to GORM's Report model
type Request ¶
type Request struct {
gorm.Model
OracleScriptID int64 `gorm:"index:idx_min_count_ask_count_oracle_script_id_calldata"`
// Calldata is proto's Request.calldata field encoded in base64
Calldata string `gorm:"index:idx_min_count_ask_count_oracle_script_id_calldata;size:1024"`
RequestedValidators []RequestedValidator `gorm:"constraint:OnDelete:CASCADE"`
MinCount uint64 `gorm:"index:idx_min_count_ask_count_oracle_script_id_calldata"`
AskCount uint64 `gorm:"index:idx_min_count_ask_count_oracle_script_id_calldata"`
AnsCount uint64
RequestHeight int64
RequestTime time.Time
ClientID string
RawRequests []RawRequest `gorm:"constraint:OnDelete:CASCADE"`
IBCPortID string
IBCChannelID string
ExecuteGas uint64
Reports []Report `gorm:"constraint:OnDelete:CASCADE"`
ResolveTime time.Time `gorm:"index:idx_min_count_ask_count_oracle_script_id_calldata"`
// ResolveStatus is proto's resolve_status but as enum string
ResolveStatus string `gorm:"size:64"`
// Result is proto's Result.result field encoded in OBI and base64
Result string `gorm:"size:1024"`
}
Request is GORM model of Request proto message combined with Result proto message
func GenerateRequestModel ¶
func GenerateRequestModel(data types.QueryRequestResponse) Request
GenerateRequestModel converts proto's QueryRequestResponse to GORM's Request model
func NewRequest ¶
func NewRequest( id types.RequestID, oracleScriptID types.OracleScriptID, calldata []byte, requestedValidators []RequestedValidator, minCount uint64, askCount uint64, clientID string, ansCount uint64, requestHeight int64, requestTimeUnix uint64, rawRequests []RawRequest, reports []Report, ibcChannel string, ibcPort string, executeGas uint64, resolveTimeUnix int64, resolveStatus types.ResolveStatus, result []byte, ) Request
NewRequest creates new instance of Request
func (Request) QueryRequestResponse ¶
func (r Request) QueryRequestResponse() types.QueryRequestResponse
QueryRequestResponse convert GORM's Request model to proto's QueryRequestResponse
type RequestedValidator ¶
type RequestedValidator struct {
gorm.Model
// RequestID is a foreign key of Request model
RequestID uint
Address string
}
RequestedValidator is GORM model of Request.requested_validators proto message
func NewRequestedValidator ¶
func NewRequestedValidator(requestID types.RequestID, address string) RequestedValidator
NewRequestedValidator creates new instance of RequestedValidator