Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HandleRequest ¶
func HandleRequest[Request any, Response ResponseTo[Request]](handler RequestHandler[Request, Response]) func(*nats.Msg)
HandleRequest returns a NATS subscription target that calls the provided request handler in a new goroutine if the NATS message payload can be parsed into the specified request type, and responds to the client appropriately.
func UnmarshalResponse ¶
UnmarshalResponse parses a response received from the job server, either into a result of the specified type, or as an error; depending on the response's structure.
Types ¶
type Cache ¶
type Cache[V any] struct { // contains filtered or unexported fields }
type CacheStats ¶
type CacheStats struct {
// contains filtered or unexported fields
}
func (*CacheStats) Count ¶
func (c *CacheStats) Count() uint64
Count returns the total count of cache accesses.
func (*CacheStats) Hits ¶
func (c *CacheStats) Hits() uint64
Hits returns the count of cache accesses that resulted in a hit.
func (*CacheStats) RecordMiss ¶
func (c *CacheStats) RecordMiss()
type Graph ¶
type Graph struct {
// contains filtered or unexported fields
}
Graph keeps track of a directed acyclic graph.
func (*Graph) AddEdge ¶
AddEdge adds a new edge to this graph. Returns an error if the new edge would introduce a cycle in the graph.
func (*Graph) RemoveEdge ¶
RemoveEdge removes an edge from this graph.
type RequestHandler ¶
type RequestHandler[Request any, Response ResponseTo[Request]] func(Request) (Response, error)
RequestHandler is a function that processes a request of a given type, and returns a response or an error to be sent back to the client.
type ResponseTo ¶
type ResponseTo[Request any] interface { IsResponseTo(Request) }