MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / Query

Method Query

xenomint/chain.go:63–94  ·  view source on GitHub ↗

Query queries req from local chain state and returns the query results in resp.

(req *types.Request)

Source from the content-addressed store, hash-verified

61
62// Query queries req from local chain state and returns the query results in resp.
63func (c *Chain) Query(req *types.Request) (resp *types.Response, err error) {
64 var (
65 ref *QueryTracker
66 start = time.Now()
67
68 queried, signed, updated time.Duration
69 )
70 defer func() {
71 var fields = log.Fields{}
72 if queried > 0 {
73 fields["1#queried"] = float64(queried.Nanoseconds()) / 1000
74 }
75 if signed > 0 {
76 fields["2#signed"] = float64((signed - queried).Nanoseconds()) / 1000
77 }
78 if updated > 0 {
79 fields["3#updated"] = float64((updated - signed).Nanoseconds()) / 1000
80 }
81 log.WithFields(fields).Debug("Chain.Query duration stat (us)")
82 }()
83 if ref, resp, err = c.state.Query(req, true); err != nil {
84 return
85 }
86 queried = time.Since(start)
87 if err = resp.BuildHash(); err != nil {
88 return
89 }
90 signed = time.Since(start)
91 ref.UpdateResp(resp)
92 updated = time.Since(start)
93 return
94}
95
96// Stop stops chain workers and RPC service.
97func (c *Chain) Stop() (err error) {

Callers

nothing calls this directly

Calls 5

WithFieldsFunction · 0.92
DebugMethod · 0.80
UpdateRespMethod · 0.80
QueryMethod · 0.65
BuildHashMethod · 0.45

Tested by

no test coverage detected