To make use of the filtering feature, we need to revert the internal walker to a real DFS.
We will therefore just invert the whole tree by storing all of its
contents in a level-keyed vector.
This is horribly expensive in memory, this is a compromise between CPU
and memory, here is the fundamental reason for why:
When you encounter a directory, it's either a leaf or not, i.e. it
contains subdirectories or not.
To know this fact, you can:
- wait until you notice subdirectories under it, i.e. you need to store
any intermediate nodes you see in the meantime -> memory penalty.
- getdents or readdir on it to determine *NOW* its subdirectories -> CPU
penalty and I/O penalty.
This is an implementation of the first proposal, we pay memory.
In practice, we are paying O(#nb of nodes) in memory.
There's a smarter albeit much more complicated algorithm that pays only
O(\sum_i #siblings(p_i)) nodes where (p_1, ..., p_n) is the path to a leaf.
which means for:
A
/ \
B C
/ / \
D E F
We would never store D, E, F but only E, F at a given time.
But we would still store B, C no matter what.
Change-Id: I456ed1c3f0db493e018ba1182665d84bebe29c11
Reviewed-on: https://cl.tvl.fyi/c/depot/+/10567
Tested-by: BuildkiteCI
Autosubmit: raitobezarius <tvl@lahfa.xyz>
Reviewed-by: flokli <flokli@flokli.de>
|
||
|---|---|---|
| .gcroots | ||
| .nixery | ||
| corp | ||
| docs | ||
| fun | ||
| lisp | ||
| net | ||
| nix | ||
| ops | ||
| third_party | ||
| tools | ||
| tvix | ||
| users | ||
| views | ||
| web | ||
| .envrc | ||
| .git-blame-ignore-revs | ||
| .gitignore | ||
| .hgignore | ||
| .mailmap | ||
| .rgignore | ||
| buf.gen.yaml | ||
| buf.yaml | ||
| default.nix | ||
| LICENSE | ||
| OWNERS | ||
| README.md | ||
| RULES | ||
| rustfmt.toml | ||
depot
This repository is the monorepo for the community around The Virus Lounge, containing our personal tools and infrastructure. Everything in here is built using Nix.
A large portion of the software here is very self-referential, meaning that it exists to sustain the operation of the repository. This is the case because we partially see this as an experiment in tooling for monorepos.
Highlights
Services
-
Source code is available primarily through Sourcegraph on cs.tvl.fyi, where it is searchable and even semantically indexed. A lower-tech view of the repository is also available via cgit-pink on code.tvl.fyi.
The repository can be cloned using
gitfromhttps://cl.tvl.fyi/depot. -
All code in the depot, with the exception of code that is checked in to individual
//usersfolders, needs to be reviewed. We use Gerrit on cl.tvl.fyi for this. -
Issues are tracked via our own issue tracker on b.tvl.fyi. Its source code lives at
//web/panettone/. -
Smaller todo-list entries which do not warrant a separate issue are listed at todo.tvl.fyi.
-
We use Buildkite for CI. Recent builds are listed on tvl.fyi/builds and pipelines are configured dynamically via
//ops/pipelines. -
A search service that makes TVL services available via textual shortcuts is available: atward
All services that we host are deployed on NixOS machines that we manage. Their
configuration is tracked in //ops/{modules,machines}.
Nix
//nix/readTreecontains the Nix code which automatically registers projects in our Nix attribute hierarchy based on their in-tree location//tools/nixerycontains the source code of Nixery, a container registry that can build images ad-hoc from Nix packages//nix/yantscontains Yet Another Nix Type System, which we use for a variety of things throughout the repository//nix/buildGoimplements a Nix library that can build Go software in the style of Bazel'srules_go. Go programs in this repository are built using this library.//nix/buildLispimplements a Nix library that can build Common Lisp software. Currently only SBCL is supported. Lisp programs in this repository are built using this library.//web/blogand//web/atom-feed: A Nix-based static site generator which generates the web page and Atom feed for tazj.in (//users/tazjin/homepage) and tvl.fyi (//web/tvl)//web/bubblegumcontains a CGI-based web framework written in Nix.//nix/nint: A shebang-compatible interpreter wrapper for Nix.//tvixcontains initial work towards a modular architecture for Nix.
We have a variety of other tools and libraries in the //nix folder which may
be of interest.
Packages / Libraries
//net/alcoholic_jwtcontains an easy-to-use JWT-validation library for Rust//net/crimpcontains a high-level HTTP client using cURL for Rust//tools/emacs-pkgscontains various useful Emacs libraries, for example:dottime.elprovides dottime in the Emacs modelinenix-util.elprovides editing utilities for Nix filesterm-switcher.elis an ivy-function for switching between vterm bufferstvl.elprovides helper functions for interacting with the TVL monorepo
//lisp/klatreprovides a grab-bag utility library for Common Lisp
User packages
Contributors to the repository have user directories under
//users, which can be used for
personal or experimental code that does not require review.
Some examples:
//users/grfn/xanthous: A (WIP) TUI RPG, written in Haskell.//users/tazjin/emacs: tazjin's Emacs & EXWM configuration//users/tazjin/finito: A persistent finite-state machine library for Rust.
Licensing
Unless otherwise stated in a subdirectory, all code is licensed under the MIT license. See LICENSE for details.
Contributing
If you'd like to contribute to any of the tools in here, please check out the contribution guidelines and our code of conduct.
IRC users can find us in #tvl on hackint, which is also
reachable via XMPP at #tvl@irc.hackint.org (sic!).
Hackint also provide a web chat.