func NewRouteRegistry(logger lager.Logger, c *config.Config, reporter reporter.RouteRegistryReporter) *RouteRegistry { r := &RouteRegistry{} r.logger = logger r.byUri = container.NewTrie() r.pruneStaleDropletsInterval = c.PruneStaleDropletsInterval r.dropletStaleThreshold = c.DropletStaleThreshold r.suspendPruning = func() bool { return false } r.reporter = reporter return r }
"code.cloudfoundry.org/routing-api/models" "code.cloudfoundry.org/gorouter/registry/container" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("Trie", func() { var ( r *container.Trie modTag models.ModificationTag ) BeforeEach(func() { r = container.NewTrie() modTag = models.ModificationTag{} }) Describe(".Find", func() { It("works for the root node", func() { p := route.NewPool(42, "") r.Insert("/", p) node := r.Find("/") Expect(node).To(Equal(p)) }) It("finds an exact match to an existing key", func() { p := route.NewPool(42, "") r.Insert("/foo/bar", p) node := r.Find("/foo/bar")