(fn Function)
| 730 | } |
| 731 | |
| 732 | func (m *Manager) lookupFunctionRoute(fn Function) (handler func(Function), scheduleKey string, ok bool) { |
| 733 | snap, ok := m.snapshotFunction(fn.Name) |
| 734 | if !ok { |
| 735 | return nil, "", false |
| 736 | } |
| 737 | unknownHandler := m.unknownFunctionHandler() |
| 738 | |
| 739 | if len(snap.prefixes) > 0 { |
| 740 | if len(fn.Args) > 0 { |
| 741 | id := fn.Args[0] |
| 742 | if prefix, routeHandler, matched := matchPrefix(snap.prefixes, id); matched && routeHandler != nil { |
| 743 | return routeHandler, routeScheduleKey(fn.Name, prefix), true |
| 744 | } |
| 745 | } |
| 746 | |
| 747 | return unknownHandler, routeScheduleKey(fn.Name, scheduleKeyUnmatched), true |
| 748 | } |
| 749 | |
| 750 | if snap.direct != nil { |
| 751 | return snap.direct, routeScheduleKey(fn.Name, ""), true |
| 752 | } |
| 753 | |
| 754 | return unknownHandler, routeScheduleKey(fn.Name, scheduleKeyDirectMissing), true |
| 755 | } |
| 756 | |
| 757 | // lookupFunction returns a snapshot handler used by existing tests to verify |
| 758 | // registry snapshot semantics at lookup time. |
no test coverage detected