Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for sub-indexes #120

Merged
merged 5 commits into from
Oct 18, 2023
Merged

Add support for sub-indexes #120

merged 5 commits into from
Oct 18, 2023

Commits on Oct 15, 2023

  1. Add support for sub-indexes

    <details>
    <summary>Background</summary>
    
    Sally renders two kinds of pages:
    
    - packages: These are for packages defined in sally.yaml
      and any route under the package path.
    - indexes: These list available packages.
    
    The latter--indexes was previously only supported at '/', the root page.
    
    This leads to a slight UX issue:
    if you have a package with a / in its name (e.g. net/metrics):
    
    - example.com/net/metrics gives you the package page
    - example.com/ lists net/metrics
    - However, example.com/net fails with a 404
    
    </details>
    
    This adds support for index pages on all parents of package pages.
    Therefore, if example.com/net/metrics exists,
    example.com/net will list all packages defined under that path.
    
    To make this possible, the internals have been rewritten to some degree:
    CreateHandler no longer builds an http.ServeMux
    with a bunch of pre-registered http.Handlers.
    It now builds a custom http.Handler with its own routing.
    
    Routing is backed by a new pathTree abstraction.
    pathTree is a specialized string-value storage
    with support for inheriting values from a parent.
    It has the following methods:
    
    - `Set(path, v)` associates v with path.
    - `Lookup(path)` returns the value at path,
      or the value inherited from the closest ancestor.
    - `ListByPath(path)` lists all values at or under the given path.
    
    For additional confidence in the implementation of pathTree,
    a property test based on rapid is included.
    
    Resolves uber-go#31
    abhinav committed Oct 15, 2023
    Configuration menu
    Copy the full SHA
    c8ca51f View commit details
    Browse the repository at this point in the history

Commits on Oct 17, 2023

  1. Simplify the implementation

    Switch back to http.ServeMux for package handlers,
    and move the scanning logic to the index handler.
    abhinav committed Oct 17, 2023
    Configuration menu
    Copy the full SHA
    30ef30e View commit details
    Browse the repository at this point in the history

Commits on Oct 18, 2023

  1. handler.go: Better formatting on packageTemplate

    Co-authored-by: Matt Way <[email protected]>
    abhinav and mway authored Oct 18, 2023
    Configuration menu
    Copy the full SHA
    6c18e78 View commit details
    Browse the repository at this point in the history
  2. handler_test: Sort+Equal => ElementsMatch

    Co-authored-by: Sung Yoon Whang <[email protected]>
    abhinav and sywhang authored Oct 18, 2023
    Configuration menu
    Copy the full SHA
    f6f83a4 View commit details
    Browse the repository at this point in the history
  3. oops

    abhinav committed Oct 18, 2023
    Configuration menu
    Copy the full SHA
    322469f View commit details
    Browse the repository at this point in the history