MCPcopy Create free account
hub / github.com/akash-network/provider / AddPreparedEndpoint

Method AddPreparedEndpoint

operator/common/operator_server.go:68–88  ·  view source on GitHub ↗
(path string, prepare PrepareFn)

Source from the content-addressed store, hash-verified

66}
67
68func (opHttp *operatorHTTP) AddPreparedEndpoint(path string, prepare PrepareFn) PrepareFlagFn {
69 if prepare == nil {
70 panic("passed nil value for prepare function")
71 }
72 _, exists := opHttp.results[path]
73 if exists {
74 panic("prepared result exists for path: " + path)
75 }
76
77 entry := preparedEntry{
78 data: newPreparedResult(),
79 prepare: prepare,
80 }
81 opHttp.results[path] = entry
82
83 opHttp.router.HandleFunc(path, func(rw http.ResponseWriter, _ *http.Request) {
84 servePreparedResult(rw, entry.data)
85 }).Methods(http.MethodGet)
86
87 return entry.data.Flag
88}
89
90func (opHttp *operatorHTTP) PrepareAll() error {
91 for _, entry := range opHttp.results {

Callers

nothing calls this directly

Calls 2

newPreparedResultFunction · 0.85
servePreparedResultFunction · 0.85

Tested by

no test coverage detected